You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to build a modular template for the pandoc/LaTex combination. For what I can see, variables entered in included LaTex files are not rendered. Instead just the name (latex math syntax, because of $...$) is rendered.
Is it possible to render subsequent variables included in subdocuments?
main.md
test: fooBar
main.tex
\documentclass[a4paper]{scrbook}
\begin{document}
A variable should be rendered here twice: $test$
\input{second}
\end{document}
second.tex
$test$
Expected output: A variable should be rendered here twice: fooBar fooBar
Output: A variable should be rendered here twice: fooBar test
I think you're misunderstanding how templates work. Pandoc doesn't actually parse the latex in a latex template. A template is just considered a block of text with some holes in it for variables. Pandoc doesn't pay a bit of attention to what this text is, so when you write \input{second} pandoc simply passes that through verbatim.
What you're looking for is a template partial. This feature has been added to pandoc's template language in version 2.8. This would allow you to do something like:
$second()$
instead of
\input{second}
and it will work the way you want. Upgrade to 2.8 and read the manual section on Templates.
Hi, I'm trying to build a modular template for the pandoc/LaTex combination. For what I can see, variables entered in included LaTex files are not rendered. Instead just the name (latex math syntax, because of$...$ ) is rendered.
Is it possible to render subsequent variables included in subdocuments?
Expected output:
A variable should be rendered here twice: fooBar fooBar
Output:
A variable should be rendered here twice: fooBar test
Pandoc 2.7.3
Command:
pandoc --pdf-engine=xelatex --from "markdown+yaml_metadata_block+raw_html" --template=main.tex main.md -o ./main.pdf --resource-path=.:includes:lib:content --verbose
The text was updated successfully, but these errors were encountered: