pandoc-crossref icon indicating copy to clipboard operation
pandoc-crossref copied to clipboard

Use `listing` instead of `codelisting`

Open kchousos opened this issue 1 year ago • 3 comments

Greetings.

First of all, I would like to thank you for your contribution and your handy filter. It has been a real life saver for when I need to write uni reports and the like.

My question is: Is it possible to output the listing environment for captioned code blocks, instead of the filter's custom codelisting? I am using this filter in conjunction to minted.lua. I've already set up my code blocks to look how I like them, but I would like for my captioned code blocks to have the same formatting. Would something like that be possible? Thanks in advance.

kchousos avatar Dec 11 '23 16:12 kchousos

Yes, it's possible, see the listings option in the manual: https://lierdakil.github.io/pandoc-crossref/#general-options. Please note that Pandoc doesn't use listing by default either, so you have to invoke pandoc -F pandoc-crossref -Mlistings --listings or something equivalent (see the pandoc manual for details)

lierdakil avatar Dec 28 '23 17:12 lierdakil

Your solution is meant for usage with the package listings. I want to use minted, which uses the environment listing, instead of lstlisting that the first one uses.

kchousos avatar Dec 28 '23 17:12 kchousos

Okay. The best I can suggest is to use --listings with a custom LaTeX template and just \newenvironment redefine lstlisting to mean listing. Not sure if it'll work well (or at all), but seems quite feasible. Another option is to use a small custom filter to rewrite all code blocks into the LaTeX code of your preference. Pandoc itself is quite limited in what LaTeX it will produce, so I don't really see many other options.

lierdakil avatar Dec 28 '23 18:12 lierdakil