diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64de906d0..aabb47991 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,17 @@ jobs: python-version: 3.8 environment-file: environment.yml activate-environment: quantecon + - name: Install latex dependencies + run: | + sudo apt-get -qq update + sudo apt-get install -y \ + texlive-latex-recommended \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-fonts-extra \ + texlive-xetex \ + latexmk \ + xindy - name: Display Conda Environment Versions shell: bash -l {0} run: conda list @@ -28,6 +39,20 @@ jobs: branch: main name: build-cache path: _build + # Build Assets (Download Notebooks and PDF via LaTeX) + - name: Build PDF from LaTeX + shell: bash -l {0} + run: | + jb build lectures --builder pdflatex --path-output ./ -n --keep-going + mkdir -p _build/html/_pdf + cp -u _build/latex/*.pdf _build/html/_pdf + - name: Build Download Notebooks (sphinx-tojupyter) + shell: bash -l {0} + run: | + jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter + mkdir -p _build/html/_notebooks + cp -u _build/jupyter/*.ipynb _build/html/_notebooks + # Build HTML (Website) - name: Build HTML shell: bash -l {0} run: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0ce6e86e9..101639392 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,16 +19,33 @@ jobs: python-version: 3.8 environment-file: environment.yml activate-environment: quantecon + - name: Install latex dependencies + run: | + sudo apt-get -qq update + sudo apt-get install -y \ + texlive-latex-recommended \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-fonts-extra \ + texlive-xetex \ + latexmk \ + xindy - name: Display Conda Environment Versions shell: bash -l {0} run: conda list - name: Display Pip Versions shell: bash -l {0} run: pip list - - name: Build HTML + # Build Assets (Download Notebooks and PDF via LaTeX) + - name: Build PDF from LaTeX shell: bash -l {0} run: | - jb build lectures --path-output ./ + jb build lectures --builder pdflatex --path-output ./ -n --keep-going + - name: Copy LaTeX PDF for GH-PAGES + shell: bash -l {0} + run: | + mkdir _build/html/_pdf + cp _build/latex/*.pdf _build/html/_pdf - name: Build Download Notebooks (sphinx-tojupyter) shell: bash -l {0} run: | @@ -41,8 +58,13 @@ jobs: - name: Copy Download Notebooks for GH-PAGES shell: bash -l {0} run: | - mkdir _build/html/_notebooks - cp _build/jupyter/*.ipynb _build/html/_notebooks + mkdir -p _build/html/_notebooks + cp -u _build/jupyter/*.ipynb _build/html/_notebooks + # Build HTML (Website) + - name: Build HTML + shell: bash -l {0} + run: | + jb build lectures --path-output ./ - name: Deploy website to gh-pages uses: peaceiris/actions-gh-pages@v3 with: diff --git a/lectures/_config.yml b/lectures/_config.yml index b76a173b3..6125be3d1 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -13,6 +13,10 @@ bibtex_bibfiles: html: baseurl: https://python.quantecon.org/ +latex: + latex_documents: + targetname: quantecon-python.tex + sphinx: extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter] config: