QuantEcon / lecture-source-jl

Source files for "Lectures in Quantitative Economics" -- Julia version
https://julia.quantecon.org
BSD 3-Clause "New" or "Revised" License
131 stars 53 forks source link

FEAT: Making a global book pdf #781

Closed AakashGfude closed 4 years ago

AakashGfude commented 5 years ago

A book pdf of all the chapters is compiled using a separate template file latex_book.tpl

The new configuration variables needed are:-

# make book
jupyter_pdf_book = True

# book title
jupyter_pdf_book_title = "Quantitative Economics with Julia"

# pdf book name
jupyter_pdf_book_name = "quantitative_economics_with_julia"

# pdf index file which contain all the names of parts and chapters
jupyter_pdf_book_index = "index_toc"

The template file to use for latex compilation is specified in the pdf target of the Makefile as jupyter_latex_template_book="latex_book.tpl"

The generated book can be found in the texbook directory inside _build/jupyterpdf with the name specified in jupyter_pdf_book_name variable above.

jupyter_pdf_book variable is present only to turn on/off this feature.

mmcky commented 5 years ago

hey @arnavs I have updated sphinxcontrib-jupyter=0.5.2 which includes support for this PR through PyPI. Would you mind testing on your end before we merge this PR? You will need texlive / xelatex but I think you have tested pdf production before.

arnavs commented 5 years ago

Thanks @mmcky, will give this a go today (Canada time) and report back.

arnavs commented 5 years ago

Could be a macOS thing, but I ran this on my laptop and saw some font-related warnings like the following. Will keep you posted on how the book turns out/give it a go on Linux as well, and see if the warnings go away.

WARNING: xelatex exited with returncode 1 , encounterd in discrete_dp with error -- b"kpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono/BI', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono/B', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono/I', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono/BI', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono/B', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono/I', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameCMU Serif', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameCMU Serif/BI', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameCMU Serif/B', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameCMU Serif/I', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameCMU Serif', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename Liberation Mono', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameLiberation Mono', contains ' '\nkpathsea:make_tex: Invalid filename CMU Serif', contains ' '\nkpathsea:make_tex: Invalid filenameCMU Serif', contains ' '\n"

mmcky commented 5 years ago

thanks @arnavs - @AakashGfude and I will take a look at this also. For the CMU Serif we had to apply

https://tex.stackexchange.com/questions/224296/spaces-in-font-names?noredirect=1&lq=1

on linux to get the lexlive fonts into the system fonts cache

mmcky commented 5 years ago

@arnavs I actually get the same message on os x. Its becuase Liberation Mono isn't included. https://en.wikipedia.org/wiki/Liberation_fonts. I haven't found a fix yet - but the above suggestion linking to texlive may solve the issue.

mmcky commented 5 years ago

@arnavs I will start a clone of the build instance and compile this branch today.

arnavs commented 5 years ago

@mmcky Sounds good. I couldn't get the StackExchange thing to work, but so long as it works on your end I think that's enough.

mmcky commented 4 years ago

@AakashGfude let me know if you don't have time to compare the tpl with python and I will take a quick look. Thanks.

AakashGfude commented 4 years ago

@mmcky , going through this at the moment. the tpl is the same as python. Latex behaves in weird ways. Just trying to find the error in tpl.

mmcky commented 4 years ago

Oh ok - thanks @AakashGfude!