% \iffalse meta-comment % % Copyright (C) 2013-2023 by Geoffrey M. Poore % Copyright (C) 2010-2011 by Konrad Rudolph % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % Additionally, the project may be distributed under the terms of the 3-Clause % ("New") BSD license: http://opensource.org/licenses/BSD-3-Clause. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Geoffrey M. Poore. % % This work consists of the files minted.dtx and minted.ins % and the derived file minted.sty. % % % \fi % % \iffalse %<*driver> \ProvidesFile{minted.dtx} % %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{minted} %<*package> [2023/12/18 v2.9 Yet another Pygments shim for LaTeX] % %<*driver> \documentclass{ltxdoc} \EnableCrossrefs %\CodelineIndex %\DisableCrossrefs %\RecordChanges %\OnlyDescription \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{dingbat} \usepackage{microtype} \usepackage[svgnames]{xcolor} \usepackage{textcomp} \usepackage[cache, langlinenos]{minted} \usepackage{calc} \usepackage{environ} \usepackage{graphicx} \usepackage{multicol} \usepackage{hyperref} \newcommand{\env}[1]{\texttt{#1}} \makeatletter % The typesetting for macrocode doesn't use \@noligs, which upquote modifies. % So apply the upquote fix to \verbatim@nolig@list as well, which is in macrocode. \begingroup \catcode`'=\active \catcode``=\active \g@addto@macro\verbatim@nolig@list{% \let'\textquotesingle \let`\textasciigrave \ifx\encodingdefault\upquote@OTone \ifx\ttdefault\upquote@cmtt \def'{\char13 }% \def`{\char18 }% \fi\fi} \endgroup % Create a short verbatim pipe that handles quotation marks properly \begingroup \catcode`\|=\active \gdef\pipe@active@verbatim{% \begingroup \let\do\@makeother\dospecials \catcode`\|=\active \catcode`\`=\active \catcode`\'=\active \catcode`\<=\active \catcode`\>=\active \catcode`\-=\active \catcode`\,=\active \catcode`\ =\active \pipe@active@verbatim@i} \gdef\pipe@active@verbatim@i#1|{% \endgroup \begingroup \def\FV@SV@pipe@active@verbatim{% \FV@Gobble \expandafter\FV@ProcessLine\expandafter{#1}}% %\let\FV@BeginVBox\relax %\let\FV@EndVBox\relax %\def\FV@BProcessLine##1{\FancyVerbFormatLine{##1}}% \BUseVerbatim{pipe@active@verbatim}% \endgroup} \AtBeginDocument{\let|\pipe@active@verbatim} \endgroup \newcommand{\changestext}{} \NewEnviron{changelog}[2]{% \g@addto@macro\changestext{\item[#1] (#2) \begin{itemize}}% \expandafter\g@addto@macro\expandafter\changestext\expandafter{\BODY}% \g@addto@macro\changestext{\end{itemize}}% } \newcommand{\PrintChangelog}{% \section{Changelog}% \label{sec:changelog} \begin{description}% \changestext \end{description}% } \def\MacroFont{% \fontencoding\encodingdefault% \fontfamily\ttdefault% \fontseries\mddefault% \fontshape\updefault% \small} \definecolor{minted@mint}{HTML}{0B610B} \definecolor{minted@samplebg}{HTML}{F0F0E0} \colorlet{minted@linkcolor}{minted@mint} % \def\PrintDescribeMacro#1{\strut \MacroFont\textcolor{minted@linkcolor}{\string #1\ }} \let\PrintDescribeEnv\PrintDescribeMacro \let\PrintMacroName\PrintDescribeMacro \let\PrintEnvName\PrintDescribeEnv \def\theCodelineNo{\textcolor{minted@linkcolor}{\sffamily\footnotesize\oldstylenums{\arabic{CodelineNo}}}} % \hypersetup{ pdftitle=The minted package: Highlighted source code in LaTeX, pdfauthor=Geoffrey M. Poore, pdfsubject={Minted LaTeX package manual}, colorlinks=true, allcolors=minted@linkcolor, } % % Shamelessly stolen from http://blog.karssen.org/2009/11/15/a-latex-example-environment/ \newenvironment{example} {\VerbatimEnvironment \begin{VerbatimOut}[gobble=3]{example.out}} {\end{VerbatimOut}% \vspace{1ex}% \setlength{\parindent}{0pt}% \fbox{\begin{minipage}{0.5\linewidth}% \inputminted[resetmargins]{latex}{example.out}% \end{minipage}% \hspace{0.05\linewidth}% \begin{minipage}{0.45\linewidth-2\fboxsep}% \input{example.out}% \end{minipage}% \vspace{1ex}}} \newenvironment{longexample} {\VerbatimEnvironment \begin{VerbatimOut}[gobble=3]{example.out}} {\end{VerbatimOut}% \vspace{1ex}% \setlength{\parindent}{0pt}% \fbox{\begin{minipage}{\linewidth-2\fboxsep}% \inputminted[resetmargins]{latex}{example.out}% ~\hrulefill~ \input{example.out}% \end{minipage}% \vspace{1ex}}} \def\minted@printopt#1(#2) (#3){% \vspace{0.1in}% \leavevmode% \marginpar{\raggedleft\texttt{\textcolor{minted@linkcolor}{\small #1}}\ }% \kern-\parindent\textsf{(#2)}\hfill(default: \texttt{#3})\\} \newenvironment{optionlist}% {% ~\par\vspace{-14pt}% \def\pipechar{|} \let\|\pipechar \newcommand*\mintednext{}% \renewcommand*\item[1][]{% \mintednext% \renewcommand*\mintednext{\par}% \minted@printopt##1% \ignorespaces}} {% \par} \edef\hashchar{\string#} \makeatother \newcommand{\hide}[1]{} \setlength{\parindent}{0pt} \addtolength{\parskip}{0.5\baselineskip} \def\warn{\textcolor{red}{\large\textbf{\textsf{WARNING}}}} \begin{document} \DocInput{minted.dtx} % \PrintIndex \end{document} % % \fi % % \CheckSum{2572} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % % % % \begin{changelog}{v2.9}{2023/12/18} % \item This is expected to be the last release of \pkg{minted} v2.x. If so, it will then become the new package \Verb{minted2} for backward compatibility. % \item Added new option \Verb{ignorelexererrors}. When lexer errors are shown in highlighted output (default), they are typically displayed as red boxes that surround the relevant text. When lexer errors are ignored, the literal text that caused lexer errors is shown but there is no indication that it caused errors (\#374). % \item There is now a warning if \pkg{fvextra} version is less than 1.5. % \end{changelog} % % \begin{changelog}{v2.8}{2023/09/12} % \item Under non-Windows operating systems, detect executables with \Verb{command -v} rather than \Verb{which} to provide better cross-platform support (\#345). % \item Added new package option \Verb{inputlanglinenos}. This extends the existing \Verb{langlinenos} to cover \Verb{\inputminted} as well (\#361). % \item Improved and updated Pygments documentation (\#339). % \item Improved \Verb{\mintinline} documentation to address packages that redefine \Verb{\section} (\#368). % \item Added support for \texpkg{fvextra} options \texttt{breakafterinrun} and \texttt{breakbeforeinrun} (\#358). In \texpkg{fvextra} version 1.5, \texttt{breakaftergroup} and \texttt{breakbeforegroup} were renamed to \texttt{breakafterinrun} and \texttt{breakbeforeinrun} to avoid naming ambiguity with new options. The old options \texttt{breakaftergroup} and \texttt{breakbeforegroup} are no longer supported. % \item Added \texttt{DEPENDS.txt} (\#331). % \item Removed unnecessary dependency on \texpkg{calc} package (\#313). % \item Added documentation in FAQ about copy and paste limitations (\#302). % \item Added note on \texttt{text} lexer to documentation (\#274). % \end{changelog} % % % \begin{changelog}{v2.7}{2022/12/12} % \item Reimplemented \texttt{\string\mintinline} to use \texttt{fvextra}'s argument reading and processing macros, and to use \texttt{fvextra}'s \texttt{\string\Verb} internally. \texttt{\string\mintinline} now works with all line breaking options supported by \texttt{fvextra}'s \texttt{\string\Verb}, including \texttt{breakanywhere} (\#329, \#340). It now gives better results when used inside other commands, since it uses \texttt{fvextra}'s retokenization macros. It is now compatible with \texttt{hyperref} for PDF strings such as bookmarks. % \item Reimplemented \texttt{\string\newmintinline} based on new \texttt{\string\mintinline}. % \item Reimplemented \texttt{\string\mint} to use \texttt{fvextra}'s argument reading and processing macros. It now gives better results when used inside other commands, since it uses \texttt{fvextra}'s retokenization macros. Fixed a bug that caused a continued paragraph after \texttt{\string\mint} to be indented (\#218). % \item Reimplemented \texttt{\string\newmint} based on new \texttt{\string\mint}. Commands created with \texttt{\string\newmint} can now use curly braces as delimiters, just like \texttt{\string\mint} (\#254). % \item Settings passed to \Verb{pygmentize} as command-line options are now quoted. This prevents \Verb{escapeinside} characters from being interpreted as special shell characters (\#179, \#262). % \item Fixed bug with \texttt{autogobble} that produced incorrect dedent when using \texttt{lastline} with the lines beyond \texttt{lastline} having less indentation than the selected range (\#326). % \item Fixed unintended line breaks after hyphens under LuaTeX (\#263). % \item Added warning to documentation of \Verb{\inputminted} regarding filenames and shell command execution (\#338). % \end{changelog} % % % \begin{changelog}{v2.6}{2021/12/24} % \item \texttt{autogobble} automatically uses \texttt{python} or \texttt{python3} executables, depending on availability, instead of requiring \texttt{python}. A custom executable can be specified by redefining \texttt{\string\MintedPython} (\#277, \#287). % \item Fixed \texttt{autogobble} compatibility with \texttt{fancyvrb} 4.0+ (\#315, \#316). % \item Pygments style names may now contain arbitrary non-whitespace characters. Previously, style names containing digits and some punctuation characters were incompatible (\#210, \#294, \#299, \#317). Pygments macros are now only defined just before use locally within \texttt{minted} commands and environments, rather than globally. Pygments macros now always use a \texttt{\string\PYG} prefix regardless of style, rather than a prefix of the form \texttt{\string\PYG