summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/verbments
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-24 00:10:12 +0000
committerKarl Berry <karl@freefriends.org>2011-08-24 00:10:12 +0000
commit309ea4c9661303612e1c644a2debd0fde5d89d32 (patch)
tree0880993bddec8eaf9e979a5570c87476cc180649 /Master/texmf-dist/tex/latex/verbments
parent38c14b17ff6509371c67391452f5b34d9b582333 (diff)
verbments (22aug11)
git-svn-id: svn://tug.org/texlive/trunk@23670 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/verbments')
-rw-r--r--Master/texmf-dist/tex/latex/verbments/verbments.sty68
1 files changed, 40 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/verbments/verbments.sty b/Master/texmf-dist/tex/latex/verbments/verbments.sty
index cbcb8c64661..05c83f18c8c 100644
--- a/Master/texmf-dist/tex/latex/verbments/verbments.sty
+++ b/Master/texmf-dist/tex/latex/verbments/verbments.sty
@@ -1,4 +1,4 @@
-% verbments.sty v1.1 2011/07/07
+% verbments.sty v1.2 2011/08/20
%
% Copyright (C) 2011 by Dejan Zivkovic
% -----------------------------------
@@ -14,13 +14,13 @@
% 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}
+\ProvidesPackage{verbments}[2011/08/20 v1.2 Pygments/fancyvrb source code highlighting for LaTeX]
+\RequirePackage{xkeyval,fancyvrb,framed,xcolor,calc}
%
\newcommand{\@listofpyglistingsname}{Listings}%
\newcommand{\listofpyglistingsname}[1]{%
-\renewcommand\@listofpyglistingsname{#1}}
+ \renewcommand\@listofpyglistingsname{#1}
+}
\newcommand{\listofpyglistings}{%
\begingroup
\let\contentsname\@listofpyglistingsname
@@ -37,14 +37,14 @@
%
\newlength{\@tmpwidth}
%
-\newskip\@tmpskipa
+\newskip\@tmpvskip
\def\max@vskip #1{%
- \@tmpskipa = #1\relax
- \ifdim\lastskip < \@tmpskipa
+ \@tmpvskip = #1\relax
+ \ifdim\lastskip < \@tmpvskip
\ifdim\lastskip = 0pt
\else \vskip -\lastskip
\fi
- \vskip \@tmpskipa
+ \vskip \@tmpvskip
\fi%
}
@@ -52,9 +52,12 @@
\setlength{\FrameRule}{0pt}
%
\define@cmdkey{pyglist}[pl@]{caption}{}
+\define@cmdkey{pyglist}[pl@]{captionfont}[{}]{}
\define@cmdkey{pyglist}[pl@]{abovecaptionskip}[\bigskipamount]{}
\define@cmdkey{pyglist}[pl@]{belowcaptionskip}[0pt]{}
\define@cmdkey{pyglist}[pl@]{listingname}[Listing]{}
+\define@cmdkey{pyglist}[pl@]{listingnamefont}[{}]{}
+\define@cmdkey{pyglist}[pl@]{captionbgcolor}{}
\define@cmdkey{pyglist}[pl@]{label}{}
%
\define@cmdkey{pyglist}[pl@]{bgcolor}[white]{}
@@ -65,10 +68,11 @@
\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]{}
+\define@cmdkey{pyglist}[pl@]{fvset}{\fvset{#1}}
+\define@cmdkey{pyglist}[pl@]{fontsize}{\fvset{fontsize=#1}}
+\define@cmdkey{pyglist}[pl@]{numbers}{\fvset{numbers=#1}}
+\define@cmdkey{pyglist}[pl@]{numbersep}{\fvset{numbersep=#1}}
+\define@boolkey{pyglist}[pl@]{showspaces}{\fvset{showspaces=#1}}
\newcommand\plset[1]{%
\setkeys{pyglist}{#1}%
@@ -87,25 +91,32 @@
%
\partopsep = 0pt\parskip = 0pt\parindent = 0pt%
\@ifundefined{pl@caption}%
- {\setlength{\topsep}{-2pt}}%
+ {\setlength{\topsep}{0pt}}%
{\par%
- \allowbreak%
\max@vskip{\pl@abovecaptionskip}%
+ \penalty -100% encourage page break
\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%
+ \@tmpvskip=3\baselineskip%
+ \vskip \@tmpvskip\penalty 1000\vskip -\@tmpvskip\vskip \z@skip% prevent page break
+ \settowidth{\@tmpwidth}{\pl@listingnamefont\pl@listingname~\thepllisting:\space}%
+ \@ifundefined{pl@captionbgcolor}%
+ {\mbox{\pl@listingnamefont\pl@listingname~\thepllisting:\space}%
+ \parbox[t]{\linewidth-\@tmpwidth}%
+ {\leavevmode\pl@captionfont\pl@caption}%
+ }
+ {\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{4pt}%
+ \colorbox{\pl@captionbgcolor}{%
+ \mbox{\pl@listingnamefont\pl@listingname~\thepllisting:\space}%
+ \parbox[t]{\linewidth-\@tmpwidth-2\fboxsep}%
+ {\leavevmode\pl@captionfont\pl@caption}%
+ }%
+ }%
+ \par\nobreak\vskip\pl@belowcaptionskip%
\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}
@@ -122,7 +133,7 @@
-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
+ \begin{VerbatimOut}{\jobname.pyg.lst}% NO char whatsoever to the next brace
}
\AtBeginDocument{
@@ -136,7 +147,8 @@
}
}
-\plset{abovecaptionskip,belowcaptionskip,listingname,%
- bgcolor,language,encoding,mathescape,texcl,style,gobble,%
- showspaces} % set default key values
+% Set default key values
+\plset{captionfont,abovecaptionskip,belowcaptionskip,listingname,listingnamefont,%
+ bgcolor,language,encoding,mathescape,texcl,style,gobble%
+}
\endinput