-
-
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
latex macros not in $$s not applied to math environments for markdown -> html #2382
Comments
Pandoc only expands macro definitions if they're not inside a raw latex block (which is what your So, the fix is to put this into a proper math environment, and use
|
That works for html output, but not for pdf:
It seems we're being hit by the curse of having too many ways of doing one thing. |
You're getting an error message that says you have |
Oops; I missed that: you're right, I just put I am used to using the amsmath environments, and would like to continue using them, but More seriously, this seems like a major point of confusion for users unfamiliar with how pandoc parses the document (like me): macros are expanded in some of the latex, but not all of it. For mathjax or pdf output, passing the macros on downstream in the right way would do the trick, no? |
+++ Peter Ralph [Sep 01 15 23:09 ]:
Yes, that's probably right. |
Suggestion: try
This should cause macros to be passed downstream as they already are for PDF. |
My two intial examples differ in that one wraps the macros in '$$'s. Using Since pandoc recognizes macros, couldn't it wrap the macros in |
+++ Peter Ralph [Nov 24 15 21:26 ]:
It's not so simple, because of the reader/writer separation. |
Hm, I see. Same thing for the One option, and a tidier one than putting macros at the top of documents: I could store my macros in a separate .tex file, and modify the html and latex templates to include it in the right way, maybe specified in the YAML. For instance:
and then, in the right place:
... the right way to get them into the html looks less obvious. |
+++ Peter Ralph [Nov 24 15 23:10 ]:
You can use a trick like
to inject the string content directly into the template. |
Or, without modifying the template, for html:
and for pdf:
both work if this is
and this is
|
I have a reasonable way to do this now, so I'm closing this issue, but a good way to make it smoother for newcomers would still be nice. I don't know if this warrants a special command-line flag, but that'd be one way: like |
I am converting from markdown to html and to pdf, with
\newcommand
s up top. I can either wrap these in '$$'s or not, but both options are broken in different ways:This example:
produces pdf output fine, but the second
\E
, inside the\align
, is not expanded.On the other hand, this example:
produces the correct html, but producing a pdf dies with
This seems to be part of a larger conversation, e.g. #1426?
The text was updated successfully, but these errors were encountered: