Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FredM67 opened this issue Aug 29, 2023 · 6 comments
Open

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

FredM67 opened this issue Aug 29, 2023 · 6 comments

Comments

@FredM67
Copy link

FredM67 commented Aug 29, 2023

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
Copy link
Member

bast commented Aug 29, 2023

Thanks for reporting!

@FredM67
Copy link
Author

FredM67 commented Aug 29, 2023

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
Copy link
Member

bast commented Aug 30, 2023

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

@FredM67
Copy link
Author

FredM67 commented Aug 30, 2023

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
Copy link
Member

rkdarst commented Sep 6, 2023

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): useblocks/sphinx-simplepdf#86
original report in sphinx-simplepdf: useblocks/sphinx-simplepdf#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
Copy link
Author

FredM67 commented Sep 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants