documentation icon indicating copy to clipboard operation
documentation copied to clipboard

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

Open FredM67 opened this issue 2 years ago • 6 comments

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

FredM67 avatar Aug 29 '23 05:08 FredM67

Thanks for reporting!

bast avatar Aug 29 '23 12:08 bast

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 ?

FredM67 avatar Aug 29 '23 15:08 FredM67

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

bast avatar Aug 30 '23 06:08 bast

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

FredM67 avatar Aug 30 '23 06:08 FredM67

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 )

rkdarst avatar Sep 06 '23 20:09 rkdarst

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

  • it has a TOC
  • it does not break blocks in the middle
  • paragraphs/chapters never start at the end of a page

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

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

FredM67 avatar Sep 06 '23 21:09 FredM67