blob: 1a6e8029809a3d01aa7e726c6484a4cc3aae456b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
\lingmkletter @
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% various strategies for typesetting \tt material
\chardef\other=12
\def\allnormal{\catcode`\\=\other \catcode`\{=\other
\catcode`\}=\other \catcode`\$=\other \catcode`\&=\other
\catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
\catcode`\_=\other \catcode`\^=\other}
\def\ttverbatim{\begingroup
\allnormal \obeyspaces\obeylines \tt}
{\obeyspaces\gdef {\ }}
\catcode`\|=\active
\catcode`\¦=\active % for | in \tt territory
\catcode`\»=\active % escape inside | ... |
\catcode`\«=\active % resume
{\obeylines %
\gdef\begintt{\ttverbatim %
\let^^M=\ \let|=\endgroup}%
}
\let|\begintt
\def¦{\char"7C\relax}
\def«{\endgroup \kern1.2pt\bgroup\sl}
\def»{\egroup\kern.4pt\begintt}
{\catcode`\^^M=\active
\gdef\CL{% (codelines)
\par \begingroup \allnormal \tt %
\catcode`^^M=\active \let^^M=\par %
\catcode`\|=0 \obeyspaces \@gobble}%
\gdef\CLboxed{%
\leavevmode\vtop \bgroup \begingroup \allnormal \tt
\catcode`^^M=\active \let^^M=\cr %
\catcode`\|=0 %
\obeyspaces\halign\bgroup ##}%
\gdef\@CLnumbered{%
\catcode`\^^M=\active \let^^M=\specialpar %
\catcode`\|=0 }%
}
\def\endCL{\endgroup}%
\def\endCLboxed{\egroup \endgroup\egroup}%
\newcount\linecount
\def\specialpar{%
\par\leavevmode
\llap{\hbox{\tenrm \hfil\the\linecount
\hskip2ex
\global\advance\linecount by 1}}%
}
\def\CLnumbered{\linecount=1 \morecode}
\def\morecode{%
\smallskip \begingroup
\allnormal\obeyspaces\@CLnumbered\tt
}
\def\endCLnumbered{\endgroup\smallskip}
%
\def\@#1{$^{\>#1}$} % |@ for footnotes inside \CL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\CLframed{%
\medskip
\line\bgroup
\vrule\hss
\vbox\bgroup\leftskip=1em
\hrule
\medskip
\CL\relax}
\def\endCLframed{%
\endCL
\medskip
\hrule
\egroup
\hss\vrule
\egroup
\medskip
}
\lingrestore @
|