Closed MageJohn closed 3 years ago
This is because pandoc doesn't know that this environment redefines the normal behavior of _. But we might be able to make pandoc more forgiving in such cases.
Sorry for the late reply. I think it might be reasonable to not process anything inside a raw latex block. Either that, or have a whitelist of blocks where it's useful to still process markdown, like inside of a \caption{}.
I ran into the same problem and found out, combining solutions to similar problems that I found on the web, that you can have markdown parse the latex verbatim by enclosing it in the following lines:
---
header-includes:
- \usepackage{circuitikz}
---
```{=latex}
\begin{figure}
\centering
\begin{circuitikz} \draw
(0,0) to[battery] (3,0)
-- (3,2)
to[C, l_=$C$] (0,2)
-- (0,0)
;
\end{circuitikz}
\end{figure}
```
This works for me, so probably also for you
I ran into the same issue using the lyluatex package. See above reference for details. ```{=latex} solved the problem.
I'm using Pandoc 2.1.2. I guess that this commit (in version 2.2.2) will solve my problem.
This seems to have been fixed, pandoc now parses the whole figure block as raw TeX.
It seems that when an underscore (_) is found inside a block of raw latex in a markdown document, Pandoc escapes the block, which causes an error with pdflatex.
This code compiles fine:
This is the output test1.pdf
However, this gives an error:
The only difference is in the line that starts
to[C, l...
; in the first (which compiles) there's a^
and in the other there's a_
. The error is:The expected output (made by converting to latex and then editing that) is this: test2.pdf
My pandoc version is:
pandoc 2.1.1 Compiled with pandoc-types 1.17.3, texmath 0.10.1, skylighting 0.6
This is the latest in my repositories.
The command line used to compile the examples to pdf was:
pandoc -o test.pdf test.md