Skip to content

Commit 0229091

Browse files
authored
[pdflatex] Enable book style build of PDF via LaTeX (#139)
* [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
1 parent 846e4f2 commit 0229091

File tree

3 files changed

+55
-12
lines changed

3 files changed

+55
-12
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ jobs:
1515
python-version: 3.8
1616
environment-file: environment.yml
1717
activate-environment: lecture-python-programming
18+
- name: Install latex dependencies
19+
run: |
20+
sudo apt-get -qq update
21+
sudo apt-get install -y \
22+
texlive-latex-recommended \
23+
texlive-latex-extra \
24+
texlive-fonts-recommended \
25+
texlive-fonts-extra \
26+
texlive-xetex \
27+
latexmk \
28+
xindy
1829
- name: Display Conda Environment Versions
1930
shell: bash -l {0}
2031
run: conda list
@@ -28,16 +39,24 @@ jobs:
2839
branch: master
2940
name: build-cache
3041
path: _build
31-
- name: Build HTML
32-
shell: bash -l {0}
33-
run: |
34-
jb build lectures --path-output ./
42+
# Build Assets (Download Notebooks and PDF via LaTeX)
3543
- name: Build Download Notebooks (sphinx-tojupyter)
3644
shell: bash -l {0}
3745
run: |
3846
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
3947
mkdir -p _build/html/_notebooks
4048
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
49+
- name: Build PDF from LaTeX
50+
shell: bash -l {0}
51+
run: |
52+
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
53+
mkdir _build/html/_pdf
54+
cp -u _build/latex/*.pdf _build/html/_pdf
55+
# Final Build of HTML
56+
- name: Build HTML
57+
shell: bash -l {0}
58+
run: |
59+
jb build lectures --path-output ./
4160
- name: Preview Deploy to Netlify
4261
uses: nwtgck/[email protected]
4362
with:

.github/workflows/publish.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,24 @@ jobs:
1919
python-version: 3.8
2020
environment-file: environment.yml
2121
activate-environment: quantecon
22+
- name: Install latex dependencies
23+
run: |
24+
sudo apt-get -qq update
25+
sudo apt-get install -y \
26+
texlive-latex-recommended \
27+
texlive-latex-extra \
28+
texlive-fonts-recommended \
29+
texlive-fonts-extra \
30+
texlive-xetex \
31+
latexmk \
32+
xindy
2233
- name: Display Conda Environment Versions
2334
shell: bash -l {0}
2435
run: conda list
2536
- name: Display Pip Versions
2637
shell: bash -l {0}
2738
run: pip list
28-
- name: Build HTML
29-
shell: bash -l {0}
30-
run: |
31-
jb build lectures --path-output ./
39+
# Build Assets (Download Notebooks, PDF via LaTeX)
3240
- name: Build Download Notebooks (sphinx-tojupyter)
3341
shell: bash -l {0}
3442
run: |
@@ -41,8 +49,22 @@ jobs:
4149
- name: Copy Download Notebooks for GH-PAGES
4250
shell: bash -l {0}
4351
run: |
44-
mkdir _build/html/_notebooks
45-
cp _build/jupyter/*.ipynb _build/html/_notebooks
52+
mkdir -p _build/html/_notebooks
53+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
54+
- name: Build PDF from LaTeX
55+
shell: bash -l {0}
56+
run: |
57+
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
58+
- name: Copy LaTeX PDF for GH-PAGES
59+
shell: bash -l {0}
60+
run: |
61+
mkdir -p _build/html/_pdf
62+
cp -u _build/latex/*.pdf _build/html/_pdf
63+
# Final Build of HTML (with assets)
64+
- name: Build HTML
65+
shell: bash -l {0}
66+
run: |
67+
jb build lectures --path-output ./
4668
- name: Deploy website to gh-pages
4769
uses: peaceiris/actions-gh-pages@v3
4870
with:

lectures/_config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ execute:
1111
html:
1212
baseurl: https://python.quantecon.org/
1313

14+
latex:
15+
latex_documents:
16+
targetname: quantecon-python-programming.tex
17+
1418
sphinx:
1519
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter]
1620
config:
@@ -31,9 +35,7 @@ sphinx:
3135
launch_buttons:
3236
notebook_interface : classic # The interface interactive links will activate ["classic", "jupyterlab"]
3337
binderhub_url : https://mybinder.org # The URL of the BinderHub (e.g., https://mybinder.org)
34-
jupyterhub_url : https://datahub.berkeley.edu # The URL of the JupyterHub (e.g., https://datahub.berkeley.edu)
3538
thebe : false # Add a thebe button to pages (requires the repository to run on Binder)
36-
colab_url : https://colab.research.google.com # The URL of Google Colab (https://colab.research.google.com)
3739
rediraffe_redirects:
3840
index_toc.md: intro.md
3941
tojupyter_static_file_path: ["source/_static", "_static"]

0 commit comments

Comments
 (0)