Since you don't use a custom template, you don't have to add $for(header-includes)$ etc. anywhere: it is already included in the default LaTeX template.
The answer for your use case is here: https://github.com/lierdakil/pandoc-crossref/issues/47#issuecomment-614404532
Le Tuesday 07 March 2023 à 10:02:38AM, A A a écrit :
> Files
>
> test.py
>
> def f(x):
> return x
>
> test.md
>
> ~~~{
> #lst:test
> .py
> include="test.py"
> caption=`test.py`
> }
> ~~~
>
> header.tex
>
> \usepackage{minted}
>
> \definecolor{bg}{rgb}{0.85, 0.85. 0.85}
> \setminted{breaklines=true, bgcolor=bg, breakanywhere}
>
> Compilation
>
> I’m compiling with:
>
> pandoc -s -F pandoc-crossref -L include-code-files.lua -L minted.lua -H header.tex --from markdown --to latex test.md -o test.tex
> latexmk --shell-escape -pdflatex test.tex
>
> I get an error upon compilation, because pandoc-crossref defines its own header
> include which gets overwritten by my -H header.tex. This [1]link provides more
> information.
>
> I tried the solution proposed by @lierdakil in the link provided but get an
> error:
>
> ! LaTeX Error: Missing \begin{document}.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H for immediate help.
>
> l.97 $
> for(header-includes)$
> ?
>
> So I’m at a bit of a loss regarding what to do here, Any pointers welcome.
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to [2]pandoc-discuss+unsubscribe@googlegroups.com.
> To view this discussion on the web visit [3]https://groups.google.com/d/msgid/
> pandoc-discuss/
> CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%40mail.gmail.com.
>
> References:
>
> [1] https://github.com/lierdakil/pandoc-crossref/issues/47
> [2] mailto:pandoc-discuss+unsubscribe@googlegroups.com
> [3] https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%40mail.gmail.com?utm_medium=email&utm_source=footer
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/pAK2e%40localhost.