From e1dea85ce1b88e8920d2aebf40a78e1c184225bd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 Jun 2013 22:27:16 +0000 Subject: verbatimbox (7jun13) git-svn-id: svn://tug.org/texlive/trunk@31022 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/verbatimbox/verbatimbox.sty | 47 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'Master/texmf-dist/tex/latex/verbatimbox') diff --git a/Master/texmf-dist/tex/latex/verbatimbox/verbatimbox.sty b/Master/texmf-dist/tex/latex/verbatimbox/verbatimbox.sty index e237b3798e0..66aed9d85fc 100644 --- a/Master/texmf-dist/tex/latex/verbatimbox/verbatimbox.sty +++ b/Master/texmf-dist/tex/latex/verbatimbox/verbatimbox.sty @@ -1,5 +1,5 @@ \ProvidesPackage{verbatimbox} - [2013/04/24 v3.0 + [2013/06/06 v3.1 Routines for placing verbatim text into boxes, useful in places where the verbatim environment is inaccessible. Secondarily, for adding vertical buffer around an object.] @@ -29,6 +29,13 @@ vertical buffer around an object.] % -Added optional arguments to \addvbuffer % -Fixed \verbfilebox so that it restored \verbatim@processline % -Produced real documentation +% 3.01 -renamed \macro@name so as not to conflict with (I think) ltxdoc +% package +% 3.1 -Corrected default argument to \addvbuffer so that it wouldn't +% break. Also, gave better guidance in documentation to use +% of optional argument to \addvbuffer +% -Added verbnobox environment and \verbfilenobox macro +% -Improved documentation showing line-specific optional arguments \NeedsTeXFormat{LaTeX2e} \@ifundefined{verbatim@processline}{\RequirePackage{verbatim}}{} \usepackage{stringstrings} @@ -182,7 +189,7 @@ vertical buffer around an object.] \global\newlength\boxtop@sep \global\newlength\boxbottom@sep -\newcommand\addvbuffer[2][{\the\boxtopsep} \the\boxbottomsep]{% +\newcommand\addvbuffer[2][\the\boxtopsep\ \the\boxbottomsep]{% \getargs{#1}% \setlength\boxtop@sep{\argi}% \if1\narg\setlength\boxbottom@sep{\argi}\else% @@ -190,6 +197,42 @@ vertical buffer around an object.] \add@vbuffer{#2}% } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The following two "nobox" commands are basically versions of +% \verbatiminput and \verbatim that have been adapted to take the +% optional argument style of this package. No boxes are created, +% but breaking across page boundaries is not a problem here, as +% it would be with a box. + +\newcommand\verbfilenobox[2][]{% + \setcounter{VerbboxLineNo}{0}% + \def\verbatim@processline{% + {\addtocounter{VerbboxLineNo}{1}% + #1\setbox0=\hbox{#1\the\verbatim@line}% + \hsize=\wd0 \the\verbatim@line\par}}% + \verbatiminput{#2} + \let\verbatim@processline\sv@verbatim@processline +} + +\newenvironment{verbnobox}{% + \setcounter{VerbboxLineNo}{-1}% +% FOR SOME REASON, USING \my@par INSTEAD OF \par PREVENTS EXTRA SPACE +% ABOVE verbbox WHEN USING OPTIONAL ARGUMENTS + \let\my@par\par% + \def\verbatim@processline{% +% FIRST \@tmp APPLIES OPTIONAL ARGUMENT TO EACH VERBATIM LINE +% SECOND \@tmp MAKES SURE ANY PRINTED MATTER OF OPTIONAL ARGUMENT +% IS ACCOUNTED FOR IN VERBATIM BOX WIDTH + {\addtocounter{VerbboxLineNo}{1}% + \@tmp\setbox0=\hbox{\@tmp\the\verbatim@line}% + \hsize=\wd0 \the\verbatim@line\my@par}}% +\verbatim\verbbox@inner% +} +{% + \endverbatim% + \global\def\@tmp{}% +} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \endinput -- cgit v1.2.3