Also, I have just tried with --metadata-file as follows: header-includes: - | ~~~{=latex} \usepackage{minted} \definecolor{bg}{rgb}{0.85, 0.85. 0.85} \setminted{breaklines=true, bgcolor=bg, breakanywhere} ~~~ When I tried compiling with the following: pandoc -s -F pandoc-crossref -L include-code-files.lua -L minted.lua --from markdown --to latex test.md -o test.tex --metadata-file header.yaml latexmk --shell-escape -pdflatex test.tex I got an error: ! LaTeX Error: Command \listoflistings already defined. Or name \end… illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. … l.89 …gs{\listof{codelisting}{List of Listings}} So looks like there are problems even when specifying it in the way recommended by that link you shared. On Tue, 7 Mar 2023 at 14:06, A A wrote: > You can include it in an external metadata file referred to via the > —metadata-file option > > I believe that would still be a YAML file with weird syntax like this? > > header-includes: > - | > ~~~{=latex} > \let\oldsection\section > \renewcommand{\section}[1]{\clearpage\oldsection{#1}} > ~~~ > > If so then yes, I definitely prefer doing my own header.tex. But this > would have to include all the content necessary for pandoc-crossref to > work properly. Any ideas where I could find this content? I briefly skimmed > the pandoc-crossref repo but didn’t find anything obvious… > > On Tue, 7 Mar 2023 at 12:16, Bastien DUMONT > wrote: > >> You can include it in an external metadata file referred to via the >> --metadata-file option. However, if you customize the LaTeX preamble >> heavily, it may be preferable to use a custom template including the >> content of header.tex. >> >> Le Tuesday 07 March 2023 à 12:07:19PM, A A a écrit : >> > That would force me to put my header content within my markdown file >> and remove >> > "header.tex" completely. I would very much prefer to keep them as >> separate >> > files. >> > >> > The header.tex for my use case ia much more involved. Including it >> inside the >> > markdowm YAML block like that would be quite ugly IMO. >> > >> > >> > >> > >> > >> > On Tue, 7 Mar 2023, 10:16 Bastien DUMONT, <[1]bastien.dumont-VwIFZPTo/vqzQB+pC5nmwQ@public.gmane.orgt> >> wrote: >> > >> > 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: [2] >> 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][3]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > To view this discussion on the web visit [3][4] >> https://groups.google.com/ >> > d/msgid/ >> > > pandoc-discuss/ >> > > CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%[5] >> 40mail.gmail.com >> > . >> > > >> > > References: >> > > >> > > [1] [6]https://github.com/lierdakil/pandoc-crossref/issues/47 >> > > [2] mailto:[7]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > > [3] [8]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 [9]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit [10] >> https://groups.google.com/d/ >> > msgid/pandoc-discuss/ZAcA4dThsf/pAK2e%40localhost. >> > >> > -- >> > 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 [11]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit [12] >> https://groups.google.com/d/msgid/ >> > pandoc-discuss/ >> > CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%40mail.gmail.com. >> > >> > References: >> > >> > [1] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org >> > [2] >> https://github.com/lierdakil/pandoc-crossref/issues/47#issuecomment-614404532 >> > [3] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [4] https://groups.google.com/d/msgid/ >> > [5] http://40mail.gmail.com/ >> > [6] https://github.com/lierdakil/pandoc-crossref/issues/47 >> > [7] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [8] >> https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%40mail.gmail.com?utm_medium=email&utm_source=footer >> > [9] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [10] >> https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/pAK2e%40localhost >> > [11] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [12] >> https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/ZAcdDn%2Bj/f55E9xQ%40localhost >> . >> > -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPfYTjvYbWgxsjGhfrNAh1WhnY_S00BKk95b4XV-FYdRQ%40mail.gmail.com.