diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/minted/README | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/minted/minted.pdf | bin | 149540 -> 311748 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/minted/Makefile | 34 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/minted/minted.dtx | 302 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/minted/minted.ins | 5 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/minted/minted.sty | 55 |
6 files changed, 327 insertions, 74 deletions
diff --git a/Master/texmf-dist/doc/latex/minted/README b/Master/texmf-dist/doc/latex/minted/README index 9c7725dde8d..f5c4ef1fd6a 100644 --- a/Master/texmf-dist/doc/latex/minted/README +++ b/Master/texmf-dist/doc/latex/minted/README @@ -10,3 +10,8 @@ and usage. 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. +Additionally, the project may be distributed under the terms of the new BSD +license. + +For suggestions and bug reports, please go to the project's hosting site at +http://minted.googlecode.com. diff --git a/Master/texmf-dist/doc/latex/minted/minted.pdf b/Master/texmf-dist/doc/latex/minted/minted.pdf Binary files differindex 307256b4aa5..6314fb423bb 100644 --- a/Master/texmf-dist/doc/latex/minted/minted.pdf +++ b/Master/texmf-dist/doc/latex/minted/minted.pdf diff --git a/Master/texmf-dist/source/latex/minted/Makefile b/Master/texmf-dist/source/latex/minted/Makefile index 0b7ea239425..ab1940f5efc 100644 --- a/Master/texmf-dist/source/latex/minted/Makefile +++ b/Master/texmf-dist/source/latex/minted/Makefile @@ -1,12 +1,36 @@ -.PHONY: all doc sty +TEXFLAGS = -e '$$pdflatex=q/pdflatex %O -shell-escape %S/' -pdf +LATEXMK = latexmk -all: sty doc +PACKAGE = minted.dtx \ + minted.ins \ + minted.pdf \ + README \ + Makefile -sty: +.PHONY: all doc dist clean cleanall + +all: minted.sty minted.pdf + +doc: minted.pdf + +minted.sty: minted.ins minted.dtx echo y | tex minted.ins -doc: +minted.pdf: minted.sty minted.gls minted.dtx pdflatex -shell-escape minted.dtx +minted.gls: minted.glo + makeindex -s gglo.ist -o minted.gls minted.glo + +minted.glo: minted.dtx + $(LATEXMK) $(TEXFLAGS) minted.dtx + +dist: $(PACKAGE) + @$(RM) minted.zip + @zip minted.zip $(PACKAGE) + clean: - @$(RM) *.aux *.log *.out *.toc + @$(RM) *.aux *.log *.out *.toc *.fdb_latexmk *.ilg *.glo *.gls *.lol + +cleanall: clean + @$(RM) minted.sty minted.zip diff --git a/Master/texmf-dist/source/latex/minted/minted.dtx b/Master/texmf-dist/source/latex/minted/minted.dtx index 56ef060cac3..534c54e91e0 100644 --- a/Master/texmf-dist/source/latex/minted/minted.dtx +++ b/Master/texmf-dist/source/latex/minted/minted.dtx @@ -1,4 +1,4 @@ -% \iffalse +% \iffalse meta-comment % minted.dtx % Copyright 2010 Konrad Rudolph % @@ -10,6 +10,9 @@ % 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 new BSD +% license. +% % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Konrad Rudolph. @@ -21,26 +24,33 @@ % % Special thanks to Philipp Stephani and the rest of the guys from % comp.text.tex. +% \fi +% \iffalse %<*driver> \ProvidesFile{minted.dtx} %</driver> %<*package> \NeedsTeXFormat{LaTeX2e} % -\ProvidesPackage{minted}[2010/01/08 0.0.4 Yet another Pygments shim for LaTeX] +\ProvidesPackage{minted}[2010/01/13 v0.1.5 Yet another Pygments shim for LaTeX] % \RequirePackage{keyval} \RequirePackage{fancyvrb} \RequirePackage{color} +\RequirePackage{float} +\RequirePackage{ifthen} +\RequirePackage{calc} %</package> %<*driver> \documentclass[a4paper]{ltxdoc} \DisableCrossrefs +\RecordChanges %\OnlyDescription \usepackage{lstdoc} \usepackage{minted} \usepackage{courier} ^^A Useful monospace font (= has \bfseries). +\usepackage{textcomp} \usepackage{hyperref} \hypersetup{ @@ -54,14 +64,15 @@ {\VerbatimEnvironment \begin{VerbatimOut}[gobble=3]{example.out}} {\end{VerbatimOut} - \noindent\rule{\textwidth}{0.5pt} - \begin{minipage}{0.5\linewidth} - \small\inputminted{latex}{example.out} + \vspace{1ex} + \setlength{\parindent}{0pt} + \fbox{\begin{minipage}{0.5\linewidth} + \small\inputminted[resetmargins]{latex}{example.out} \end{minipage}\qquad \begin{minipage}{0.4\linewidth} \small\input{example.out} - \end{minipage}\\ - \noindent\rule{\textwidth}{0.5pt}} + \end{minipage}} + \vspace{1ex}} \newenvironment{optionlist} {\begin{list}{}{\renewcommand\makelabel[1]{\textsf{##1}}} @@ -77,18 +88,39 @@ %</driver> % \fi % -% \title{The \textsf{minted} package:\\Highlighted source code in \LaTeX} -% \author{Konrad Rudolph\\\texttt{konrad\char`_rudolph@madrat.net}} +% \changes{0.0.4}{2010/01/08}{Initial version} +% +% \GetFileInfo{minted.sty} +% +% \newcommand\pkg[1]{\textsf{#1}} +% \newcommand\app[1]{\textsf{#1}} +% +% \title{The \pkg{minted} package:\\Highlighted source code in \LaTeX +% \thanks{This document corresponds to \pkg{minted}~\fileversion, last changed~\filedate.}} +% \author{Konrad Rudolph\\\texttt{konrad\char`\_rudolph@madrat.net}} +% \date{\filedate} % % \maketitle % -% \tableofcontents +% \begin{abstract} +% \pkg{minted} is a package that facilitates expressive syntax highlighting +% using the powerful \app{Pygments} library. The package also provides options to +% customize the highlighted source code output. +% \end{abstract} +% +% \begin{multicols}{2} +% \tableofcontents +% \end{multicols} % -% \fvset{codes={\catcode`\%=9}} ^^A Ignore initial |%| +% \fvset{ +% codes={\catcode`\%=9}, ^^A Ignore initial |%| +% numbersep=5pt +% } +% \setlength{\fboxsep}{1ex} % % \section{Introduction} % -% \textsf{minted} is a package that allows formatting source code in \LaTeX. +% \pkg{minted} is a package that allows formatting source code in \LaTeX. % For example: % \begin{VerbatimOut}[gobble=1]{minted.doc.out} % \begin{minted}{language} @@ -100,13 +132,13 @@ % \noindent will highlight a piece of code in a chosen language. % The display can be customized by a number of arguments and colour schemes. % -% Unlike some other packages, most notably \textsf{listings}, \textsf{minted} requires -% the installation of an additional software, \textsf{Pygments}. +% Unlike some other packages, most notably \pkg{listings}, \pkg{minted} requires +% the installation of an additional software, \app{Pygments}. % This may seem like a disadvantage but there are advantages, as well: % -% \textsf{Pygments} provides far superior syntax highlighting compared to conventional packages. -% For example, \textsf{listings} basically only highlights strings, comments and keywords. -% \textsf{Pygments}, on the other hand, can be completely customized to highlight any token kind the +% \app{Pygments} provides far superior syntax highlighting compared to conventional packages. +% For example, \pkg{listings} basically only highlights strings, comments and keywords. +% \app{Pygments}, on the other hand, can be completely customized to highlight any token kind the % source language might support. % This might include special formatting sequences inside strings, numbers, different kinds of % identifiers and exotic constructs such as HTML tags. @@ -123,14 +155,14 @@ % end % \end{minted} % -% Here we have three different colours for identifiers (four, if you count keywords) and escapes from -% inside strings, none of which pose a problem to \textsf{Pygments}. +% Here we have four different colors for identifiers (five, if you count keywords) and escapes from +% inside strings, none of which pose a problem to \app{Pygments}. % -% Additionally, installing \textsf{Pygments} is actually incredibly easy (see the next section). +% Additionally, installing \app{Pygments} is actually incredibly easy (see the next section). % % \section{Installation} % -% \textsf{Pygments} is written in Python so make sure that at least Python 2.6 is installed on you system: +% \app{Pygments} is written in Python so make sure that at least Python 2.6 is installed on you system: % % \begin{Verbatim}[gobble=3,commandchars=\\\{\}] % \$ python --version @@ -140,20 +172,20 @@ % If that's not the case, you can download it from \href{http://www.python.org/download/}{the website} or % use your operating system's package manager. % -% You can then install \textsf{Pygments} using the following simple command: +% You can then install \app{Pygments} using the following simple command: % % \begin{Verbatim}[gobble=3,commandchars=\\\{\}] % \$ sudo easy_install Pygments % \end{Verbatim} % -% (If you've already got \textsf{Pygments} installed, be advised that \textsf{minted} requires at least version +% (If you've already got \app{Pygments} installed, be advised that \pkg{minted} requires at least version % 1.2.) % % \section{Basic usage} % % \subsection{Preliminary} % -% Since \textsf{minted} makes calls to the outside world (i.e. \textsf{Pygments}), you need to tell the +% Since \pkg{minted} makes calls to the outside world (i.e. \app{Pygments}), you need to tell the % \LaTeX{} processor about this by passing it the |-shell-escape| option or it won't allow such calls. % In effect, instead of calling the processor like this: % \begin{Verbatim}[gobble=3,commandchars=\\\{\}] @@ -171,7 +203,7 @@ % \subsection{Formatting source code} % % \DescribeEnv{minted} -% Using \textsf{minted} is straightforward. For example, to highlight a Python source code, we might use +% Using \pkg{minted} is straightforward. For example, to highlight a Python source code, we might use % the following code snippet (result on the right): % % \begin{example} @@ -201,7 +233,7 @@ % % \subsection{Using different styles} % -% Instead of using the default style you may choose an another stylesheet provided by \textsf{Pygments} +% Instead of using the default style you may choose an another stylesheet provided by \app{Pygments} % by its name. % For example, this document uses the ``\texttt{\thestyle}'' style. % \DescribeMacro{\usemintedstyle} @@ -222,7 +254,7 @@ % % \subsection{Supported languages} % -% \textsf{Pygments} at the moment supports over 150 different programming languages, template languages +% \app{Pygments} at the moment supports over 150 different programming languages, template languages % and other markup languages. % To see an exhaustive list of the currently supported languages, use the command % @@ -230,11 +262,57 @@ % \$ pygmentize -L lexers % \end{Verbatim} % +% \section{Floated listings} +% +% \DescribeEnv{listing} +% \pkg{minted} provides the |listing| environment to wrap around a source code block. +% That way, the source code will be put into a floating box. +% You can also provide a |\caption| and a |\label| for such a listing in the usual way (that is, +% as for the |table| and |figure| environments): +% +% \begin{VerbatimOut}[gobble=1]{minted.doc.out} +% \begin{listing} +% \mint{cl}/(car (cons 1 2))/ +% \caption{Example of a listing.} +% \label{lst:example} +% \end{listing} +% +% Listing \ref{lst:example} contains an example of a listing. +% \end{VerbatimOut} +% \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out} +% +% will yield: +% +% \noindent +% \rule{\textwidth}{0.4pt} +% \input{minted.doc.out} +% \par\noindent +% \rule{\textwidth}{0.4pt}\\ +% +% \DescribeMacro{\listoflistings} +% The |\listoflistings| macro will insert a list of all (floated) listings into the document: +% +% \begin{example} +% \listoflistings +% \end{example} +% +% \DescribeMacro{\listingscaption} +% The string ``Listing'' in a listing's caption can be changed. +% To do this, simply redefine the macro |\listingscaption|, e.g.: +% +% \mint{latex}/\renewcommand\listingscaption{Program code}/ +% +% \DescribeMacro{\listoflistingscaption} +% Likewise, the caption of the listings list, ``List of listings'' can be changed by redefining +% |\listoflistingscaption| like so: +% +% \mint{latex}/\renewcommand\listoflistingscaption{List of program codes}/ +% % \section{Options} % % \subsection{Usage} % -% All \textsf{minted} highlight commands accept the same set of options. +% All \pkg{minted} highlight commands accept the same set of options. % Options are specified as a comma-separated list of |key=value| pairs. % For example, we can specify that the lines should be numbered: % @@ -249,10 +327,16 @@ % \end{minted} % \end{example} % -% An option value of |true| may also be omitted entirely (including the |=|). +% An option value of |true| may also be omitted entirely (including the ``|=|''). % To customize the display of the line numbers further, override the |\theFancyVerbLine| command. -% Consult the \textsf{fancyvrb} documentation for details. - +% Consult the \pkg{fancyvrb} documentation for details. +% +% |\mint| accepts the same options: +% +% \begin{example} +% \mint[linenos]{perl}|$x=~/foo/| +% \end{example} +% % Here's another example: we want to use the \LaTeX{} math mode inside comments: % % \begin{example} @@ -269,7 +353,8 @@ % The option |gobble| removes these unnecessary whitespace characters from the output: % % \begin{example} -% \begin{minted}[gobble=2,showspaces]{python} +% \begin{minted}[gobble=2, +% showspaces]{python} % def boring(args = None): % pass % \end{minted} @@ -285,17 +370,30 @@ % \subsection{Available options} % % Following is a full list of available options. -% For more detailed option descriptions please refer to the \textsf{fancyvrb} documentation, +% For more detailed option descriptions please refer to the \pkg{fancyvrb} documentation, % except where noted otherwise. % \begin{optionlist} % \item[baselinestretch (+auto+\textbar dimension)]: % Value to use as for baselinestretch inside the listing (default: +auto+). +% \item[bgcolor (string)]: +% Background color of the listing (default: \emph{none}). +% Notice that the value of this option must \emph{not} be a color command. Instead, it must be a color +% \emph{name}, given as a string, of a previously-defined color: +% +% \begin{example} +% \definecolor{bg}{rgb}{0.9,0.9,0.9} +% \begin{minted}[bgcolor=bg]{php} +% <?php +% echo "Hello, $x"; +% ?> +% \end{minted} +% \end{example} +% % \item[firstline (integer)]: % First line to be shown (default: +1+). % All lines before that line are ignored and do not appear in the output. % \item[firstnumber (+auto+\textbar integer)]: % Line number of the first line (default: +auto+ = 1). -%^^A TODO Why does LaTeX insert *horizontal* bars here instead of vertical bars?! % \item[frame (+none+\textbar +leftline+\textbar +topline+\textbar +bottomline+\textbar +lines+\textbar +single+)]: % The type of frame to put around the source code listing (default: +none+). % \item[framerule (dimension)]: @@ -304,15 +402,14 @@ % Distance between frame and content (default: +\fboxsep+). % \item[gobble (integer)]: % Remove the first $n$ characters from each input line (default: +0+). -% \item[label (+{[string]string}+)]: -% Assigns the strings as labels to the listing (default: \emph{none}). % \item[lastline (integer)]: % Last line to be shown (default: \emph{last line of input}). % \item[linenos (boolean)]: % Enables line numbers (default +false+). % \item[mathescape (boolean)]: % Enable \LaTeX{} math mode inside comments (default: +false+). -% Usage as in package \textsf{listings}. +% Do \emph{not} use spaces inside math mode -- they will be rendered like other full-width verbatim spaces. +% Usage as in package \pkg{listings}. % \item[numberblanklines (boolean)]: % Enables or disables numbering of blank lines (default: +true+). % \item[numbersep (dimension)]: @@ -329,7 +426,7 @@ % Interval at which line numbers appear (default: +1+). % \item[texcl (boolean)]: % Enables \LaTeX{} code inside comments (default: +false+). -% Usage as in package \textsf{listings}. +% Usage as in package \pkg{listings}. % \item[xleftmargin (dimension)]: % Indentation to add before the listing (default: +0+). % \item[xrightmargin (dimension)]: @@ -339,12 +436,14 @@ % \section{To do list} % %\begin{itemize} -% \item Add check for pygmentize installation and version. +% \item Add check for \app{pygmentize} installation and version. % \item Allow multiple stylesheets in one file. -% \item Allow quotes in \textsf{fancyvrb} arguments. +% \item Allow quotes in \pkg{fancyvrb} arguments. %\end{itemize} % -% \StopEventually{} +% \StopEventually{ +% \addcontentsline{toc}{section}{Change History} +% \PrintChanges} % % \section{Implementation} % @@ -386,12 +485,15 @@ % % \begin{macro}{\minted@define@opt} % -% Define a generic option. +% Define a generic option with an optional default argument. +% If a |key| option is specified without |=value|, the default is assumed. % % \begin{macrocode} -\newcommand\minted@define@opt[2]{ - \minted@defopt{#1} - \define@key{minted@opt}{#1}{\@namedef{minted@opt@#1}{#2}}} +\newcommand\minted@define@opt[3][]{ + \minted@defopt{#2} + \ifthenelse{\equal{#1}{}}{ + \define@key{minted@opt}{#2}{\@namedef{minted@opt@#2}{#3}}} + {\define@key{minted@opt}{#2}[#1]{\@namedef{minted@opt@#2}{#3}}}} % \end{macrocode} % \end{macro} % @@ -411,7 +513,7 @@ % % \begin{macro}{\minted@define@extra} % -% Extra options are passed on to \textsf{fancyvrb}. +% Extra options are passed on to \pkg{fancyvrb}. % % \begin{macrocode} \minted@defopt{extra} @@ -423,6 +525,9 @@ % \end{macro} % % \begin{macro}{\minted@define@extra@switch} +% +% Extra switch options are also passed on to \pkg{fancyvrb}. +% % \begin{macrocode} \newcommand\minted@define@extra@switch[1]{ \define@booleankey{minted@opt}{#1}{ @@ -435,23 +540,29 @@ % % \noindent Actual option definitions. % +% \changes{0.1.5}{2010/01/10}{Fix \texttt{firstnumber} option} +% \changes{0.1.5}{2010/01/10}{\texttt{fillcolor} option added} +% \changes{0.1.5}{2010/01/10}{Removed \texttt{caption} option} +% % \begin{macrocode} \minted@define@switch{texcl}{-P texcomments} \minted@define@switch{mathescape}{-P mathescape} \minted@define@switch{linenos}{-P linenos} \minted@define@opt{gobble}{-F gobble:n=#1} +\minted@define@opt{bgcolor}{#1} \minted@define@extra{frame} \minted@define@extra{framesep} \minted@define@extra{framerule} \minted@define@extra{rulecolor} \minted@define@extra{numbersep} +\minted@define@extra{firstnumber} \minted@define@extra{stepnumber} \minted@define@extra{firstline} \minted@define@extra{lastline} \minted@define@extra{baselinestretch} -\minted@define@extra{label} \minted@define@extra{xleftmargin} \minted@define@extra{xrightmargin} +\minted@define@extra{fillcolor} \minted@define@extra@switch{numberblanklines} \minted@define@extra@switch{showspaces} \minted@define@extra@switch{resetmargins} @@ -460,6 +571,32 @@ % % \subsection{Internal helpers} % +% \begin{environment}{\minted@bgbox} +% +% Here, we define an environment that may be wrapped around a minted code to assign a background color. +% +% First, we need to define a new save box. +% +% \begin{macrocode} +\newsavebox{\minted@bgbox} +% \end{macrocode} +% +% Now we can define de environment that captures a code fragment inside a minipage and applies a background +% color. +% +% \begin{macrocode} +\newenvironment{minted@colorbg}[1]{ +%\setlength{\fboxsep}{-\fboxrule} + \def\minted@bgcol{#1} + \noindent + \begin{lrbox}{\minted@bgbox} + \begin{minipage}{\linewidth-2\fboxsep}} + {\end{minipage} + \end{lrbox}% + \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}} +% \end{macrocode} +% \end{environment} +% % \begin{macro}{\minted@savecode} % % Save a code to be pygmentized to a file. @@ -480,12 +617,16 @@ % % \begin{macrocode} \newcommand\minted@pygmentize[2][\jobname.pyg]{ - \def\minted@cmd{pygmentize -l #2 -f latex -F tokenmerge \minted@opt{gobble} - \minted@opt{texcl} \minted@opt{mathescape} \minted@opt{linenos} - -P "verboptions=\minted@opt{extra}" -o \jobname.out.pyg #1} - %\immediate\typeout{\minted@cmd} % For debugging. + \def\minted@cmd{pygmentize -l #2 -f latex -F tokenmerge + \minted@opt{gobble} \minted@opt{texcl} \minted@opt{mathescape} + \minted@opt{linenos} -P "verboptions=\minted@opt{extra}" + -o \jobname.out.pyg #1} \immediate\write18{\minted@cmd} + \ifthenelse{\equal{\minted@opt@bgcolor}{}}{} + {\begin{minted@colorbg}{\minted@opt@bgcolor}} \input{\jobname.out.pyg} + \ifthenelse{\equal{\minted@opt@bgcolor}{}}{} + {\end{minted@colorbg}} \immediate\write18{rm \jobname.out.pyg}} % \end{macrocode} % \end{macro} @@ -576,6 +717,55 @@ % \end{macrocode} % \end{macro} % +% \subsection{Float support} +% +% \changes{0.1.5}{2010/01/10}{Added float support} +% +% \begin{environment}{listing} +% +% Defines a new floating environment to use for floated listings. +% +% \begin{macrocode} +\newfloat{listing}{h}{lol} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\listingcaption} +% +% The name that is displayed before each individual listings caption and its number. +% The macro |\listingscaption| can be redefined by the user. +% +% \begin{macrocode} +\newcommand\listingscaption{Listing} +% \end{macrocode} +% +% The following definition should not be changed by the user. +% +% \begin{macrocode} +\floatname{listing}{\listingscaption} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\listoflistingscaption} +% +% The caption that is displayed for the list of listings. +% +% \begin{macrocode} +\newcommand\listoflistingscaption{List of listings} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\listoflistings} +% +% Used to produce a list of listings (like |\listoffigures| etc.). +% This may well clash with other packages (e.g. \pkg{listings}) but we choose to ignore this +% since these two packages shouldn't be used together in the first place. +% +% \begin{macrocode} +\providecommand\listoflistings{\listof{listing}{\listoflistingscaption}} +% \end{macrocode} +% \end{macro} +% % \subsection{Epilogue} % % Load default stylesheet -- but only if user has not yet loaded a custom @@ -590,8 +780,10 @@ % % \begin{macrocode} \AtEndOfPackage{ - \ifeof18\PackageError{minted}{You must invoke LaTeX with the -shell-escape - flag} - {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty documentation - for more information.}\fi} + \ifeof18\PackageError{minted}{You must invoke LaTeX with the + -shell-escape flag} + {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty + documentation for more information.}\fi} % \end{macrocode} +% +% \Finale diff --git a/Master/texmf-dist/source/latex/minted/minted.ins b/Master/texmf-dist/source/latex/minted/minted.ins index 859d3d10fc9..48eb59a717a 100644 --- a/Master/texmf-dist/source/latex/minted/minted.ins +++ b/Master/texmf-dist/source/latex/minted/minted.ins @@ -12,6 +12,9 @@ The latest version of this license is in 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 new BSD +license. + This work has the LPPL maintenance status `maintained'. The Current Maintainer of this work is Konrad Rudolph. @@ -20,6 +23,8 @@ This work consists of the files mints.dtx and mints.ins and the derived file mints.sty. \endpreamble +\usedir{tex/latex/minted} + \generate{\file{minted.sty}{\from{minted.dtx}{package}}} \endbatchfile diff --git a/Master/texmf-dist/tex/latex/minted/minted.sty b/Master/texmf-dist/tex/latex/minted/minted.sty index de3062e77da..7b53747c7d1 100644 --- a/Master/texmf-dist/tex/latex/minted/minted.sty +++ b/Master/texmf-dist/tex/latex/minted/minted.sty @@ -15,6 +15,9 @@ %% 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 new BSD +%% license. +%% %% This work has the LPPL maintenance status `maintained'. %% %% The Current Maintainer of this work is Konrad Rudolph. @@ -22,11 +25,13 @@ %% This work consists of the files mints.dtx and mints.ins %% and the derived file mints.sty. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{minted}[2010/01/08 0.0.4 Yet another Pygments shim for LaTeX] +\ProvidesPackage{minted}[2010/01/13 v0.1.5 Yet another Pygments shim for LaTeX] \RequirePackage{keyval} \RequirePackage{fancyvrb} \RequirePackage{color} - +\RequirePackage{float} +\RequirePackage{ifthen} +\RequirePackage{calc} \newcommand\minted@resetoptions{} \newcommand\minted@defopt[1]{ \expandafter\def\expandafter\minted@resetoptions\expandafter{% @@ -35,9 +40,11 @@ \newcommand\minted@opt[1]{ \expandafter\detokenize% \expandafter\expandafter\expandafter{\csname minted@opt@#1\endcsname}} -\newcommand\minted@define@opt[2]{ - \minted@defopt{#1} - \define@key{minted@opt}{#1}{\@namedef{minted@opt@#1}{#2}}} +\newcommand\minted@define@opt[3][]{ + \minted@defopt{#2} + \ifthenelse{\equal{#1}{}}{ + \define@key{minted@opt}{#2}{\@namedef{minted@opt@#2}{#3}}} + {\define@key{minted@opt}{#2}[#1]{\@namedef{minted@opt@#2}{#3}}}} \newcommand\minted@define@switch[2]{ \minted@defopt{#1} \define@booleankey{minted@opt}{#1}{ @@ -58,34 +65,49 @@ \minted@define@switch{mathescape}{-P mathescape} \minted@define@switch{linenos}{-P linenos} \minted@define@opt{gobble}{-F gobble:n=#1} +\minted@define@opt{bgcolor}{#1} \minted@define@extra{frame} \minted@define@extra{framesep} \minted@define@extra{framerule} \minted@define@extra{rulecolor} \minted@define@extra{numbersep} +\minted@define@extra{firstnumber} \minted@define@extra{stepnumber} \minted@define@extra{firstline} \minted@define@extra{lastline} \minted@define@extra{baselinestretch} -\minted@define@extra{label} \minted@define@extra{xleftmargin} \minted@define@extra{xrightmargin} +\minted@define@extra{fillcolor} \minted@define@extra@switch{numberblanklines} \minted@define@extra@switch{showspaces} \minted@define@extra@switch{resetmargins} \minted@define@extra@switch{samepage} +\newsavebox{\minted@bgbox} +\newenvironment{minted@colorbg}[1]{ + \def\minted@bgcol{#1} + \noindent + \begin{lrbox}{\minted@bgbox} + \begin{minipage}{\linewidth-2\fboxsep}} + {\end{minipage} + \end{lrbox}% + \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}} \newwrite\minted@code \newcommand\minted@savecode[1]{ \immediate\openout\minted@code\jobname.pyg \immediate\write\minted@code{#1} \immediate\closeout\minted@code} \newcommand\minted@pygmentize[2][\jobname.pyg]{ - \def\minted@cmd{pygmentize -l #2 -f latex -F tokenmerge \minted@opt{gobble} - \minted@opt{texcl} \minted@opt{mathescape} \minted@opt{linenos} - -P "verboptions=\minted@opt{extra}" -o \jobname.out.pyg #1} - %\immediate\typeout{\minted@cmd} % For debugging. + \def\minted@cmd{pygmentize -l #2 -f latex -F tokenmerge + \minted@opt{gobble} \minted@opt{texcl} \minted@opt{mathescape} + \minted@opt{linenos} -P "verboptions=\minted@opt{extra}" + -o \jobname.out.pyg #1} \immediate\write18{\minted@cmd} + \ifthenelse{\equal{\minted@opt@bgcolor}{}}{} + {\begin{minted@colorbg}{\minted@opt@bgcolor}} \input{\jobname.out.pyg} + \ifthenelse{\equal{\minted@opt@bgcolor}{}}{} + {\end{minted@colorbg}} \immediate\write18{rm \jobname.out.pyg}} \newcommand\minted@usedefaultstyle{\usemintedstyle{default}} \newcommand\usemintedstyle[1]{ @@ -115,13 +137,18 @@ \minted@resetoptions \setkeys{minted@opt}{#1} \minted@pygmentize[#3]{#2}} +\newfloat{listing}{h}{lol} +\newcommand\listingscaption{Listing} +\floatname{listing}{\listingscaption} +\newcommand\listoflistingscaption{List of listings} +\providecommand\listoflistings{\listof{listing}{\listoflistingscaption}} \AtBeginDocument{ \minted@usedefaultstyle} \AtEndOfPackage{ - \ifeof18\PackageError{minted}{You must invoke LaTeX with the -shell-escape - flag} - {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty documentation - for more information.}\fi} + \ifeof18\PackageError{minted}{You must invoke LaTeX with the + -shell-escape flag} + {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty + documentation for more information.}\fi} \endinput %% %% End of file `minted.sty'. |