-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
MathJax config #2750
Comments
Use a custom template and put this before the part of the
header where mathjax gets inserted.
|
I see. Thanks! |
Do you have an example of how to do this? |
First, you need to follow the doc from MathJax to setup your MathJax config. Assuming you already done that, the problem with using that in pandoc is that the location of loading the MathJax javascript and the So it means your only bet of getting that work is to have a custom template that you have swap the order of that 2 manually. See Pandoc - Pandoc User’s Guide for more about how you get the template. If you have more question, provide a reproducible set of files and instructions you have gone through so far that didn't work, and I may be able to give you some more hints. |
Ah, I found an old commit as an example: ickc/pandoc-templates-legacy@b6732ae More details: jgm/pandoc-templates was a separate repository in the past, but is now currently a git subtree of jgm/pandoc. This means that all history in jgm/pandoc-templates was lost. The above fork was a fork of the old jgm/pandoc-templates. The shown there is an example of what you need to do (to swap the ordering of loading.) On top of that you need to have a |
Thank you that worked perfectly! |
@ickc I don't really recall this issue. |
I opened #7833 tracking this. This is essentially the same patch at ickc/pandoc-templates-legacy@b6732ae before. |
MathJax expect the config comes before loading the MathJax script. This change of order allows one to config MathJax via header-includes, which loads before the MathJax script. This potentially is a breaking change. However, the only kind math supported by pandoc that is configurable seems to be katex, and according to src/Text/Pandoc/Writers/HTML.hs the way it is configured is hard-coded (katex doesn't seem to offer MathJax style config that is independent of loading katex.) So it seems it is safe to change this order without breaking others' documents. c.f. #2750
Hi,
I want to have a custom setup of MathJax, like this:
I tried to dig into the documentation and also search through the issues, but there seems to have no reference on it.
Note that according to MathJax, the setup has to come before the MathJax is loaded. So if I put the above code in the beginning of the Markdown file, and using
pandoc --mathjax -s -o
the mathjax is put in the head and hence the setup will comes after it.So what's the best way to do this? Template? Are there any way to put something in the head of the html without touching the template? And are there any way to config the mathjax in addition to the link to cdn?
Thanks.
The text was updated successfully, but these errors were encountered: