summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/minted
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-01-31 23:00:19 +0000
committerKarl Berry <karl@freefriends.org>2010-01-31 23:00:19 +0000
commit4c687970924307eb16d66983b4b19983ad7bba64 (patch)
tree342220a161938c78af8593392255f80df648ccce /Master/texmf-dist/tex/latex/minted
parent2c2a29fc86f2bb31a5a9511db54fa6d58902546b (diff)
minted 1.6 (31jan10)
git-svn-id: svn://tug.org/texlive/trunk@16883 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/minted')
-rw-r--r--Master/texmf-dist/tex/latex/minted/minted.sty113
1 files changed, 93 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/minted/minted.sty b/Master/texmf-dist/tex/latex/minted/minted.sty
index 7b53747c7d1..a6f1dc830c0 100644
--- a/Master/texmf-dist/tex/latex/minted/minted.sty
+++ b/Master/texmf-dist/tex/latex/minted/minted.sty
@@ -25,13 +25,44 @@
%% This work consists of the files mints.dtx and mints.ins
%% and the derived file mints.sty.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{minted}[2010/01/13 v0.1.5 Yet another Pygments shim for LaTeX]
+\ProvidesPackage{minted}[2010/01/27 v1.6 Yet another Pygments shim for LaTeX]
\RequirePackage{keyval}
\RequirePackage{fancyvrb}
\RequirePackage{color}
\RequirePackage{float}
\RequirePackage{ifthen}
\RequirePackage{calc}
+\RequirePackage{ifplatform}
+\ifwindows
+ \providecommand\DeleteFile[1]{\immediate\write18{del #1}}
+\else
+ \providecommand\DeleteFile[1]{\immediate\write18{rm #1}}
+\fi
+\newboolean{AppExists}
+\providecommand\TestAppExists[1]{
+ \ifwindows
+ \DeleteFile{\jobname.aex}
+ \immediate\write18{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd)
+ do set >\jobname.aex <nul: /p x=\string^\@percentchar \string~$PATH:i>>\jobname.aex} %$
+ \newread\@appexistsfile
+ \immediate\openin\@appexistsfile\jobname.aex
+ \expandafter\def\expandafter\@tmp@cr\expandafter{\the\endlinechar}
+ \endlinechar=-1\relax
+ \readline\@appexistsfile to \@apppathifexists
+ \endlinechar=\@tmp@cr
+ \ifthenelse{\equal{\@apppathifexists}{}}
+ {\AppExistsfalse}
+ {\AppExiststrue}
+ \immediate\closein\@appexistsfile
+ \DeleteFile{\jobname.aex}
+\immediate\typeout{file deleted}
+ \else
+ \immediate\write18{which -s #1 && touch \jobname.aex}
+ \IfFileExists{\jobname.aex}
+ {\AppExiststrue
+ \DeleteFile{\jobname.aex}}
+ {\AppExistsfalse}
+ \fi}
\newcommand\minted@resetoptions{}
\newcommand\minted@defopt[1]{
\expandafter\def\expandafter\minted@resetoptions\expandafter{%
@@ -56,10 +87,10 @@
\expandafter\def\expandafter\minted@opt@extra\expandafter{%
\minted@opt@extra,#1=##1}}}
\newcommand\minted@define@extra@switch[1]{
- \define@booleankey{minted@opt}{#1}{
- \expandafter\def\expandafter\minted@opt@extra\expandafter{%
+ \define@booleankey{minted@opt}{#1}
+ {\expandafter\def\expandafter\minted@opt@extra\expandafter{%
\minted@opt@extra,#1}}
- {\expandafter\def\expandafter\minted@opt@extra\expandafter{%
+ {\expandafter\def\expandafter\minted@opt@extra\expandafter{%
\minted@opt@extra,#1=false}}}
\minted@define@switch{texcl}{-P texcomments}
\minted@define@switch{mathescape}{-P mathescape}
@@ -79,10 +110,18 @@
\minted@define@extra{xleftmargin}
\minted@define@extra{xrightmargin}
\minted@define@extra{fillcolor}
+\minted@define@extra{tabsize}
+\minted@define@extra{fontfamily}
+\minted@define@extra{fontsize}
+\minted@define@extra{fontshape}
+\minted@define@extra{fontseries}
+\minted@define@extra{formatcom}
\minted@define@extra@switch{numberblanklines}
\minted@define@extra@switch{showspaces}
\minted@define@extra@switch{resetmargins}
\minted@define@extra@switch{samepage}
+\minted@define@extra@switch{showtabs}
+\minted@define@extra@switch{obeytabs}
\newsavebox{\minted@bgbox}
\newenvironment{minted@colorbg}[1]{
\def\minted@bgcol{#1}
@@ -103,12 +142,14 @@
\minted@opt{linenos} -P "verboptions=\minted@opt{extra}"
-o \jobname.out.pyg #1}
\immediate\write18{\minted@cmd}
- \ifthenelse{\equal{\minted@opt@bgcolor}{}}{}
+ \ifthenelse{\equal{\minted@opt@bgcolor}{}}
+ {}
{\begin{minted@colorbg}{\minted@opt@bgcolor}}
\input{\jobname.out.pyg}
- \ifthenelse{\equal{\minted@opt@bgcolor}{}}{}
+ \ifthenelse{\equal{\minted@opt@bgcolor}{}}
+ {}
{\end{minted@colorbg}}
- \immediate\write18{rm \jobname.out.pyg}}
+ \DeleteFile{\jobname.out.pyg}}
\newcommand\minted@usedefaultstyle{\usemintedstyle{default}}
\newcommand\usemintedstyle[1]{
\renewcommand\minted@usedefaultstyle{}
@@ -122,21 +163,43 @@
\UndefineShortVerb{#3}
\minted@savecode{\FV@SV@minted@verb}
\minted@pygmentize{#2}
- \immediate\write18{rm \jobname.pyg}}]{minted@verb}#3}
+ \DeleteFile{\jobname.pyg}}]{minted@verb}#3}
\newcommand\minted@proglang[1]{}
\newenvironment{minted}[2][]
- {\VerbatimEnvironment
- \renewcommand{\minted@proglang}[1]{#2}
- \minted@resetoptions
- \setkeys{minted@opt}{#1}
- \begin{VerbatimOut}{\jobname.pyg}}%
- {\end{VerbatimOut}
- \minted@pygmentize{\minted@proglang{}}
- \immediate\write18{rm \jobname.pyg}}
+ {\VerbatimEnvironment
+ \renewcommand{\minted@proglang}[1]{#2}
+ \minted@resetoptions
+ \setkeys{minted@opt}{#1}
+ \begin{VerbatimOut}{\jobname.pyg}}%
+ {\end{VerbatimOut}
+ \minted@pygmentize{\minted@proglang{}}
+ \DeleteFile{\jobname.pyg}}
\newcommand\inputminted[3][]{
\minted@resetoptions
\setkeys{minted@opt}{#1}
\minted@pygmentize[#3]{#2}}
+\newcommand\newminted[3][]{
+ \ifthenelse{\equal{#1}{}}
+ {\def\minted@envname{#2code}}
+ {\def\minted@envname{#1}}
+ \newenvironment{\minted@envname}
+ {\VerbatimEnvironment\begin{minted}[#3]{#2}}
+ {\end{minted}}
+ \newenvironment{\minted@envname *}[1]
+ {\VerbatimEnvironment\begin{minted}[#3,##1]{#2}}
+ {\end{minted}}}
+\newcommand\newmint[3][]{
+ \ifthenelse{\equal{#1}{}}
+ {\def\minted@shortname{#2}}
+ {\def\minted@shortname{#1}}
+ \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{
+ \mint[#3,##1]{#2}##2}}
+\newcommand\newmintedfile[3][]{
+ \ifthenelse{\equal{#1}{}}
+ {\def\minted@shortname{#2file}}
+ {\def\minted@shortname{#1}}
+ \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{
+ \inputminted[#3,##1]{#2}{##2}}}
\newfloat{listing}{h}{lol}
\newcommand\listingscaption{Listing}
\floatname{listing}{\listingscaption}
@@ -145,10 +208,20 @@
\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}
+ \TestAppExists{pygmentize}
+ \ifAppExists\else
+ \PackageError{minted}
+ {You must have `pygmentize' installed
+ to use this package}
+ {Refer to the installation instructions in the minted
+ documentation for more information.}
+ \fi
\endinput
%%
%% End of file `minted.sty'.