summaryrefslogtreecommitdiff
path: root/support/mctex/verbatim.tex
blob: 76169743f332ed24b369dbd047fc0b3959633cf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

% macros for verbatim scanning
\chardef\other=12
\def\ttverbatim{\begingroup
\parindent=0pt
\def\par{\leavevmode\endgraf}%leave blank lines alone in verbatim
  \catcode`\\=\other \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
  \catcode`\_=\other \catcode`\^=\other \catcode`\^^A=\other \catcode`\^^K=\other
  \catcode`\^^M=\other\obeyspaces\obeylines\fixspace\tt}
\outer\def\begintt{$$
%\let\par=\endgraf 
\ttverbatim \parskip=\z@
  \catcode`\|=0  \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
\catcode`\|=\active
{\obeylines\gdef|{\ttverbatim\let|=\endgroup}}
{\catcode`\ =\active
\gdef\fixspace{\catcode`\ =\active\def {~}}}