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

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

Closed
muzimuzhi opened this issue Sep 18, 2020 · 4 comments
Closed
Milestone

Comments

@muzimuzhi
Copy link
Contributor

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 T-F-S/tcolorbox#2 (comment).

The implementation could be as simple as

\minted@def@optcl{envname}{-P envname}{#1}
@muzimuzhi
Copy link
Contributor Author

see also #215 and #133

@muzimuzhi
Copy link
Contributor Author

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

minted/source/minted.dtx

Lines 3152 to 3157 in 5d72859

% \begin{macro}{\mintinline}
% Define an inline command. This requires some catcode acrobatics. The typical verbatim methods are not used. Rather, a different approach is taken that is generally more robust when used within other commands (for example, when used in footnotes).
%
% Pygments saves code wrapped in a |Verbatim| environment. Getting the inline command to work correctly require redefining |Verbatim| to be |BVerbatim| temporarily. This approach would break if |BVerbatim| were ever redefined elsewhere.
%
% Everything needs to be within a |\begingroup...\endgroup| to prevent settings from escaping.

(\minted@inline@iii if not in draft mode)

minted/source/minted.dtx

Lines 3209 to 3216 in 5d72859

{\newcommand{\minted@inline@iii}[1]{%
\endgroup
\minted@writecmdcode{#1}%
\RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}%
\setcounter{minted@FancyVerbLineTemp}{\value{FancyVerbLine}}%
\minted@pygmentize{\minted@lang}%
\setcounter{FancyVerbLine}{\value{minted@FancyVerbLineTemp}}%
\endgroup}}

@gpoore gpoore added this to the minted 3 milestone Sep 12, 2023
gpoore added a commit that referenced this issue Aug 25, 2024
…ing values for options with globalinline scope; defined \minted@def@optcl as no-op for backward compatibility with tcolorbox; added empty \minted@outputdir for backward compatibility with packages that depend on minted v2 internals
@gpoore
Copy link
Owner

gpoore commented Aug 25, 2024

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
Copy link
Contributor Author

Thanks. I've informed the of tcolorbox of this change, see T-F-S/tcolorbox#2 (comment).

@gpoore gpoore closed this as completed Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants