diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b144d92..4dc1a0c8 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: lecture-python-programming + - 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,16 +39,24 @@ jobs: branch: master name: build-cache path: _build - - name: Build HTML - shell: bash -l {0} - run: | - jb build lectures --path-output ./ + # Build Assets (Download Notebooks and PDF via LaTeX) - 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 + - name: Build PDF from LaTeX + shell: bash -l {0} + run: | + jb build lectures --builder pdflatex --path-output ./ -n --keep-going + mkdir _build/html/_pdf + cp -u _build/latex/*.pdf _build/html/_pdf + # Final Build of HTML + - name: Build HTML + shell: bash -l {0} + run: | + jb build lectures --path-output ./ - name: Preview Deploy to Netlify uses: nwtgck/actions-netlify@v1.1 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b18c2915..15ffd7db 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,16 +19,24 @@ 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 - shell: bash -l {0} - run: | - jb build lectures --path-output ./ + # Build Assets (Download Notebooks, PDF via LaTeX) - name: Build Download Notebooks (sphinx-tojupyter) shell: bash -l {0} run: | @@ -41,8 +49,22 @@ 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 + - name: Build PDF from LaTeX + shell: bash -l {0} + run: | + jb build lectures --builder pdflatex --path-output ./ -n --keep-going + - name: Copy LaTeX PDF for GH-PAGES + shell: bash -l {0} + run: | + mkdir -p _build/html/_pdf + cp -u _build/latex/*.pdf _build/html/_pdf + # Final Build of HTML (with assets) + - 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 d33f2283..5d6f9090 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -11,6 +11,10 @@ execute: html: baseurl: https://python.quantecon.org/ +latex: + latex_documents: + targetname: quantecon-python-programming.tex + sphinx: extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter] config: @@ -31,9 +35,7 @@ sphinx: launch_buttons: notebook_interface : classic # The interface interactive links will activate ["classic", "jupyterlab"] binderhub_url : https://mybinder.org # The URL of the BinderHub (e.g., https://mybinder.org) - jupyterhub_url : https://datahub.berkeley.edu # The URL of the JupyterHub (e.g., https://datahub.berkeley.edu) thebe : false # Add a thebe button to pages (requires the repository to run on Binder) - colab_url : https://colab.research.google.com # The URL of Google Colab (https://colab.research.google.com) rediraffe_redirects: index_toc.md: intro.md tojupyter_static_file_path: ["source/_static", "_static"]