gpoore / minted

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

[Feature request] New option "envname" for configuring verbatim env name #281

Open muzimuzhi opened 3 years ago

muzimuzhi commented 3 years ago

By default, pygments puts highlighted tex codes in Verbatim environment. This is configurable by CLI option -P envname=<name> (see related doc of pytments), and packages like tcolorbox seem to need this, see https://github.com/T-F-S/tcolorbox/issues/2#issuecomment-695112384.

The implementation could be as simple as

\minted@def@optcl{envname}{-P envname}{#1}
muzimuzhi commented 3 years ago

see also #215 and #133

muzimuzhi commented 2 years ago

Just find minted uses \RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}% to do the trick

https://github.com/gpoore/minted/blob/5d72859d714a6f2f6a42eec524476994d954b960/source/minted.dtx#L3152-L3157

(\minted@inline@iii if not in draft mode) https://github.com/gpoore/minted/blob/5d72859d714a6f2f6a42eec524476994d954b960/source/minted.dtx#L3209-L3216

gpoore commented 2 weeks ago

The latest minted v3 beta now has an envname option and some backward compatibility fixes so that tcolorbox will work. This requires the dev version of fvextra; a new fvextra release will be out within the next few days.

muzimuzhi commented 2 weeks ago

Thanks. I've informed the of tcolorbox of this change, see https://github.com/T-F-S/tcolorbox/issues/2#issuecomment-2309539142.