pbdl-book/make-pdf.sh

67 lines
1.9 KiB
Bash
Raw Normal View History

2021-04-04 07:48:21 +02:00
# source this file with "." in a shell
2022-04-18 09:59:35 +02:00
# note this script assumes the following paths/versions: python3.7 , /Users/thuerey/Library/Python/3.7/bin/jupyter-book
2023-11-14 21:18:45 +01:00
# updated for nMBA !
2022-04-18 09:59:35 +02:00
# do clean git checkout for changes from json-cleanup-for-pdf.py via:
2022-05-04 13:00:23 +02:00
# git checkout diffphys-code-burgers.ipynb diffphys-code-ns.ipynb diffphys-code-sol.ipynb physicalloss-code.ipynb bayesian-code.ipynb supervised-airfoils.ipynb reinflearn-code.ipynb physgrad-code.ipynb physgrad-comparison.ipynb physgrad-hig-code.ipynb
2021-09-16 16:58:30 +02:00
2021-06-30 22:03:39 +02:00
echo
echo WARNING - still requires one manual quit of first pdf/latex pass, use shift-x to quit
echo
2021-06-30 17:03:07 +02:00
2023-11-14 21:18:45 +01:00
PYT=python3
2021-06-29 18:02:09 +02:00
# warning - modifies notebooks!
2023-11-14 21:18:45 +01:00
${PYT} json-cleanup-for-pdf.py
2021-06-29 18:02:09 +02:00
2021-06-30 17:03:07 +02:00
# clean / remove _build dir ?
2021-06-29 18:02:09 +02:00
2024-10-09 04:36:24 +02:00
/Users/thuerey/Library/Python/3.9/bin/jupyter-book build .
xelatex book
exit # sufficient for newer jupyter book versions
# old "pre" GEN
2023-11-14 21:18:45 +01:00
#/Users/thuerey/Library/Python/3.7/bin/jupyter-book build . --builder pdflatex
2024-10-09 04:36:24 +02:00
#/Users/thuerey/Library/Python/3.9/bin/jupyter-book build . --builder pdflatex
# old cleanup
2021-06-29 18:02:09 +02:00
cd _build/latex
2022-04-15 13:26:29 +02:00
#mv book.pdf book-xetex.pdf # not necessary, failed anyway
# this generates book.tex
2021-06-29 18:02:09 +02:00
2021-06-30 17:03:07 +02:00
rm -f book-in.tex sphinxmessages-in.sty book-in.aux book-in.toc
2022-04-15 13:26:29 +02:00
# rename book.tex -> book-in.tex (this is the original output!)
2021-06-29 18:02:09 +02:00
mv book.tex book-in.tex
mv sphinxmessages.sty sphinxmessages-in.sty
2021-06-30 17:03:07 +02:00
mv book.aux book-in.aux
mv book.toc book-in.toc
2021-08-18 15:48:09 +02:00
#mv sphinxmanual.cls sphinxmanual-in.cls
2021-06-29 18:02:09 +02:00
2023-11-14 21:18:45 +01:00
${PYT} ../../fixup-latex.py
2022-04-15 13:26:29 +02:00
# reads book-in.tex -> writes book-in2.tex
2021-06-29 18:02:09 +02:00
2021-08-17 21:11:13 +02:00
# remove unicode chars via unix iconv
2022-04-15 13:26:29 +02:00
# reads book-in2.tex -> writes book.tex
2021-06-29 18:02:09 +02:00
iconv -c -f utf-8 -t ascii book-in2.tex > book.tex
2021-06-30 22:03:39 +02:00
# finally run pdflatex, now it should work:
2021-06-30 17:03:07 +02:00
# pdflatex -recorder book
2021-04-04 07:48:21 +02:00
pdflatex book
2021-08-07 18:50:37 +02:00
pdflatex book
2021-04-04 07:48:21 +02:00
2021-08-17 21:11:13 +02:00
# for convenience, archive results in main dir
2022-05-05 20:43:36 +02:00
mv book.pdf ../../pbfl-book-pdflatex.pdf
2021-06-30 22:03:39 +02:00
tar czvf ../../pbdl-latex-for-arxiv.tar.gz *
2022-05-05 20:43:36 +02:00
cd ../..
ls -l ./pbfl-book-pdflatex.pdf ./pbdl-latex-for-arxiv.tar.gz
2021-04-04 07:48:21 +02:00