blob: 9cf598d474dc2a49abda692e423f29c50a156ab1 (
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 18.3.13, p. III-45.
% Original source in file "tokens1.TEX", starting line 2639.
\wlog{L: "verbdisp.tip" ["tokens1.TEX," l. 2639, p. III-45]}%
% This file DOES belong to format "texip."
\InputD{everypar.tip}
\InputD{futpar.tip}
\InputD{parin.tip}
\InputD{verb-bas.tip}
\InputD{testdef.tip}
\InputD{gobble.tip}
\InputD{loadedla.tip}
\newdimen\LeftSkipVerbatim
\LeftSkipVerbatim = 0.3in
\def\VerbatimFont{\tt}
\newcount\VerbatimTab
\VerbatimTab = 8
\newif\ifVerbLineNum
\VerbLineNumtrue
\newskip\DisplayVerbatimVskip
\DisplayVerbatimVskip = 0pt plus 2pt minus 1pt
\newif\ifCaretTab
\CaretTabfalse
\newtoks\VerbatimTokBegin \VerbatimTokBegin = {}
\newtoks\VerbatimTokLine \VerbatimTokLine = {}
\newtoks\VerbatimTokEnd \VerbatimTokEnd = {}
\catcode`\@ = 11
\newdimen\@VerbatimLr
\@VerbatimLr = 1.5pt
\newif\if@IgnoreFirstNewLine
\if\FormatIsLaTeXConditional
\def\@VerbatimPar{\par\@@par}%
\def\@VerbatimNlf{\tiny}%
\else
\def\@VerbatimPar{\par}%
\def\@VerbatimNlf{\tiny}%
\fi
\newcount\@VerbatimLineNumber
\newif\if@VerbatimL
\newdimen\Verb@TabSize
\def\@VObeySpaces{%
\MakeActive{\ }%
\@@VObeySpaces
}
{%
\MakeActive{\ }%
\gdef\@@VObeySpaces{%
\def {\VerbControlSpace}%
}%
}
\def\@VObeyTabs{%
\MakeTabActive
\@@VObeyTabs
}
{
\MakeTabActive
\gdef\@@VObeyTabs{%
\def^^I{\Verb@Tab}%
}
}
\def\Verb@Tab{%
\leavevmode
\egroup
\dimen0 = \wd0
\divide\dimen0 by \Verb@TabSize
\advance\dimen0 by 1sp
\multiply\dimen0 by \Verb@TabSize
\wd0 = \dimen0
\box0
\setbox 0 = \hbox\bgroup
}
\def\@VObeyEol{%
\MakeEolActive %
\@@VObeyEol
}
{
\MakeEolActive %
\gdef\@@VObeyEol{%
\let^^M = \Verb@Eol%
}%
}
\def\Verb@Eol{%
\if@IgnoreFirstNewLine
\else
\leavevmode
\egroup
\box 0
\endgraf
\fi
\@IgnoreFirstNewLinefalse
}
\def\@VCaret{%
\MakeActive{\^}%
\@@VCaret
}
{
\MakeActive{\^}%
\gdef\@@VCaret{%
\def^{%
\futurelet\@VSymbol\@@VCaretTwo
}%
\def\@@VCaretTwo{%
\ifx \@VSymbol^%
\let\@VerbNext = \@@VCaretThree
\else
\CaretText
\let\@VerbNext = \relax
\fi
\@VerbNext
}%
\def\@@VCaretThree ^{%
\futurelet\@VSymbol\@@VCaretFour
}%
\def\@@VCaretFour{%
\ifx \@VSymbol I%
\Verb@Tab
\else
\CaretText\CaretText\@VSymbol
\fi
\GobbleOne
}%
}%
}
\def\@StartVerbatim #1{%
\begingroup
\@VerbatimPar
\vskip\DisplayVerbatimVskip
\if\FormatIsLaTeXConditional
\else
\CancelSuppressNextParIndent
\fi
\setbox0 = \hbox{\VerbatimFont X}
\Verb@TabSize = \wd0
\multiply\Verb@TabSize by \VerbatimTab
\parskip = 0pt
\parindent = 0pt
\leftskip = \LeftSkipVerbatim
\rightskip = 0pt
\parfillskip = 0pt plus 1fil
\spaceskip = 0pt
\xspaceskip = 0pt
\VerbatimFont
\if@VerbatimL
\else
\global\@VerbatimLineNumber = 0
\fi
\global\@VerbatimLfalse
\ifnum #1 = 0
\@IgnoreFirstNewLinetrue
\else
\@IgnoreFirstNewLinefalse
\fi
\if\FormatIsLaTeXConditional
\everypar = {\EveryParZ}%
\fi
\def\EveryParZ{%
\the\VerbatimTokLine
\global\advance\@VerbatimLineNumber by 1
\ifVerbLineNum
\raise \@VerbatimLr \hbox to 0pt{%
\hss
\@VerbatimNlf
\the\@VerbatimLineNumber
\hskip 10pt
}%
\fi
\setbox 0 = \hbox\bgroup
}%
\MkOthers
\@VObeySpaces
\@VObeyTabs
\@VObeyEol
\ifCaretTab
\@VCaret
\fi
}
\def\@DoneVerbatim{%
\endgroup
\vskip\DisplayVerbatimVskip
\def\@VerbatimEndSpecialDeal{}%
\if\FormatIsLaTeXConditional
\else
\def\@VerbatimEndSpecialDeal{%
\ParLookAhead
{\SuppressNextParIndent}%
{}
}%
\fi
\@VerbatimEndSpecialDeal
}
\def\BeginVerbatim{%
\@StartVerbatim{0}%
\@BeginVerbatim
}
{ \catcode `| = 0 % | becomes escape character.
\catcode`\\ =12 % \ becomes regular character.
|gdef|@BeginVerbatim #1\EndVerbatim{%
#1%
|@DoneVerbatim
}
}
\def\BVerB{%
\@StartVerbatim{0}%
\@BVerB
}
{
\catcode `| = 0 % | becomes escape character.
\catcode`\\ =12 % \ becomes regular character.
|gdef|@BVerB #1\EVerB{%
#1%
|@DoneVerbatim
}
}
\def\AppendVerbatimL #1{%
\global\@VerbatimLtrue
\global\advance\@VerbatimLineNumber by #1\relax
}
\def\StartVerbatimL #1{%
\global\@VerbatimLtrue
\global\@VerbatimLineNumber = #1\relax
}
\newcount\@SaveVerbatimLineNumber
\def\PushVerbatimL{%
\global\@SaveVerbatimLineNumber = \@VerbatimLineNumber
\global\VerbLineNumfalse
}
\def\PopVerbatimL{%
\global\@VerbatimLineNumber = \@SaveVerbatimLineNumber
\global\VerbLineNumtrue
}
\catcode`\@ = 12
|