-
Hello Pandoc team! I am following the example of Building images with TikZ. Why does this command work (exactly as given in the example):
(and in so-doing, converts the tikz into an SVG file and correctly generates the HTML page) but if I place the LaTeX code into a separate file, say
then the output file is still created, but the image isn't converted at all? Some digging suggests that Pandoc isn't interpreting the \begin{tikzpicture} \end{tikzpicture} environment at all: as far as I can tell from looking at what I think is the document tree, this is being ignored rather than being parsed as a RawBlock, whereas when I give the tex file using <<EOF, pandoc does parse it as a RawBlock within the document tree. I am so confused. Please help! (I am running Pandoc 3.5 on a Mac) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Pandoc tries to guess the input format based of the filename extension, so it uses the The LaTeX reader skips TeX commands that it cannot handle, while the Markdown reader puts all LaTeX blocks in the |
Beta Was this translation helpful? Give feedback.
-
This is super helpful, thank you @tarleb ! The example above now works and I feel enlightened. 👍 This somewhat annoyingly runs into a problem with the larger project I'm working on, where Any idea how to get it to work? Obviously (If you think this is better asked as a separate question, I am happy to do that!) |
Beta Was this translation helpful? Give feedback.
-
OK that's great, thank you @tarleb ! |
Beta Was this translation helpful? Give feedback.
Pandoc tries to guess the input format based of the filename extension, so it uses the
latex
reader in your second case above. If there is no input filename, as in the first case, then pandoc defaults tomarkdown
.The LaTeX reader skips TeX commands that it cannot handle, while the Markdown reader puts all LaTeX blocks in the
RawBlock
elements that are then processed by the filter. You could try to set--from=markdown
or--from=latex+raw_tex
when using an input file with a.tex
extension. Enabling the+raw_tex
extension on the LaTeX reader ensures that unknown TeX blocks are kept around instead of just being skipped.