I guess you could think of it this way: My goal was to combine functionality from the 3 different filters in the way I described, since no filter exists which can do all of those things in one go. My first attempt at achieving that goal was very crude, since I sequentially applied the three filters and expected them to be compatible with each other. I ran into the compilation error at that point, which is why I started this thread. Upon further discussion/thought, I started to realize that even if I do fix the compilation error (which is a LaTeX problem), that doesn't guarantee that the functionality will be combined in the way I expect (which is a pandoc/Lua/AST problem). On Tue, 7 Mar 2023 at 20:19, wrote: > Recalling your original post: > > > I get an error upon compilation, because pandoc-crossref defines its own > > header include which gets overwritten by my -H header.tex. > > Do you mean now that you resolved this problem and ran into another one? > They are distinct issues, even if they affect you simultaneously, aren't > they? > > Le Tuesday 07 March 2023 à 07:28:26PM, A A a écrit : > > I’m already familiar with pandoc templates, but I don’t think they are > the > > solution here. You might recall I’m using 3 distinct filters, namely > > pandoc-crossref.lua, minted.lua, include-code-files.lua. I’m using each > because > > of some functionality it provides: > > > > • pandoc-crossref.lua: The ability to cross-reference listings and > caption > > them > > • minted.lua: The ability to break long code lines within a listing. > > • include-code-files.lua: The ability to include external files in a > listing. > > > > I expected that using these filters in unison would result in an > intersection > > of the mentioned functionality. However, this is incorrect. The > underlying > > issue here is that they all act on the same AST element (i.e. CodeBlock) > and > > calling them sequentially like that will inevitably result in conflicts. > > > > As you can see it doesn’t really matter what I do with the template or > the > > header, because neither of those two things act on the AST. > > > > > > On Tue, 7 Mar 2023 at 16:51, Bastien DUMONT <[1] > bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> > > wrote: > > > > You can get the default template for LaTeX with pandoc -D latex, > customize > > it according to your needs and specify the resulting file with > --template > > in the command. There is nothing specific here for pandoc-crossrefs. > See > > the section about templates in the manual of Pandoc for more details. > > > > Le Tuesday 07 March 2023 à 02:06:17PM, A A a écrit : > > > 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 <[1][2] > > bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> > > > 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][2] > > > [3]bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> 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][3][4]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][4][5] > pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > To view this discussion on the web visit > [3][4][5]https:// > > > [6]groups.google.com/ > > > > d/msgid/ > > > > > pandoc-discuss/ > > > > > > CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%[5][6] > > > [7]40mail.gmail.com > > > > . > > > > > > > > > > References: > > > > > > > > > > [1] [6][7][8] > https://github.com/lierdakil/pandoc-crossref/ > > issues/47 > > > > > [2] mailto:[7][8][9] > > pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > > [3] [8][9][10]https://groups.google.com/d/msgid/ > > pandoc-discuss/ > > > > > CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%[10] > > > [11]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][11][12] > pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > . > > > > To view this discussion on the web visit [10][12]https:// > > > [13]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][13][14]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit [12][14]https:// > > > [15]groups.google.com/d/msgid/ > > > > pandoc-discuss/ > > > > CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%[15] > > > [16]40mail.gmail.com. > > > > > > > > References: > > > > > > > > [1] mailto:[16][17]bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > > > [2] [17][18] > https://github.com/lierdakil/pandoc-crossref/issues/47# > > > issuecomment-614404532 > > > > [3] mailto:[18][19] > pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [4] [19][20]https://groups.google.com/d/msgid/ > > > > [5] [20][21]http://40mail.gmail.com/ > > > > [6] [21][22] > https://github.com/lierdakil/pandoc-crossref/issues/47 > > > > [7] mailto:[22][23] > pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [8] [23][24] > https://groups.google.com/d/msgid/pandoc-discuss/ > > > CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%[25] > > 40mail.gmail.com? > > > utm_medium=email&utm_source=footer > > > > [9] mailto:[24][26] > pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [10] [25][27] > https://groups.google.com/d/msgid/pandoc-discuss/ > > ZAcA4dThsf/ > > > pAK2e%40localhost > > > > [11] mailto:[26][28] > pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > > [12] [27][29] > https://groups.google.com/d/msgid/pandoc-discuss/ > > > CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%[30] > > 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 [28][31]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [29][32]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 [30][33]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit [31][34]https:// > > groups.google.com/d/msgid/ > > > pandoc-discuss/ > > > CAMwawgMDb2ZF9i8T5sxeFqrnf3RRh%2BthSJXyxPsufFqPC4czBQ%[35] > > 40mail.gmail.com. > > > > > > References: > > > > > > [1] mailto:[36]bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > > [2] mailto:[37]bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > > [3] [38]https://github.com/lierdakil/ > > > [4] mailto:[39]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [5] [40]https://groups.google.com/ > > > [6] [41]http://40mail.gmail.com/ > > > [7] [42]https://github.com/lierdakil/pandoc-crossref/issues/47 > > > [8] mailto:[43]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [9] [44]https://groups.google.com/d/msgid/pandoc-discuss/ > > > [10] [45]http://40mail.gmail.com/ > > > [11] mailto:[46]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [12] [47]https://groups.google.com/d/ > > > [13] mailto:[48]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [14] [49]https://groups.google.com/d/msgid/ > > > [15] [50]http://40mail.gmail.com/ > > > [16] mailto:[51]bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > > [17] [52]https://github.com/lierdakil/pandoc-crossref/issues/47# > > issuecomment-614404532 > > > [18] mailto:[53]pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [19] [54]https://groups.google.com/d/msgid/ > > > [20] [55]http://40mail.gmail.com/ > > > [21] [56]https://github.com/lierdakil/pandoc-crossref/issues/47 > > > [22] mailto:[57]pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [23] [58]https://groups.google.com/d/msgid/pandoc-discuss/ > > CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg% > 40mail.gmail.com? > > utm_medium=email&utm_source=footer > > > [24] mailto:[59]pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [25] [60] > https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/ > > pAK2e%40localhost > > > [26] mailto:[61]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [27] [62]https://groups.google.com/d/msgid/pandoc-discuss/ > > CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA% > 40mail.gmail.com? > > utm_medium=email&utm_source=footer > > > [28] mailto:[63]pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [29] [64] > https://groups.google.com/d/msgid/pandoc-discuss/ZAcdDn%2Bj/ > > f55E9xQ%40localhost > > > [30] mailto:[65]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [31] [66]https://groups.google.com/d/msgid/pandoc-discuss/ > > CAMwawgMDb2ZF9i8T5sxeFqrnf3RRh%2BthSJXyxPsufFqPC4czBQ% > 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 [67]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [68] > https://groups.google.com/d/ > > msgid/pandoc-discuss/ZAddfXTclu2naUlX%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 [69]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [70] > https://groups.google.com/d/msgid/ > > pandoc-discuss/ > > CAMwawgPQN7Jv34tv%2BkioNYJO-HJ4nhwMco%2B7BXQCLOEDHDD39A%40mail.gmail.com > . > > > > References: > > > > [1] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [2] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [3] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [4] https://github.com/ > > [5] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [6] http://groups.google.com/ > > [7] http://40mail.gmail.com/ > > [8] https://github.com/lierdakil/pandoc-crossref/issues/47 > > [9] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [10] https://groups.google.com/d/msgid/pandoc-discuss/ > > [11] http://40mail.gmail.com/ > > [12] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [13] http://groups.google.com/d/ > > [14] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [15] http://groups.google.com/d/msgid/ > > [16] http://40mail.gmail.com/ > > [17] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [18] https://github.com/lierdakil/pandoc-crossref/issues/47# > > [19] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [20] https://groups.google.com/d/msgid/ > > [21] http://40mail.gmail.com/ > > [22] https://github.com/lierdakil/pandoc-crossref/issues/47 > > [23] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [24] https://groups.google.com/d/msgid/pandoc-discuss/ > > [25] http://40mail.gmail.com/ > > [26] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [27] https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/ > > [28] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [29] https://groups.google.com/d/msgid/pandoc-discuss/ > > [30] http://40mail.gmail.com/ > > [31] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [32] https://groups.google.com/d/ > > [33] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [34] https://groups.google.com/d/msgid/ > > [35] http://40mail.gmail.com/ > > [36] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [37] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [38] https://github.com/lierdakil/ > > [39] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [40] https://groups.google.com/ > > [41] http://40mail.gmail.com/ > > [42] https://github.com/lierdakil/pandoc-crossref/issues/47 > > [43] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [44] https://groups.google.com/d/msgid/pandoc-discuss/ > > [45] http://40mail.gmail.com/ > > [46] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [47] https://groups.google.com/d/ > > [48] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [49] https://groups.google.com/d/msgid/ > > [50] http://40mail.gmail.com/ > > [51] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org > > [52] > https://github.com/lierdakil/pandoc-crossref/issues/47#issuecomment-614404532 > > [53] mailto:pandoc-discuss%25252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [54] https://groups.google.com/d/msgid/ > > [55] http://40mail.gmail.com/ > > [56] https://github.com/lierdakil/pandoc-crossref/issues/47 > > [57] mailto:pandoc-discuss%25252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [58] > https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPTeNSdJ7FDbc9tmw8ax06K7n_uGxvB-mCn2fvBzdD%3DUg%40mail.gmail.com?utm_medium=email&utm_source=footer > > [59] mailto:pandoc-discuss%25252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [60] > https://groups.google.com/d/msgid/pandoc-discuss/ZAcA4dThsf/pAK2e%40localhost > > [61] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [62] > https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgNJcw9d-aMSPFStx%2BwU__GrsDVhhNrARCLf4CdHNiGCWA%40mail.gmail.com?utm_medium=email&utm_source=footer > > [63] mailto:pandoc-discuss%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [64] > https://groups.google.com/d/msgid/pandoc-discuss/ZAcdDn%2Bj/f55E9xQ%40localhost > > [65] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [66] > https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgMDb2ZF9i8T5sxeFqrnf3RRh%2BthSJXyxPsufFqPC4czBQ%40mail.gmail.com?utm_medium=email&utm_source=footer > > [67] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [68] > https://groups.google.com/d/msgid/pandoc-discuss/ZAddfXTclu2naUlX%40localhost > > [69] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [70] > https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgPQN7Jv34tv%2BkioNYJO-HJ4nhwMco%2B7BXQCLOEDHDD39A%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/ZAeOG4qBz9PPfadv%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/CAMwawgPtfX8%2Bqy4q2nx7%2BDL-kWhX82QnWh6BQ8CHPyHGZ3uuzw%40mail.gmail.com.