-
-
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 macro in markdown input mangled in latex output #730
Comments
Oh, I was unaware of |
Actually, it’s more complicated: “LaTeX will not allow you to create a new command that would overwrite an existing one. But there is a special command in case you explicitly want this: So after rechecking, I’m positive we need all three commands. |
Now latex macro definitions are preserved when output is latex, and applied when it is another format, as originally intended. Partially addresses #730. \providecommand is still not supported. For this we need changes to texmath.
Thank you: newcommand and renewcommand work as expected now in pandoc 1.10.1. But could providecommand be added, too? |
+++ nickbart1980 [Jan 29 13 04:58 ]:
That will require changes to the texmath library. So yes, eventually. |
I opened an issue at jgm/texmath#15 for |
I'm using pandoc 1.12.3 and
|
Really? Here's what I'm seeing:
which looks fine. Can you try exactly the same commands? +++ ziggystar [Jan 13 14 06:33 ]:
|
Today it works, I'm completely puzzled. Thank you. P.S.: Got it. Depending on how I call pandoc, either cabal or system installation of pandoc is used. So I was using an older version than I thought. |
Is it a good idea to expand |
\providecommand defines the command only if it's not already
defined. So it's inherently conditional, no? If \institute
is defined, then the \providecommand has no effect.
+++ Phil Ruffwind [Nov 26 17 03:15 ]:
… Is it a good idea to expand \providecommand? Pandoc doesn't necessarily
have the full context of the LaTeX processor. I sometimes use
\providecommand to provide fallbacks if the document class lacks
certain commands, but now (as of v2) Pandoc unconditionally expands
them, which breaks this particular use case.
—
You are receiving this because you commented.
Reply to this email directly, [1]view it on GitHub, or [2]mute the
thread.
References
1. #730 (comment)
2. https://github.com/notifications/unsubscribe-auth/AAAL5NZgYi7dbZrKj90aXaWUo7Ua2qoSks5s6Ne8gaJpZM4AYzJJ
|
That assumes Pandoc can correctly detect whether a command is defined, which would require a full-blown TeX processor. Consider:
$ pandoc -s -M fontfamily=fouriernc test.md -o test.pdf This (as of v2) outputs “fail test” even though |
Pandoc's macro resolution isn't foolproof, for the reason
you give. Still, in general resolving macros is going to
give better results for non-tex output. The key is to
use the `-latex-macros` extension when you're going to
latex or pdf.
+++ Phil Ruffwind [Nov 26 17 15:47 ]:
… That assumes Pandoc can correctly detect whether a command is defined,
which would require a full-blown TeX processor. Consider:
\providecommand{\wideparen}[1]{fail #1}
$\wideparen{test}$
$ pandoc -s -M fontfamily=fouriernc test.md -o test.pdf
This (as of v2) outputs “fail test” even though fouriernc defines
\wideparen, but if I add -f markdown-latex_macros to suppress Pandoc’s
macro expansion, it will produce the correct output (with a parenthesis
that stretches across “test”) as it did in v1.
—
You are receiving this because you commented.
Reply to this email directly, [1]view it on GitHub, or [2]mute the
thread.
References
1. #730 (comment)
2. https://github.com/notifications/unsubscribe-auth/AAAL5BNebbDEI0f-5RHuvlWP51k-nKQmks5s6YgNgaJpZM4AYzJJ
|
Issue #554 is still unsolved:
With
test.txt
containing:and command line:
pandoc -t latex test.txt
(pandoc 1.10.0.5)I get:
i.e.,
newcommand
andrenewcommand
don't even make it into the output, whileprovidecommand
does (fine with me, sinceprovidecommand
is a replacement for bothnewcommand
andrenewcommand
anyway), but the docs mentionnewcommand
andrenewcommand
only.More importantly,
[1]
is mangled into{[}1{]}
, breaking latex.The text was updated successfully, but these errors were encountered: