lecture-datascience.myst
lecture-datascience.myst copied to clipboard
ENH: Enable PDF book style build via LaTeX
This PR enables the book style PDF to be built via LaTeX.
Changes:
Upgrading to mathjax v3 to use textmacros was necessary, to escape _
inside \text{}
as it is a special character. https://github.com/QuantEcon/lecture-datascience.myst/compare/pdf-changes?expand=1#diff-596037ac6201ed91873ef81f374bc604c6c1f0a4d56833e749433585288d7b1eR135
NOTE that while using _
or any special characters inside \text{}
we need to escape it. Like its done in this PR by using \_
instead of _
{align*}
is an environment, which throws errors in latex, when its inside another environment like $$
. Using {aligned}
instead is the way to go.
{align*}
is an environment, which throws errors in latex, when its inside another environment like$$
. Using{aligned}
instead is the way to go.
Thanks @AakashGfude 👍 -- this is because aligned
is not a full math environment
so can be used within the $$
. I will add an update to https://manual.quantecon.org/writing/styleguide.html#mathematical-notation with a better explanation for the quantecon style guide.
- [x] update
environment.yml
to includequantecon-book-theme==0.2.8
Actually this is taken care of for automatic minor version updates:
- quantecon-book-theme>=0.2.5,<0.3.0
quantecon-book-theme 0.2.8 is now released.
@AakashGfude is there a package I need to add to support the image conversion?
@AakashGfude do the image file references need support for folders
?
../_build/jupyter_execute/working_with_text_52_0.png
or is this directory a flat collection if images?
@AakashGfude I just ran this branch locally -- it seems to build the pdf
. Perhaps the images
are not getting "written" in the server environment (or saved from the execution steps). Hmm ....
Actually my local jupyter_execute
is organised in folders
lectures/_build/jupyter_execute adjust-toc ✔ 2m
▶ ls
applications index.py pandas python_fundamentals theme
index.ipynb introduction problem_sets scientific
@AakashGfude I have opened https://github.com/QuantEcon/lecture-datascience.myst/pull/194 to update _toc.yml
into jb-book
format for better pdflatex
outputs.
- [ ] merge https://github.com/QuantEcon/lecture-datascience.myst/pull/194
@mmcky , i think the path is different in server than in local? Is their an artifact we can download?
@mmcky actually the path generated is wrong altogether, as the file it is trying to find, for example, is '../_build/jupyter_execute/plotting_5_1.png'
but the file is in path jupyter_execute/scientific/plotting_5_1.png
yeah -- that's right. It seems to be missing the nested
folder (scientific
) right?
yeah -- that's right. It seems to be missing the
nested
folder (scientific
) right?
@mmcky But also, locally it is noindent\sphinxincludegraphics{{plotting_5_1}.png}
in tex file, . the images ideally get copied to where the tex file is in the _build/latex
folder and it accesses that one instead of the one in jupyter_execute
yeah -- that's right. It seems to be missing the
nested
folder (scientific
) right?@mmcky But also, locally it is
noindent\sphinxincludegraphics{{plotting_5_1}.png}
in tex file, . the images ideally get copied to where the tex file is in the_build/latex
folder and it accesses that one instead of the one injupyter_execute
How do they avoid conflicts -- is that _5_1
in chapter 5 section 1? Or just a numbering system in that file as in (
@AakashGfude the _build
folder is available
https://github.com/QuantEcon/lecture-datascience.myst/actions/runs/1357596935
under artifacts
@AakashGfude so the _build
folder from github actions
doesn't have any of the png
images in _build/latex
unlike the local build. So the images are not getting copied over (as you say).
@AakashGfude so the
_build
folder fromgithub actions
doesn't have any of thepng
images in_build/latex
unlike the local build. So the images are not getting copied over (as you say).
Hmm, will check what is 'cause' and what is 'effect' here
@AakashGfude so the
_build
folder fromgithub actions
doesn't have any of thepng
images in_build/latex
unlike the local build. So the images are not getting copied over (as you say).Hmm, will check what is 'cause' and what is 'effect' here
@AakashGfude what confuses me is that the other repos are building on github actions
just fine. So it must be something to do with this repo structure such as nested folders.
@mmcky you are right. it was a nested folder issue, when a different output path is specified using --path-output
. The bug was on the Myst-NB side: https://github.com/executablebooks/MyST-NB/issues/367
The following PR should fix it https://github.com/executablebooks/MyST-NB/pull/368
thanks @AakashGfude for your input here.
@jlperla we have made some improvements to the stack. I will release a new version of myst-nb
which includes a fix that will enable the book
style pdf for this project.
- [ ] merge after new
myst-nb==0.13.2
is released https://github.com/executablebooks/MyST-NB/pull/369
@mmcky @AakashGfude Sounds great! Feel free to merge when you are happy with it
@AakashGfude can you review these conflicts
This PR will break the Plotly graph as it uses mathjaxv3 instead of v2. The reason for this is mentioned in this PR description. Have to find some common ground before merging this.
@AakashGfude just ping me once this is ready for review and we can then merge once you're happy.
@mmcky I am not sure what is causing this. But the netlify link is not rendering plotly figures. but my local environment is. tried to mimic the packages.
This PR has been halted from merging, because of HTML build failing. Which is caused by the server of Canadian government, geolocation service being currently down. https://www.nrcan.gc.ca/science-and-data/science-and-research/earth-sciences/geography/topographic-information/web-services/geolocation-service/17304
@AakashGfude hopefully this server issue is now resolved. So could you re-trigger the CI
to check.
@mmcky I did run it again, and got the following error. working_with_text.log
Some nltk issue, 9omw-1.4 not found
.
@mmcky I did run it again, and got the following error. working_with_text.log
Some nltk issue,
9omw-1.4 not found
.
Is this on your local? I saw the CI
last ran on 3rd Jan.
Roger that. @jbrightuniverse any ideas on how to resolve this nltk
issue?
according to those logs:
Resource [93momw-1.4[0m not found.
Please use the NLTK Downloader to obtain the resource:
[31m>>> import nltk
>>> nltk.download('omw-1.4')
[0m
For more information see: https://www.nltk.org/data.html
it seems that a language set is missing? the logs claim executing that line at some point in the build would solve it; I'm not familiar with the codebase so I'm not sure if that already happens or if the set is expected to already be there. Also notable is the logs claim:
Attempted to load [93mcorpora/omw-1.4.zip/omw-1.4/[0m
Searched in:
- '/home/runner/nltk_data'
- '/usr/share/miniconda3/envs/lecture-datascience/nltk_data'
- '/usr/share/miniconda3/envs/lecture-datascience/share/nltk_data'
- '/usr/share/miniconda3/envs/lecture-datascience/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'