diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/mdwtools/sverb.sty |
Initial commit
Diffstat (limited to 'macros/latex/contrib/mdwtools/sverb.sty')
-rw-r--r-- | macros/latex/contrib/mdwtools/sverb.sty | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/macros/latex/contrib/mdwtools/sverb.sty b/macros/latex/contrib/mdwtools/sverb.sty new file mode 100644 index 0000000000..ab804f5941 --- /dev/null +++ b/macros/latex/contrib/mdwtools/sverb.sty @@ -0,0 +1,358 @@ +%% +%% This is file `sverb.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% sverb.dtx (with options: `package') +%% +%% IMPORTANT NOTICE +%% +%% sverb package -- handling of verbatim text +%% Copyright (c) 1996 Mark Wooding +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{sverb} + [1996/05/08 1.3 Verbatim typesetting] +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +\def\@cspecials{% + \begingroup% + \catcode`|0% + \catcode`<1% + \catcode`>2% + \catcode`\{12% + \catcode`\}12% + \catcode`\\12% +} +\def\sv@startlisting{% + \def\par{\@@par\penalty\interlinepenalty}% + \@@par% + \leftskip\@totalleftmargin% + \obeylines% + \@noligs% + \let\do\@makeother\dospecials% + \verbatim@font% + \frenchspacing% + \@vobeyspaces% + \settabwidth% + \catcode9\active% + \lccode`\~9\lowercase{\let~\sv@vtab}% + \lccode`\~13\lowercase{\let~\vinput@cr}% + \interlinepenalty500% +} +\newdimen\svtab +\def\settabwidth{\setbox\z@\hbox{\texttt{\space}}\svtab8\wd\z@} +\def\sv@vtab{% + \hfill\egroup% + \@tempdima\wd\z@% + \divide\@tempdima\svtab% + \multiply\@tempdima\svtab% + \advance\@tempdima\svtab% + \wd\z@\@tempdima% + \leavevmode\box\z@% + \setbox\z@\hbox\bgroup% +} +\def\verbinput#1{% + \begin{listinglist}% + \listingsize% + \sv@startlisting% + \setbox\z@\hbox\bgroup% + \input{#1}% + \sv@stripspc% + \egroup% + \ifdim\wd\z@=\z@% + \ifhmode\par\fi% + \else% + \leavevmode\box\z@\par% + \fi% + \end{listinglist}% +} +\def\vinput@cr{% + \egroup% + \leavevmode\box\z@% + \par% + \setbox\z@\hbox\bgroup% +} +\newif\if@matched +\def\matcher#1#2#3{% + \expandafter\def\csname\string#1$match\endcsname##1#2##2##3\end{% + \ifx##2\relax% + \@matchedfalse% + \else% + \@matchedtrue% + \fi% + #3{##1}% + }% + \expandafter\def\expandafter#1\expandafter##\expandafter1\expandafter{% + \csname\string#1$match\endcsname##1#2\relax\end% + }% +} +\def\sv@stripspc{% + \unpenalty% + \ifdim\lastskip=\z@\else% + \unskip\expandafter\sv@stripspc% + \fi% +} +\begingroup +\catcode`\%=12 +\gdef\sv@percent#1#2\relax + {\ifx\check@percent\@@undefined + \ifx#1\relax\def\@tempa{}\else + \def\@tempa{#1#2}\fi\else + \ifx#1\relax\def\@tempa{}\else + \ifx#1%\def\@tempa{#2}\else + \def\@tempa{#1#2}\fi\fi\fi} +\endgroup +\lccode`\~32 +\lccode`\!32 +\lowercase{% + \def\@isspaces#1{% + \ifx#1\relax% + \def\@tempb{\@tempswafalse}% + \else\ifx#1~% + \let\@tempb\@isspaces% + \else% + \def\@tempb##1\relax{}% + \fi\fi% + \@tempb% + } + \def\sv@safespc{% + \catcode32\active% + \def~{ }% + } +} +\def\sv@read#1#2#3{% + \begingroup% + \matcher\@match{#1}\sv@read@ii% + \catcode13\active% + \catcode32\active% + \@tempswafalse% + \lccode`\~13\lowercase{% + \def\sv@read@i##1~{\@match{##1}}% + }% + \def\sv@read@ii##1{% + \sv@percent##1\relax\relax% + \if@matched\@tempswafalse\fi% + \if@tempswa\else\@tempswatrue\expandafter\@isspaces\@tempa\relax\fi% + \if@tempswa% + \begingroup% + \expandafter#2\expandafter{\@tempa}% + \endgroup% + \fi% + \@tempswatrue% + \if@matched\def\@tempa{\endgroup#3}\else\let\@tempa\sv@read@i\fi% + \@tempa% + }% + \sv@read@i% +} +\begingroup +\lccode`\<=`\{ +\lccode`\>=`\} +\lccode`\|=`\\ +\lowercase{\endgroup +\def\sv@readenv#1{% + \expandafter\expandafter\expandafter% + #1\expandafter\sv@readenv@i\@currenvir\@@% +} +\def\sv@readenv@i#1\@@{{|end<#1>}{\end{#1}}} +} +\def\sv@verbline#1{% + \setbox\z@\hbox{#1\sv@stripspc}% + \ifdim\wd\z@=\z@% + \if@matched\ifhmode\par\relax\fi\else\leavevmode\par\relax\fi% + \else% + \leavevmode\box\z@\par\relax% + \fi% +} +\newdimen\listingindent +\AtBeginDocument{% + \ifdim\parindent=\z@\listingindent1em\else\listingindent\parindent\fi% +} +\ifx\listingsize\@@undefined + \let\listingsize\small +\fi +\def\listinglist{% + \list{}{% + \if@inlabel% + \leftmargin\z@% + \else% + \leftmargin\listingindent% + \fi% + \rightmargin\z@% + \labelwidth\z@% + \labelsep\z@% + \itemindent\z@% + \listparindent\z@% + \let\makelabel\relax% + \parsep\z@skip% + }% + \parfillskip\@flushglue% + \item\relax% +} +\let\endlistinglist\endlist +\def\listing{% + \listinglist% + \listingsize% + \sv@readenv\sv@listing% +} +\def\sv@listing#1#2{% + \sv@startlisting% + \sv@read{#1}\sv@verbline{\endlistinglist#2}% +} +\expandafter\def\csname listing*\endcsname{% + \listinglist% + \listingsize% + \begingroup% + \@noligs% + \def\@tempa##1{\endgroup\sv@listing{##1}{\end{listing*}}}% + \@tempa% +} +\def\sv@ignore#1#2{% + \@bsphack% + \let\do\@makeother\dospecials% + \sv@read{#1}\@gobble{\@esphack#2}% +} +\def\ignore{\sv@readenv\sv@ignore} +\def\ignoreenv#1{% + \expandafter\let\csname #1\endcsname\ignore% +} +\def\unignoreenv#1{% + \expandafter\def\csname #1\endcsname{\endgroup}% + \expandafter\def\csname end#1\endcsname% + {\begingroup\def\@currenvir{#1}}% +} +\newwrite\sv@writefile +\def\sv@write#1#2{% + \begingroup% + \@bsphack% + \let\do\@makeother\dospecials% + \sv@safespc% + \sv@read{#1}\sv@writeline{\sv@endwrite#2}% +} +\def\sv@writeline#1{% + \immediate\write\sv@writefile{#1}% +} +\def\sv@endwrite{% + \@esphack% + \endgroup% +} +\def\verbwrite#1{% + \immediate\openout\sv@writefile#1\relax% + \sv@readenv\sv@write% +} +\def\endverbwrite{\immediate\closeout\sv@writefile} +\expandafter\def\csname verbwrite*\endcsname#1#2{% + \immediate\openout\sv@writefile#2\relax% + \sv@write{#1}{\immediate\closeout\sv@writefile\end{verbwrite*}}% +} +\newcount\sv@nestcount +\def\sv@demoname{demo\number\sv@nestcount.tmp} +\def\sv@demo#1#2{% + \@ifnextchar[{\sv@demo@i{#1}{#2}}{\sv@demo@i{#1}{#2}[n]}% +} +\def\sv@demo@i#1#2[#3]#4{% + \advance\sv@nestcount by\@ne% + \immediate\openout\sv@writefile\sv@demoname\relax% + \sv@write{#1}{% + \immediate\closeout\sv@writefile% + \sv@dodemo{#2}{#3}{#4}% + }% +} +\def\demo{\sv@readenv\sv@demo} +\expandafter\def\csname demo*\endcsname#1{\sv@demo{#1}{\end{demo*}}} +\def\sv@demosmp{% + \begin{minipage}[t]{\@tempdima}% + \vskip8\p@% + \hrule\@height\z@% + \raggedright% + \vbox\bgroup% +} +\def\sv@demoemp{% + \par\unpenalty\unskip% + \egroup% + \vskip8\p@% + \hrule\@height\z@% + \end{minipage}% +} +\def\sv@dodemo#1#2#3{% + \begingroup% + \@tempdima\linewidth% + \advance\@tempdima-2em% + \hsize\@tempdima% + \if#2w% + \advance\@tempdima-2em% + \else% + \advance\@tempdima-3em% + \divide\@tempdima2% + \fi% + \par% + \setbox\z@\hbox{\strut\enspace#3\enspace\strut}% + \@tempdimb.5\dp\z@% + \advance\@tempdimb-.5\ht\z@% + \ht\z@\@tempdimb\dp\z@\@tempdimb% + \noindent\hskip1em\vtop{% + \hb@xt@\hsize{% + \hrulefill% + \raise\@tempdimb\box\z@% + \hrulefill% + }% + \nointerlineskip% + \hb@xt@\hsize{\vrule\@height5\p@\hfil\vrule\@height5\p@}% + \nointerlineskip% + \vskip-\parskip% + \noindent\hbox{}\hskip1em% + \sv@demosmp% + \catcode`\%14\relax% + \input{\sv@demoname}% + \sv@demoemp% + \if#2w% + \vskip8\p@\hrule\vskip8\p@% + \noindent\hbox{}% + \fi% + \hskip1em% + \sv@demosmp% + \listingindent\z@% + \verbinput\sv@demoname% + \sv@demoemp% + \par% + \nointerlineskip% + \hb@xt@\hsize{\vrule\@height5\p@\hfil\vrule\@height5\p@}% + \hrule% + }% + \endgroup% + \par% + \vskip\baselineskip% + #1% +} +\endinput +%% +%% End of file `sverb.sty'. |