diff options
author | Karl Berry <karl@freefriends.org> | 2010-01-09 01:06:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-01-09 01:06:06 +0000 |
commit | 6c0e20211966e2ad4943b5765cfab85123d882c3 (patch) | |
tree | 388ce656aa9968b22cdc68a935535eec64b594e9 /Master/texmf-dist/tex/latex/minted/minted.sty | |
parent | 35b900f339f9ca5d181ccd4fd4256d91cc641461 (diff) |
new latex package minted 0.0.4 (8jan10)
git-svn-id: svn://tug.org/texlive/trunk@16642 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/minted/minted.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/minted/minted.sty | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/minted/minted.sty b/Master/texmf-dist/tex/latex/minted/minted.sty new file mode 100644 index 00000000000..de3062e77da --- /dev/null +++ b/Master/texmf-dist/tex/latex/minted/minted.sty @@ -0,0 +1,127 @@ +%% +%% This is file `minted.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% minted.dtx (with options: `package') +%% Copyright 2010 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. +%% +%% 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. +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{minted}[2010/01/08 0.0.4 Yet another Pygments shim for LaTeX] +\RequirePackage{keyval} +\RequirePackage{fancyvrb} +\RequirePackage{color} + +\newcommand\minted@resetoptions{} +\newcommand\minted@defopt[1]{ + \expandafter\def\expandafter\minted@resetoptions\expandafter{% + \minted@resetoptions + \@namedef{minted@opt@#1}{}}} +\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@switch[2]{ + \minted@defopt{#1} + \define@booleankey{minted@opt}{#1}{ + \@namedef{minted@opt@#1}{#2}} + {\@namedef{minted@opt@#1}{}}} +\minted@defopt{extra} +\newcommand\minted@define@extra[1]{ + \define@key{minted@opt}{#1}{ + \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{% + \minted@opt@extra,#1}} + {\expandafter\def\expandafter\minted@opt@extra\expandafter{% + \minted@opt@extra,#1=false}}} +\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@extra{frame} +\minted@define@extra{framesep} +\minted@define@extra{framerule} +\minted@define@extra{rulecolor} +\minted@define@extra{numbersep} +\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@switch{numberblanklines} +\minted@define@extra@switch{showspaces} +\minted@define@extra@switch{resetmargins} +\minted@define@extra@switch{samepage} +\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. + \immediate\write18{\minted@cmd} + \input{\jobname.out.pyg} + \immediate\write18{rm \jobname.out.pyg}} +\newcommand\minted@usedefaultstyle{\usemintedstyle{default}} +\newcommand\usemintedstyle[1]{ + \renewcommand\minted@usedefaultstyle{} + \immediate\write18{pygmentize -S #1 -f latex > \jobname.pyg} + \input{\jobname.pyg}} +\newcommand\mint[3][]{ + \DefineShortVerb{#3} + \minted@resetoptions + \setkeys{minted@opt}{#1} + \SaveVerb[aftersave={ + \UndefineShortVerb{#3} + \minted@savecode{\FV@SV@minted@verb} + \minted@pygmentize{#2} + \immediate\write18{rm \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}} +\newcommand\inputminted[3][]{ + \minted@resetoptions + \setkeys{minted@opt}{#1} + \minted@pygmentize[#3]{#2}} +\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} +\endinput +%% +%% End of file `minted.sty'. |