summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/verbments
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-07 23:40:10 +0000
committerKarl Berry <karl@freefriends.org>2011-08-07 23:40:10 +0000
commit7822e32d4066bb81d8e6ed47697c93301b86fe9f (patch)
treef5eca2b975844d3853d1e21daccfc3419362cf7c /Master/texmf-dist/tex/latex/verbments
parent20ff44ce9e3f008751e5b3730036a2c97d5031df (diff)
new latex package verbments (13jun11)
git-svn-id: svn://tug.org/texlive/trunk@23452 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/verbments')
-rw-r--r--Master/texmf-dist/tex/latex/verbments/verbments.sty142
1 files changed, 142 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/verbments/verbments.sty b/Master/texmf-dist/tex/latex/verbments/verbments.sty
new file mode 100644
index 00000000000..cbcb8c64661
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/verbments/verbments.sty
@@ -0,0 +1,142 @@
+% verbments.sty v1.1 2011/07/07
+%
+% Copyright (C) 2011 by Dejan Zivkovic
+% -----------------------------------
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.2
+% 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.2 or later is part of all distributions of LaTeX
+% version 1999/12/01 or later.
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{verbments}[2011/07/07 v1.1 Pygments/fancyvrb source code highlighting for LaTeX]
+\RequirePackage[svgnames]{xcolor}
+\RequirePackage{xkeyval,fancyvrb,framed}
+%
+\newcommand{\@listofpyglistingsname}{Listings}%
+\newcommand{\listofpyglistingsname}[1]{%
+\renewcommand\@listofpyglistingsname{#1}}
+\newcommand{\listofpyglistings}{%
+ \begingroup
+ \let\contentsname\@listofpyglistingsname
+ \let\@pygtoc\@starttoc \def\@starttoc##1{\@pygtoc{pyg.lol}}%
+ \tableofcontents%
+ \endgroup
+}
+\newcommand{\lol@caption}[1]{%
+ \addcontentsline{pyg.lol}{pyglist}{#1}
+}
+\newcommand{\l@pyglist}[2]{%
+ \@dottedtocline{1}{1.5em}{2.3em}{#1}{#2}
+}
+%
+\newlength{\@tmpwidth}
+%
+\newskip\@tmpskipa
+\def\max@vskip #1{%
+ \@tmpskipa = #1\relax
+ \ifdim\lastskip < \@tmpskipa
+ \ifdim\lastskip = 0pt
+ \else \vskip -\lastskip
+ \fi
+ \vskip \@tmpskipa
+ \fi%
+}
+
+\setlength{\FrameSep}{0pt}
+\setlength{\FrameRule}{0pt}
+%
+\define@cmdkey{pyglist}[pl@]{caption}{}
+\define@cmdkey{pyglist}[pl@]{abovecaptionskip}[\bigskipamount]{}
+\define@cmdkey{pyglist}[pl@]{belowcaptionskip}[0pt]{}
+\define@cmdkey{pyglist}[pl@]{listingname}[Listing]{}
+\define@cmdkey{pyglist}[pl@]{label}{}
+%
+\define@cmdkey{pyglist}[pl@]{bgcolor}[white]{}
+\define@cmdkey{pyglist}[pl@]{language}[text]{}
+\define@cmdkey{pyglist}[pl@]{encoding}[latin1]{}
+\define@boolkey{pyglist}[pl@]{mathescape}[false]{}
+\define@boolkey{pyglist}[pl@]{texcl}[false]{}
+\define@cmdkey{pyglist}[pl@]{style}[default]{}
+\define@cmdkey{pyglist}[pl@]{gobble}[0]{}
+%
+\define@cmdkey{pyglist}[pl@]{fontsize}{}
+\define@cmdkey{pyglist}[pl@]{numbers}{}
+\define@cmdkey{pyglist}[pl@]{numbersep}{}
+\define@boolkey{pyglist}[pl@]{showspaces}[false]{}
+
+\newcommand\plset[1]{%
+ \setkeys{pyglist}{#1}%
+}
+
+\newenvironment{pyglist}{%
+ \catcode`\^^M=\active
+ \@ifnextchar[%
+ {\catcode`\^^M=5 \pyglist@}
+ {\catcode`\^^M=5 \pyglist@[]}
+}{%
+ \end{VerbatimOut}%
+ \immediate\write18{\pyg@cmd}
+ \immediate\write18{\pyg@style}
+ \input{\jobname.pyg.sty}%
+%
+ \partopsep = 0pt\parskip = 0pt\parindent = 0pt%
+ \@ifundefined{pl@caption}%
+ {\setlength{\topsep}{-2pt}}%
+ {\par%
+ \allowbreak%
+ \max@vskip{\pl@abovecaptionskip}%
+ \refstepcounter{pllisting}%
+ \@ifundefined{pl@label}{}{\label{\pl@label}}%
+ \settowidth{\@tmpwidth}{\bfseries\pl@listingname~\thepllisting:\space}%
+ \mbox{\bfseries\pl@listingname~\thepllisting:\space}%
+ \parbox[t]{\linewidth-\@tmpwidth}{\pl@caption}%
+ \par\nobreak\vskip\pl@belowcaptionskip\nobreak%
+ \setlength{\topsep}{\smallskipamount}%
+ \lol@caption{\rlap{\thepllisting}\hskip5ex \pl@caption}
+ }%
+%
+ \@ifundefined{pl@fontsize}{}{\fvset{fontsize=\pl@fontsize}}%
+ \@ifundefined{pl@numbers}{}{\fvset{numbers=\pl@numbers}}%
+ \@ifundefined{pl@numbersep}{}{\fvset{numbersep=\pl@numbersep}}%
+ \ifpl@showspaces\fvset{showspaces}\fi%
+%
+ \definecolor{shadecolor}{named}{\pl@bgcolor}%
+ \begin{snugshade}
+ \input{\jobname.pyg.vrb}
+ \end{snugshade}
+}
+
+\def\pyglist@[#1]{%
+ \setkeys{pyglist}{#1}
+ \edef\pyg@cmd{pygmentize -P encoding=\pl@encoding\space -l \pl@language\space
+ -F tokenmerge \ifnum\pl@gobble=0\space \else -F gobble:n=\pl@gobble\space\fi
+ -f latex
+ \ifpl@texcl -P texcomments\space\fi
+ \ifpl@mathescape -P mathescape\space\fi
+ -o \jobname.pyg.vrb \jobname.pyg.lst}
+ \edef\pyg@style{pygmentize -S \pl@style\space -f latex > \jobname.pyg.sty}
+ \VerbatimEnvironment
+ \begin{VerbatimOut}{\jobname.pyg.lst}% No char whatsoever to the next brace
+}
+
+\AtBeginDocument{
+ \@ifundefined{thechapter}{
+ \newcounter{pllisting}
+ \gdef\thepllisting{\@arabic\c@pllisting}
+ }{
+ \newcounter{pllisting}[chapter]
+ \gdef\thepllisting%
+ {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@pllisting}
+ }
+}
+
+\plset{abovecaptionskip,belowcaptionskip,listingname,%
+ bgcolor,language,encoding,mathescape,texcl,style,gobble,%
+ showspaces} % set default key values
+\endinput