2 % ****************************************
4 % ****************************************
6 % The slverbatim environment uses the fixed-width \sltt font, turns blanks into
7 % spaces, starts a new line for each carrige return (or sequence of
8 % consecutive carriage returns), and interprets EVERY character literally.
9 % I.e., all special characters \, {, $, etc. are \catcode'd to 'other'.
11 % The command \slverb produces in-line slverbatim text, where the argument
12 % is delimited by any pair of characters. E.g., \slverb #...# takes
13 % '...' as its argument, and sets it slverbatim in \sltt font.
15 % The *-variants of these commands is the same, except that spaces
16 % print as the TeXbook's space character instead of as blank spaces.
18 {\catcode`\^^M=
13 \gdef\@gobblecr
{\@ifnextchar
19 {\@gobble
}{\ignorespaces}}}
21 {\catcode`\ =
\active\gdef\@vobeyspaces
{\catcode`\
\active \let \@xobeysp
}}
23 % Definition of \@xobeysp chaned on 19 Nov 86 from
24 % \def\@xobeysp{\leavevmode{} }
25 % to prevent line breaks at spaces. Change suggested by
28 \def\@xobeysp
{\leavevmode\penalty10000\
}
32 \begingroup \catcode `|=
0 \catcode `
[=
1
33 \catcode`
]=
2 \catcode `\
{=
12 \catcode `\
}=
12
34 \catcode`\\=
12 |gdef|@xslverbatim
#1\end{slverbatim
}[#1|end
[slverbatim
]]
35 |gdef|@sxslverbatim
#1\end{slverbatim*
}[#1|end
[slverbatim*
]]
38 \def\@sslverbatim
{\obeyspaces\@slverbatim
}
42 \def\@slverbatim
{\trivlist \item[]\if@minipage
\else\vskip\parskip\fi
43 \leftskip\@totalleftmargin
\rightskip\z@
44 \parindent\z@
\parfillskip\@flushglue
\parskip\z@
45 \@tempswafalse
\def\par{\if@tempswa
\hbox{}\fi\@tempswatrue\@@par
}
46 \obeylines \sltt \catcode``=
13 \@noligs
\let\do\@makeother
\dospecials}
48 \def\slverbatim{\@slverbatim
\frenchspacing\@vobeyspaces \@xslverbatim
}
49 \let\endslverbatim=
\endtrivlist
51 \@namedef
{slverbatim*
}{\@slverbatim\@sxslverbatim
}
52 \expandafter\let\csname endslverbatim*
\endcsname =
\endtrivlist
55 \def\@makeother
#1{\catcode`
#112\relax}
57 \def\slverb{\begingroup \catcode``=
13 \@noligs
58 \sltt \let\do\@makeother
\dospecials
59 \@ifstar
{\@sslverb
}{\@slverb
}}
61 \def\@sslverb
#1{\def\@tempa #
#1#1{#
#1\endgroup}\@tempa
}
63 \def\@slverb
{\obeyspaces \frenchspacing \@sslverb
}
66 %% \@noligs prevents ?` and !` from being treated as ligatures
72 \gdef\@noligs
{\let`=\@lquote
}
75 \def\@lquote
{{\kern\z@
}`
}