coderefinery / documentation

How to document your research software
https://coderefinery.github.io/documentation/
Creative Commons Attribution 4.0 International
28 stars 50 forks source link

Math expression rendered as "\[a^2 + b^2 = c^2\]" in pdf file #272

Open FredM67 opened 1 year ago

FredM67 commented 1 year ago

Hi, It looks like the pdf generation does not work properly with math expression. The lesson.pdf file contains "[a^2 + b^2 = c^2]" instead of the "real" math expression.

Fred

bast commented 1 year ago

Thanks for reporting!

FredM67 commented 1 year ago

BTW, it works fine when using "pure" Latex... BUT.... the generated doc is a pure typical latex document (somehow black&white, no graphic, ...).... Do you have some config package to get a similar result like with simplepdf ?

bast commented 1 year ago

I am unsure what is simplepdf. Can you please expand a bit?

FredM67 commented 1 year ago

I am unsure what is simplepdf. Can you please expand a bit?

That's an extension to build a PDF from the doc https://github.com/useblocks/sphinx-simplepdf

rkdarst commented 1 year ago

Thanks for reporting this! Indeed, it was a problem. I did my usual and asked "what does jupyter-book" do and found an issue that was fixed by this: https://github.com/executablebooks/jupyter-book/pull/1774/files

This is the current extension we use to make a pdf (using pyppeteer, which from my investigation seemed similar to weasyprint) https://pypi.org/project/sphinx-pyppeteer-builder/ - it seems to be the same spirit as simplepdf: renders HTML and then using a headless browser to make a PDF out of it. But it seems more true to the original style than simplepdf.

I tried to modify sphinx_pyppeteer_builder with the jupyter-book fix, and it didn't work. sphinx-simplepdf doesn't currently work either, but a fix is added using imgmath (and I pointed out the other fix): https://github.com/useblocks/sphinx-simplepdf/pull/86 original report in sphinx-simplepdf: https://github.com/useblocks/sphinx-simplepdf/issues/8

So with this... I guess let's see what happens with the two builders and adjust to the one that can work most easily.

Thanks for the report! I hope it can be fixed soon, somehow.

(for others testing:

$ pip install https://github.com/useblocks/sphinx-simplepdf/archive/main.zip
$ make simplepdf

and check the output in _build/simplepdf )

FredM67 commented 1 year ago

Well, I prefer far more simplepdf, even the design does not match the web design, because:

That'll a lot to "repair" in pyppeteer !

image You see, on the left it's pyppeteer, on the right simplepdf.