-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support nested LaTeX macro expansions in Markdown reader #4253
Comments
Questions like this should go to the pandoc-discuss mailing list rather than here. That way we can sort out what's a bug, and what's a question with a simple answer, and we get focused bug reports rather than big lists of possibly unrelated things. On (1), pandoc has to guess what is included in the LaTeX command. This is a fairly unusual form, with a bracketed optional argument after a regular braced argument, so pandoc guesses wrong. The recommended way of dealing with this is the The With (3), you're simply running into YAML escaping issues. The easiest solution is to use this form:
but you could also do
(4) seems to be a bug. At least, we shouldn't in any circumstances go into an infinite loop. IS this a real example? Why would you use a |
I'd suggest you close this issue and open a new issue focused on (4). |
Actually, I've already got a fix for (4), so I'll close this. |
As I was just about to submit a separate bug report. (By the way, the real example comes from |
Oh, I see -- you're trying to wrap
This gives
I'm not sure how we should treat such cases in pandoc. |
OK, here's a case that works in latex:
Output is "hi". |
I'm not sure what the general policy should be for pandoc. For my purposes, it works using:
Since this kind of question seems to keep coming up, perhaps this trick should be documented in the |
I'll do that. |
I've fixed the underlying issue in the LaTeX reader, but it's still not working properly for LaTeX in markdown, so I'm leaving this issue open until we can handle:
|
Possible workaround |
header-includes
With pandoc 2.1 (compiled with pandoc-types 1.17.3, texmath 0.10.1, skylighting 0.5.1) on Mac (10.13.2), I'm having problems with parsing LaTeX commands in
header-includes
. In general, I'm processing a file of the form:through
pandoc -standalone -t native
. The problem takes many forms, depending on what replaces[LATEX COMMAND]
.With
[LATEX COMMAND]
replaced by\command{\first}[second]{\third}
, I end up gettingNote that everything after
{\first}
is interpreted as a string, resulting in escaped square brackets (\[
and\]
) in the LaTeX output. Clearly that's not desired.Searching around, I see similar problems reported and solved. Here's one apparently working example: https://groups.google.com/d/msg/pandoc-discuss/C4WABPg3GWs/cKLiKOAqBQAJ. This doesn't work for me. Instead, using:
for
header-includes
, I end up getting:That is, the content of the
header-includes
simply goes missing.In that same thread, I see the following advice: https://groups.google.com/d/msg/pandoc-discuss/C4WABPg3GWs/4Ij4WlCqBgAJ. In short, enclose raw LaTeX in
\
... `{=latex}`, as follows:(That advice was for the then dev version of pandoc; I don't know whether it's intended to still work.) When I try this, pandoc reports an error:
When I use the trick of defining
\noop
that had worked before pandoc 2.0, I find simple cases (such as in (1-3) above) work, but the case I'm interested in results in pandoc being stuck in an endless loop. That case is something of the form:The key here is the
#1
in the second line: without it, things work fine.I hope all of that is clear enough. Many thanks for this amazing program.
The text was updated successfully, but these errors were encountered: