Skip to content

Commit

Permalink
[pdflatex] Enable book style build of PDF via LaTeX (#139)
Browse files Browse the repository at this point in the history
* [pdflatex] Enable book style build of PDF via LaTeX

* Add final build of html for asset detection, configure to use just binder

* remove initial build of html

* remove initial build of html

* rename PDF
  • Loading branch information
mmcky authored May 11, 2021
1 parent 846e4f2 commit 0229091
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
with:
Expand Down
34 changes: 28 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions lectures/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"]
Expand Down

2 comments on commit 0229091

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.