gpoore / minted

minted is a LaTeX package that provides syntax highlighting using the Pygments library. Highlighted source code can be customized using fancyvrb.
1.75k stars 127 forks source link

Make \listoflistings a subheading #213

Open rugk opened 6 years ago

rugk commented 6 years ago

I want the \listoflistings of Minted to appear as a subsection heading. (My \documentclass is scrartcl.)

Things like \printbibliography have a "heading" option, which you can use to define, which heading type it should use. \printacronyms (package acro) has the same. With \KOMAoption{listof}{totocnumbered,leveldown} I can also move \listoffigures from a section heading to a subsection heading, but as for \listoflistings nothing of this works.

So basically, I just want a subheading (subsection-like) instead of a heading (section). It would also be nice, if it could appear in the toc.


BTW, also asked on tex.stackexchange.com.

rugk commented 6 years ago

I found a solution on Stackexchange, but it's a bit hacky, so could you maybe add "native" support for that? tocloft could be used.

gpoore commented 6 years ago

At some point, I can look into adding better integration for the KOMA-Script classes. It looks like that will probably just amount to this from your link:

\addtotoclist[float]{lol}
\renewcommand*\listoflistings{\listoftoc[{\listoflistingscaption}]{lol}}

I'm not sure about adding support for the general case. tocloft is compatible with float, which minted currently uses by default. However, minted also supports newfloat, which isn't listed as compatible with tocloft. There are multiple families of packages for defining new lists of things like listings, and trying to support multiple approaches may add too much complexity and potential for package conflicts. Perhaps I need to look into a way for the user to disable a list of listings from automatically being defined, so that it can be created using whatever package is desired.