Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use listing instead of codelisting #417

Open
kchousos opened this issue Dec 11, 2023 · 3 comments
Open

Use listing instead of codelisting #417

kchousos opened this issue Dec 11, 2023 · 3 comments

Comments

@kchousos
Copy link

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.

@lierdakil
Copy link
Owner

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)

@kchousos
Copy link
Author

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.

@lierdakil
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants