diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-18 22:29:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-18 22:29:01 +0000 |
commit | 4c7c93512d5ad99119fc38035815ba54a17605a5 (patch) | |
tree | a99c0960c4f6e75b07c8045709370a737c33da6b /Master/texmf-dist | |
parent | 649107c8ec87f4bc736e7089a0bf9aed9ba1e137 (diff) |
minuted 1.7 (17sep11)
git-svn-id: svn://tug.org/texlive/trunk@24002 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/minted/Makefile (renamed from Master/texmf-dist/source/latex/minted/Makefile) | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/minted/minted.pdf | bin | 357277 -> 353283 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/minted/minted.dtx | 414 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/minted/minted.ins | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/minted/minted.sty | 46 |
5 files changed, 336 insertions, 140 deletions
diff --git a/Master/texmf-dist/source/latex/minted/Makefile b/Master/texmf-dist/doc/latex/minted/Makefile index 8f051d4535d..bb8877d025a 100644 --- a/Master/texmf-dist/source/latex/minted/Makefile +++ b/Master/texmf-dist/doc/latex/minted/Makefile @@ -7,14 +7,16 @@ PACKAGE = minted.dtx \ README \ Makefile -.PHONY: all doc dist clean cleanall +.PHONY: minted all doc dist clean cleanall -all: minted.sty minted.pdf +minted: minted.sty doc: minted.pdf +all: minted doc + minted.sty: minted.ins minted.dtx - echo y | tex minted.ins + tex minted.ins minted.pdf: minted.sty minted.gls minted.dtx $(LATEXMK) $(TEXFLAGS) minted.dtx diff --git a/Master/texmf-dist/doc/latex/minted/minted.pdf b/Master/texmf-dist/doc/latex/minted/minted.pdf Binary files differindex 063f505e01b..892bd29b400 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/minted.dtx b/Master/texmf-dist/source/latex/minted/minted.dtx index fcde9e66f46..483d1684495 100644 --- a/Master/texmf-dist/source/latex/minted/minted.dtx +++ b/Master/texmf-dist/source/latex/minted/minted.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % minted.dtx -% Copyright 2010 Konrad Rudolph +% Copyright 2010-2011 Konrad Rudolph % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -23,7 +23,7 @@ % Nanos gigantum humeris insidentes. % % Special thanks to Philipp Stephani and the rest of the guys from -% comp.text.tex. +% comp.text.tex and tex.stackexchange.com % \fi % \iffalse %<*driver> @@ -32,11 +32,11 @@ %<*package> \NeedsTeXFormat{LaTeX2e} % -\ProvidesPackage{minted}[2010/01/27 v1.6 Yet another Pygments shim for LaTeX] +\ProvidesPackage{minted}[2011/09/17 v1.7 Yet another Pygments shim for LaTeX] % \RequirePackage{keyval} \RequirePackage{fancyvrb} -\RequirePackage{color} +\RequirePackage{xcolor} \RequirePackage{float} \RequirePackage{ifthen} \RequirePackage{calc} @@ -55,13 +55,36 @@ \usepackage{hyperref} \usepackage{microtype} +\def\MacroFont{% + \fontencoding\encodingdefault% + \fontfamily\ttdefault% + \fontseries\mddefault% + \fontshape\updefault% + \small} + +^^A FIXME This is incredibly hacky and overrides size commands around tt-text. +^^A But I don't get the font inside the main body to change otherwise. :-( +\let\mintedttold\ttfamily +\def\ttfamily{\mintedttold\fontsize{9}{9}\selectfont} + +\definecolor{minted@mint}{HTML}{4B6121} +\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=Konrad Rudolph, pdfsubject={Minted LaTeX package manual}, + allcolors=minted@linkcolor, } -% Shamelessly stolen from http://blog.karssen.org/2009/11/15/a-latex-example-environment/ +^^A Shamelessly stolen from http://blog.karssen.org/2009/11/15/a-latex-example-environment/ \newenvironment{example} {\VerbatimEnvironment \begin{VerbatimOut}[gobble=3]{example.out}} @@ -69,18 +92,33 @@ \vspace{1ex} \setlength{\parindent}{0pt} \fbox{\begin{minipage}{0.5\linewidth} - \small\inputminted[resetmargins]{latex}{example.out} + \inputminted[resetmargins]{latex}{example.out} \end{minipage} \hspace{0.05\linewidth} \begin{minipage}{0.4\linewidth} - \small\input{example.out} + \input{example.out} \end{minipage} \vspace{1ex}}} -\newenvironment{optionlist} - {\begin{list}{}{\renewcommand\makelabel[1]{\textsf{##1}:\quad}} - \DeleteShortVerb{\|}\MakeShortVerb{\+}} - {\end{list}\DeleteShortVerb{\+}\MakeShortVerb{\|}} +\makeatletter ^^A ?!? Needed, no idea why. +\def\minted@printopt#1(#2) (#3){% + \leavevmode% + \marginpar{\raggedleft\texttt{\textcolor{minted@linkcolor}{#1}}\ }% + \textsf{(#2)}\hfill(default: #3)\\} + +\newenvironment{optionlist}{% + \par% + \newcommand*\mintednext{}% + \renewcommand*\item[1][]{% + \mintednext% + \renewcommand*\mintednext{\par}% + \minted@printopt##1% + \ignorespaces} + \DeleteShortVerb{\|}% + \MakeShortVerb{\+}}{% + \DeleteShortVerb{\+}% + \MakeShortVerb{\|}% + \par} \newcommand\thestyle{trac} \usemintedstyle{\thestyle} @@ -102,7 +140,7 @@ % \newcommand\pkg[1]{\textsf{#1}} % \newcommand\app[1]{\textsf{#1}} % -% \title{The \pkg{minted} package:\\Highlighted source code in \LaTeX +% \title{The \textcolor{minted@mint}{\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} @@ -122,11 +160,12 @@ % % \fvset{ % codes={\catcode`\%=9}, ^^A Ignore initial |%| -% numbersep=5pt +% numbersep=5pt, +% fontsize=\small % } % \setlength{\fboxsep}{1ex} % -% +% \mbox{}\newpage % \section{Introduction} % % \pkg{minted} is a package that allows formatting source code in \LaTeX. @@ -136,7 +175,7 @@ % code % \end{minted} % \end{VerbatimOut} -% \inputminted[gobble=2]{latex}{minted.doc.out} +% \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out} % % will highlight a piece of code in a chosen language. % The display can be customized by a number of arguments and colour schemes. @@ -157,10 +196,10 @@ % % \begin{minted}[gobble=3]{ruby} % class Foo -% def init -% pi = Math::PI -% @var = "Pi is approx. #{pi}" -% end +% def init +% pi = Math::PI +% @var = "Pi is approx. #{pi}" +% end % end % \end{minted} % @@ -172,6 +211,8 @@ % % \section{Installation} % +% \subsection{Prerequisites} +% % \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=\\\{\}] @@ -194,9 +235,54 @@ % 1.2.) % % +% \subsection{Required packages} +% +% \pkg{minted} requires the following packages to be available and reasonably up to date on your system, all of which ship with recent \TeX{} distributions: +% +% \begingroup +% \setlength\parskip{0pt} +% \setlength\topsep{0pt} +% \begin{list}{\textrm{\labelitemi}}{\ttfamily} +% \item keyval +% \item fancyvrb +% \item xcolor +% \item float +% \item ifthen +% \item calc +% \item ifplatform +% \end{list} +% \endgroup +% +% +% \subsection{Installing \pkg{minted}} +% \changes{1.7}{2010/03/16}{Installation instructions added} +% +% If the file |minted.sty| doesn't exist yet, we first have to create this. +% If you're using a system that supports the \app{make} command, then you can simply type the following +% command in the folder where you've extracted the \pkg{minted} package code: +% +% \begin{Verbatim}[gobble=3,commandchars=\\\{\}] +% \$ make +% \end{Verbatim} +% +% Alternatively, you may download this file separately from the +% \href{http://code.google.com/p/minted/downloads/list}{project's homepage}, or create it manually by +% executing the command +% +% \begin{Verbatim}[gobble=3,commandchars=\\\{\}] +% \$ tex minted.ins +% \end{Verbatim} +% +% on the command line. +% +% We now have to install the file so that \TeX{} is able to find them. +% In order to do that, please refer to the +% \href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf}{\TeX{} FAQ} on that subject. +% +% % \subsection{Windows} % -% Windows support is sketchy at the moment. +% Windows support is sketchy / untested at the moment. % There are two complications: installation and usage. % % \begin{description} @@ -216,12 +302,12 @@ % \begin{Verbatim}[gobble=7,commandchars=\\\{\}] % @echo off % set PYTHONPATH=C:\mintedbs{}Python26 -% \mintedpcc{}PYTHONPATH\mintedpcc{}\mintedbs{}python.exe \mintedpcc{}PYTHONPATH\mintedpcc\mintedbs{}Scripts\mintedbs{}pygmentize \mintedpcc{}* +% \mintedpcc{}PYTHONPATH\mintedpcc{}\mintedbs{}python.exe \mintedpcc{}PYTHONPATH\mintedpcc{}\mintedbs{}Scripts\mintedbs{}pygmentize \mintedpcc{}* % \end{Verbatim} % \end{description} % -% \section{Basic usage} % +% \section{Basic usage} % % \subsection{Preliminary} % @@ -241,10 +327,45 @@ % The same holds for other processors, such as |pdflatex| or |xelatex|. % % +% \subsection{A minimal complete example} +% \changes{1.7}{2010/03/16}{Minimal working example added} +% +% The following file |minimal.tex| shows the basic usage of \pkg{minted}. +% +% \begin{VerbatimOut}[gobble=1]{minted.doc.out} +% \documentclass{article} +% +% \usepackage{minted} +% +% \begin{document} +% \begin{minted}{c} +% int main() { +% printf("hello, world"); +% return 0; +% } +% \end{minted} +% \end{document} +% \end{VerbatimOut} +% \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out} +% +% By compiling the source file like this: +% +% \begin{Verbatim}[gobble=3,commandchars=\\\{\}] +% \$ pdflatex -shell-escape minimal +% \end{Verbatim} +% +% we end up with the following output in |minimal.pdf|: +% +% \hfill +% \colorbox{minted@samplebg}{\begin{minipage}{0.6\textwidth} +% \inputminted[firstline=7,lastline=10]{c}{minted.doc.out} +% \end{minipage}} +% \hfill\hfill +% % \subsection{Formatting source code} % % \DescribeEnv{minted} -% Using \pkg{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} @@ -258,14 +379,14 @@ % in more detail below. % % \DescribeMacro{\mint} -% For one-line source codes, you can alternatively use a shorthand notation similar to |\verb|: +% For one-line source codes, you can alternatively use a shorthand notation similar to |\verb|:^^A| % % \begin{example} % \mint{python}|import this| % \end{example} % -% The complete syntax is \cmd\mint\oarg{options}\marg{language}/\meta{code}/ -% Where the code delimither |/|, like with |\verb|, can be almost any punctuation character. ^^A| +% The complete syntax is \cmd\mint\oarg{options}\marg{language}|/|\meta{code}|/|, +% where the code delimither |/|, like with |\verb|, can be almost any punctuation character. ^^A| % Again, this command supports a number of options described below. % % \DescribeMacro{\inputminted} @@ -281,9 +402,7 @@ % \DescribeMacro{\usemintedstyle} % To do this, put the following into the prelude of your document: % -% \begin{minted}[gobble=3]{latex} -% \usemintedstyle{name} -% \end{minted} +% \mint[frame=lines]{latex}/\usemintedstyle{name}/ % % To get a list of all available stylesheets, execute the following command on the command line: % @@ -306,7 +425,7 @@ % \end{Verbatim} % % -% \section{Floated listings} +% \section{Floated listings}\label{sec:float} % % \DescribeEnv{listing} % \pkg{minted} provides the |listing| environment to wrap around a source code block. @@ -315,7 +434,7 @@ % as for the |table| and |figure| environments): % \begin{VerbatimOut}[gobble=1]{minted.doc.out} % \begin{listing}[H] -% \mint{cl}/(car (cons 1 2))/ +% \mint{cl}/(car (cons 1 '(2)))/ % \caption{Example of a listing.} % \label{lst:example} % \end{listing} @@ -326,11 +445,11 @@ % % will yield: % -% \begin{samepage} -% \rule{\textwidth}{0.4pt}\\ -% \input{minted.doc.out} -% \ \\\rule{\textwidth}{0.4pt}\\ -% \end{samepage} +% \hfill +% \colorbox{minted@samplebg}{\begin{minipage}{0.6\textwidth} +% \input{minted.doc.out} +% \end{minipage}} +% \hfill\hfill % % \DescribeMacro{\listoflistings} % The |\listoflistings| macro will insert a list of all (floated) listings into the document: @@ -343,19 +462,30 @@ % 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}/ +% \mint[frame=lines]{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}/ +% \mint[frame=lines]{latex}/\renewcommand\listoflistingscaption{List of program codes}/ % % % \section{Options} % % -% \subsection{Usage} +% \subsection{Package options} +% +% \DescribeMacro{section} +% \DescribeMacro{chapter} +% To control how \LaTeX{} counts the |listing| floats, you can pass either the +% |section| or |chapter| option when loading the \pkg{minted} package. +% For example, the following will cause listings to be counted per-section: +% +% \mint[frame=lines]{latex}/\usepackage[section]{minted}/ +% +% +% \subsection{Macro option usage} % % All \pkg{minted} highlight commands accept the same set of options. % Options are specified as a comma-separated list of |key=value| pairs. @@ -415,14 +545,16 @@ % % \subsection{Available options} % +% \newcommand\appliesto[1]{\textsf{[For #1 only]}} +% % Following is a full list of available options. % 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}). +% \item[baselinestretch (+auto+\textbar dimension) (+auto+)] +% Value to use as for baselinestretch inside the listing. +% \item[bgcolor (string) (\emph{none})] +% Background color of the listing. % 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: % @@ -435,34 +567,44 @@ % \end{minted} % \end{example} % -% \item[firstline (integer)] -% First line to be shown (default: +1+). +% \item[firstline (integer) (+1+)] +% The first line to be shown. % 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). -% \item[fontfamily (family name)] -% The font family to use (default: +tt+). +% \item[firstnumber (+auto+\textbar integer) (+auto+ = 1)] +% Line number of the first line. +% \item[fontfamily (family name) (+tt+)] +% The font family to use. % +tt+, +courier+ and +helvetica+ are pre-defined. -% \item[fontseries (series name)] -% The font series to use (default: +auto+ -- the same as the current font). -% \item[fontsize (font size)] -% The size of the font to use (default: +auto+ -- the same as the current font). -% \item[fontshape (font shape)] -% The font shape to use (default: +auto+ -- the same as the current font). -% \item[formatcom (command)] -% A format to execute before printing verbatim text (default: \emph{none}). -% \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)] -% Width of the frame (default: +0.4pt+). -% \item[framesep (dimension)] -% Distance between frame and content (default: +\fboxsep+). -% \item[gobble (integer)] -% Remove the first $n$ characters from each input line (default: +0+). -% \item[lastline (integer)] -% Last line to be shown (default: \emph{last line of input}). -% \item[linenos (boolean)] -% Enables line numbers (default +false+). +% \item[fontseries (series name) (+auto+ -- the same as the current font)] +% The font series to use. +% \item[fontsize (font size) (+auto+ -- the same as the current font)] +% The size of the font to use, as a size command, e.g. +\footnotesize+. +% \item[fontshape (font shape) (+auto+ -- the same as the current font)] +% The font shape to use. +% \item[formatcom (command) (\emph{none})] +% A format to execute before printing verbatim text. +% \item[frame (+none+\textbar +leftline+\textbar +topline+\textbar +bottomline+\textbar +lines+\textbar +single+) (+none+)] +% The type of frame to put around the source code listing. +% \item[framerule (dimension) (+0.4pt+)] +% Width of the frame. +% \item[framesep (dimension) (\cmd\fboxsep)] +% Distance between frame and content. +% \item[funcnamehighlighting (boolean) (+true+)] \appliesto{PHP} +% If +true+, highlights built-in function names. +% \item[gobble (integer) (+0+)] +% Remove the first $n$ characters from each input line. +% \item[label (\char`\[string\char`\]string) (\emph{empty})] +% Add a label to the top, the bottom or both of the frames around the code. +% See the \pkg{fancyvrb} documentation for more information and examples. +% \emph{Note:} This does \emph{not} add a +\label+ to the current listing. +% To achieve that, use a floating environment (section \ref{sec:float}) instead. +% \item[labelposition (+none+\textbar +topline+\textbar +bottomline+\textbar +all+) (+topline+, +all+ or \emph{none})] +% Position where to print the label (see above; default: +topline+ if one label is defined, +all+ if two are defined, \emph{none} else). +% See the \pkg{fancyvrb} documentation for more information. +% \item[lastline (integer) (\emph{last line of input})] +% The last line to be shown. +% \item[linenos (boolean) (+false+)] +% Enables line numbers. % In order to customize the display style of line numbers, you need to redefine the +\theFancyVerbLine+ % macro: % @@ -481,37 +623,39 @@ % \end{minted} % \end{example} % -% \item[mathescape (boolean)] -% Enable \LaTeX{} math mode inside comments (default: +false+). +% \item[mathescape (boolean) (+false+)] +% Enable \LaTeX{} math mode inside comments. % 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)] -% Gap between numbers and start of line (default: +12pt+). -% \item[obeytabs (boolean)] -% Treat tabs as tabs instead of converting them to spaces (default: +false+). -% \item[resetmargins (boolean)] -% Resets the left margin inside other environments (default: +false+). -% \item[rulecolor (color command)] -% The color of the frame (default: \emph{black}) -% \item[samepage (boolean)] -% Forces the whole listing to appear on the same page, even if it doesn't fit (default: +false+). -% \item[showspaces (boolean)] -% Enables visible spaces: \verb*/visible spaces/ (default: +false+). -% \item[showtabs (boolean)] -% Enables visible tabs -- only works in combination with +obeytabs+ (default: +false+). -% \item[stepnumber (integer)] -% Interval at which line numbers appear (default: +1+). -% \item[tabsize (integer)] -% The number of spaces a tab is equivalent to if +obeytabs+ is not active (default: +8+). -% \item[texcl (boolean)] -% Enables \LaTeX{} code inside comments (default: +false+). +% \item[numberblanklines (boolean) (+true+)] +% Enables or disables numbering of blank lines. +% \item[numbersep (dimension) (+12pt+)] +% Gap between numbers and start of line. +% \item[obeytabs (boolean) (+false+)] +% Treat tabs as tabs instead of converting them to spaces. +% \item[resetmargins (boolean) (+false+)] +% Resets the left margin inside other environments. +% \item[rulecolor (color command) (\emph{black})] +% The color of the frame. +% \item[samepage (boolean) (+false+)] +% Forces the whole listing to appear on the same page, even if it doesn't fit. +% \item[showspaces (boolean) (+false+)] +% Enables visible spaces: \verb*/visible spaces/. +% \item[showtabs (boolean) (+false+)] +% Enables visible tabs -- only works in combination with +obeytabs+. +% \item[startinline (boolean) (+false+)] \appliesto{PHP} +% Specifies that the code starts in PHP mode, i.e. leading +<?php+ is omitted. +% \item[stepnumber (integer) (+1+)] +% Interval at which line numbers appear. +% \item[tabsize (integer) (+8+)] +% The number of spaces a tab is equivalent to if +obeytabs+ is not active. +% \item[texcl (boolean) (+false+)] +% Enables \LaTeX{} code inside comments. % Usage as in package \pkg{listings}. -% \item[xleftmargin (dimension)] -% Indentation to add before the listing (default: +0+). -% \item[xrightmargin (dimension)] -% Indentation to add after the listing (default: +0+). +% \item[xleftmargin (dimension) (+0+)] +% Indentation to add before the listing. +% \item[xrightmargin (dimension) (+0+)] +% Indentation to add after the listing. % \end{optionlist} % % @@ -572,20 +716,18 @@ % \end{example} % % -% \section{To do list} -% -%\begin{itemize} -% \item Allow multiple stylesheets in one file. -% \item Allow quotes in \pkg{fancyvrb} arguments. -%\end{itemize} -% -% % \section{Known issues} % % \begin{itemize} % \item Extended characters do not work inside the |minted| environment, even in conjunction with % package \pkg{inputenc}. % \textbf{Solution}: Use |xelatex| instead of plain \LaTeX. +% \item The command |\captionof| and other commands from the \pkg{caption} package produce an +% error when used in combination with \pkg{minted}. +% \textbf{Solution}: Load the \pkg{caption} package with the option |compatibility=false|. +% \item \pkg{minted} doesn't work on Windows 7. +% \textbf{Solution}: As a workaround, try the accepted answer at \href{http://tex.stackexchange.com/q/23458/42}{tex.stackexchange.com/q/23458}. +% \item \ldots See list at \href{http://code.google.com/p/minted/issues/list}{code.google.com/p/minted/issues}. % \end{itemize} % % \StopEventually{ @@ -596,11 +738,33 @@ % \section{Implementation} % % +% \subsection{Package options} +% +% \changes{1.7}{2011/09/12}{Options for float placement added} +% +% \begin{macro}{\minted@float@within} +% +% Define an option that controls the section numbering of the |listing| float. +% +% \begin{macrocode} +\DeclareOption{chapter}{\def\minted@float@within{chapter}} +\DeclareOption{section}{\def\minted@float@within{section}} +% \end{macrocode} +% \end{macro} +% +% Process package options. +% +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% +% % \subsection{System-specific settings} % % \changes{1.6}{2010/01/27}{Windows support added} % % Since we communicate with the ``outside world'', some operations must be defined system-dependently. +% ^^A TODO Fails on Windows 7, needs fixing; cf. http://code.google.com/p/minted/issues/detail?id=47 % % \begin{macro}{\DeleteFile} % @@ -629,7 +793,7 @@ % % \begin{macrocode} \newboolean{AppExists} -\providecommand\TestAppExists[1]{ +\newcommand\TestAppExists[1]{ \ifwindows % \end{macrocode} % @@ -659,8 +823,10 @@ % On Unix-like systems, we do a straightforward |which| test and create a file upon success, % whose existence we can then check. % +% \changes{1.7}{2010/02/16}{Removed unportable flag from Unix shell command} +% % \begin{macrocode} - \immediate\write18{which -s #1 && touch \jobname.aex} + \immediate\write18{which #1 && touch \jobname.aex} \IfFileExists{\jobname.aex} {\AppExiststrue \DeleteFile{\jobname.aex}} @@ -726,11 +892,11 @@ % omitted, e.g. |foobar| is the same as |foobar=true|). % % \begin{macrocode} -\newcommand\minted@define@switch[2]{ - \minted@defopt{#1} - \define@booleankey{minted@opt}{#1}{ - \@namedef{minted@opt@#1}{#2}} - {\@namedef{minted@opt@#1}{}}} +\newcommand\minted@define@switch[3][]{ + \minted@defopt{#2} + \define@booleankey{minted@opt}{#2} + {\@namedef{minted@opt@#2}{#3}} + {\@namedef{minted@opt@#2}{#1}}} % \end{macrocode} % \end{macro} % @@ -767,11 +933,16 @@ % \changes{0.1.5}{2010/01/10}{Added \texttt{fillcolor} option} % \changes{0.1.5}{2010/01/10}{Removed \texttt{caption} option} % \changes{1.6}{2010/01/27}{Added font-related options} +% \changes{1.7}{2010/03/14}{Added PHP-specific options} +% \changes{1.7}{2011/01/04}{Added the \texttt{label} option} % % \begin{macrocode} \minted@define@switch{texcl}{-P texcomments} \minted@define@switch{mathescape}{-P mathescape} \minted@define@switch{linenos}{-P linenos} +\minted@define@switch{startinline}{-P startinline} +\minted@define@switch[-P funcnamehighlighting=False]% + {funcnamehighlighting}{-P funcnamehighlighting} \minted@define@opt{gobble}{-F gobble:n=#1} \minted@define@opt{bgcolor}{#1} \minted@define@extra{frame} @@ -793,6 +964,7 @@ \minted@define@extra{fontshape} \minted@define@extra{fontseries} \minted@define@extra{formatcom} +\minted@define@extra{label} \minted@define@extra@switch{numberblanklines} \minted@define@extra@switch{showspaces} \minted@define@extra@switch{resetmargins} @@ -852,9 +1024,12 @@ \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{startinline} \minted@opt{funcnamehighlighting} \minted@opt{linenos} -P "verboptions=\minted@opt{extra}" -o \jobname.out.pyg #1} \immediate\write18{\minted@cmd} + % For debugging, uncomment: + %\immediate\typeout{\minted@cmd} \ifthenelse{\equal{\minted@opt@bgcolor}{}} {} {\begin{minted@colorbg}{\minted@opt@bgcolor}} @@ -911,6 +1086,8 @@ % % Highlight a longer piece of code inside a verbatim environment. % +% \changes{1.7}{2011/08/30}{Fixed \texttt{tabsize} option} +% % \begin{macrocode} \newcommand\minted@proglang[1]{} \newenvironment{minted}[2][] @@ -918,7 +1095,7 @@ \renewcommand{\minted@proglang}[1]{#2} \minted@resetoptions \setkeys{minted@opt}{#1} - \begin{VerbatimOut}{\jobname.pyg}}% + \begin{VerbatimOut}[codes={\catcode`\^^I=12}]{\jobname.pyg}}% {\end{VerbatimOut} \minted@pygmentize{\minted@proglang{}} \DeleteFile{\jobname.pyg}} @@ -1037,7 +1214,9 @@ % Defines a new floating environment to use for floated listings. % % \begin{macrocode} -\newfloat{listing}{h}{lol} +\@ifundefined{minted@float@within} + {\newfloat{listing}{h}{lol}} + {\newfloat{listing}{h}{lol}[\minted@float@within]} % \end{macrocode} % \end{environment} % @@ -1090,14 +1269,15 @@ % % Check whether LaTeX was invoked with |-shell-escape| option. % +% \changes{1.7}{2011/01/21}{More robust detection of the \texttt{-shell-escape} option} % \begin{macrocode} \AtEndOfPackage{ - \ifeof18 + \ifnum\pdf@shellescape=1\relax\else \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} + documentation for more information.}\fi % \end{macrocode} % % Check whether \app{pygmentize} is installed. @@ -1110,7 +1290,7 @@ to use this package} {Refer to the installation instructions in the minted documentation for more information.} - \fi + \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 48eb59a717a..6efb25c770c 100644 --- a/Master/texmf-dist/source/latex/minted/minted.ins +++ b/Master/texmf-dist/source/latex/minted/minted.ins @@ -1,8 +1,9 @@ \input docstrip.tex \keepsilent +\askforoverwritefalse \preamble -Copyright 2010 Konrad Rudolph +Copyright 2010--2011 Konrad Rudolph This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -19,8 +20,8 @@ This work has the LPPL maintenance status `maintained'. The Current Maintainer of this work is Konrad Rudolph. -This work consists of the files mints.dtx and mints.ins -and the derived file mints.sty. +This work consists of the files minted.dtx and minted.ins +and the derived file minted.sty. \endpreamble \usedir{tex/latex/minted} @@ -28,3 +29,4 @@ and the derived file mints.sty. \generate{\file{minted.sty}{\from{minted.dtx}{package}}} \endbatchfile +% vim: ft=tex diff --git a/Master/texmf-dist/tex/latex/minted/minted.sty b/Master/texmf-dist/tex/latex/minted/minted.sty index a6f1dc830c0..0e0585cfdd2 100644 --- a/Master/texmf-dist/tex/latex/minted/minted.sty +++ b/Master/texmf-dist/tex/latex/minted/minted.sty @@ -5,7 +5,7 @@ %% The original source files were: %% %% minted.dtx (with options: `package') -%% Copyright 2010 Konrad Rudolph +%% Copyright 2010--2011 Konrad Rudolph %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -22,24 +22,27 @@ %% %% The Current Maintainer of this work is Konrad Rudolph. %% -%% This work consists of the files mints.dtx and mints.ins -%% and the derived file mints.sty. +%% This work consists of the files minted.dtx and minted.ins +%% and the derived file minted.sty. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{minted}[2010/01/27 v1.6 Yet another Pygments shim for LaTeX] +\ProvidesPackage{minted}[2011/09/17 v1.7 Yet another Pygments shim for LaTeX] \RequirePackage{keyval} \RequirePackage{fancyvrb} -\RequirePackage{color} +\RequirePackage{xcolor} \RequirePackage{float} \RequirePackage{ifthen} \RequirePackage{calc} \RequirePackage{ifplatform} +\DeclareOption{chapter}{\def\minted@float@within{chapter}} +\DeclareOption{section}{\def\minted@float@within{section}} +\ProcessOptions\relax \ifwindows \providecommand\DeleteFile[1]{\immediate\write18{del #1}} \else \providecommand\DeleteFile[1]{\immediate\write18{rm #1}} \fi \newboolean{AppExists} -\providecommand\TestAppExists[1]{ +\newcommand\TestAppExists[1]{ \ifwindows \DeleteFile{\jobname.aex} \immediate\write18{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd) @@ -57,7 +60,7 @@ \DeleteFile{\jobname.aex} \immediate\typeout{file deleted} \else - \immediate\write18{which -s #1 && touch \jobname.aex} + \immediate\write18{which #1 && touch \jobname.aex} \IfFileExists{\jobname.aex} {\AppExiststrue \DeleteFile{\jobname.aex}} @@ -76,11 +79,11 @@ \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}{ - \@namedef{minted@opt@#1}{#2}} - {\@namedef{minted@opt@#1}{}}} +\newcommand\minted@define@switch[3][]{ + \minted@defopt{#2} + \define@booleankey{minted@opt}{#2} + {\@namedef{minted@opt@#2}{#3}} + {\@namedef{minted@opt@#2}{#1}}} \minted@defopt{extra} \newcommand\minted@define@extra[1]{ \define@key{minted@opt}{#1}{ @@ -95,6 +98,9 @@ \minted@define@switch{texcl}{-P texcomments} \minted@define@switch{mathescape}{-P mathescape} \minted@define@switch{linenos}{-P linenos} +\minted@define@switch{startinline}{-P startinline} +\minted@define@switch[-P funcnamehighlighting=False]% + {funcnamehighlighting}{-P funcnamehighlighting} \minted@define@opt{gobble}{-F gobble:n=#1} \minted@define@opt{bgcolor}{#1} \minted@define@extra{frame} @@ -116,6 +122,7 @@ \minted@define@extra{fontshape} \minted@define@extra{fontseries} \minted@define@extra{formatcom} +\minted@define@extra{label} \minted@define@extra@switch{numberblanklines} \minted@define@extra@switch{showspaces} \minted@define@extra@switch{resetmargins} @@ -139,9 +146,12 @@ \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{startinline} \minted@opt{funcnamehighlighting} \minted@opt{linenos} -P "verboptions=\minted@opt{extra}" -o \jobname.out.pyg #1} \immediate\write18{\minted@cmd} + % For debugging, uncomment: + %\immediate\typeout{\minted@cmd} \ifthenelse{\equal{\minted@opt@bgcolor}{}} {} {\begin{minted@colorbg}{\minted@opt@bgcolor}} @@ -170,7 +180,7 @@ \renewcommand{\minted@proglang}[1]{#2} \minted@resetoptions \setkeys{minted@opt}{#1} - \begin{VerbatimOut}{\jobname.pyg}}% + \begin{VerbatimOut}[codes={\catcode`\^^I=12}]{\jobname.pyg}}% {\end{VerbatimOut} \minted@pygmentize{\minted@proglang{}} \DeleteFile{\jobname.pyg}} @@ -200,7 +210,9 @@ {\def\minted@shortname{#1}} \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{ \inputminted[#3,##1]{#2}{##2}}} -\newfloat{listing}{h}{lol} +\@ifundefined{minted@float@within} + {\newfloat{listing}{h}{lol}} + {\newfloat{listing}{h}{lol}[\minted@float@within]} \newcommand\listingscaption{Listing} \floatname{listing}{\listingscaption} \newcommand\listoflistingscaption{List of listings} @@ -208,12 +220,12 @@ \AtBeginDocument{ \minted@usedefaultstyle} \AtEndOfPackage{ - \ifeof18 + \ifnum\pdf@shellescape=1\relax\else \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} + documentation for more information.}\fi \TestAppExists{pygmentize} \ifAppExists\else \PackageError{minted} @@ -221,7 +233,7 @@ to use this package} {Refer to the installation instructions in the minted documentation for more information.} - \fi + \fi} \endinput %% %% End of file `minted.sty'. |