Debian Codegraph @

texmf-dist/tex/plain/js-misc/idverb.tex

raw
1 % $Id: idverb.doc,v 1.1 1995/03/13 23:18:11 schrod Exp $
2 %----------------------------------------------------------------------
3 % Written by Joachim Schrod <[email protected]>.
4 % Copyright conditions see below.
5
6 %
7 % idverb.doc --- typeset identifiers verbatim
8 %
9 % [plain TeX in MAKEPROG]
10 % (history at end)
11
12
13 %%%%
14 %%%%
15 %%%% These TeX macros were documented with the documentation system
16 %%%% MAKEPROG and automatically converted to the current form.
17 %%%% If you have MAKEPROG available you may transform it back to
18 %%%% the original input: Remove every occurence of three percents
19 %%%% and one optional blank from the beginning of a line and remove
20 %%%% every line which starts with four percents. The following lex
21 %%%% program will do this:
22 %%%%
23 %%%% %%
24 %%%%
25 %%%% ^%%%\ ? ;
26 %%%% ^%%%%.*\n ;
27 %%%%
28 %%%% If you just want to print the documentation you may fetch
29 %%%% the archive print-makeprog.tar.Z from ftp.th-darmstadt.de (directory
30 %%%% pub/tex/latex). It contains *all* used styles -- but beware, they
31 %%%% may not be in a documented form...
32 %%%%
33 %%%%
34 %%% \input progdoc
35
36 %%% \input names.sty
37 %%% \def\v{{\tt \vbar\/}}
38
39
40
41 %%% \title{Identifiers Verbatim \`a la {\ttitlefont WEB}}
42
43
44
45 %%% \chap Introduction.
46
47 %%% This macro files allows to write identifiers in a \WEB{} like style,
48 %%% i.e.\ as {\tt \origvert identifier\origvert\/}. The identifiers are
49 %%% typeset verbatim in the monospace type face. The macros
50 %%% |\makevertother| and |\makevertactive| are available to activate and
51 %%% deactivate the special behaviour of the vertical bar.
52
53
54 %%% \sect This macro file uses the namespace |idv|.
55
56 %%% \beginprog
57 \ifx \IdvLoaded\undefined
58 \def\IdvLoaded{$Revision: 1.1 $}
59 \else \endinput \fi % <-- one line!
60 %%% \endprog
61
62
63 %%% \sect These macros are supported. Send bug reports, comments and
64 %%% repairs.
65
66 %%% The reference version may be retrieved via anonymous ftp from
67 %%% |ftp.th-darmstadt.de| [130.83.47.112], directory |pub/tex/plain|. It's
68 %%% placed there as a gzipped tar file. (The information on the
69 %%% IP~number is dated March 13, 1995. It might have changed, also this is very
70 %%% unlikely. Use your friendly nameserver.)
71
72
73 %%% \sect This is freely distributable software; you can redistribute it
74 %%% and/or modify it under the terms of the GNU General Public License as
75 %%% published by the Free Software Foundation; either version~2 of the
76 %%% License, or (at your option) any later version.
77
78 %%% This software is distributed in the hope that it will be useful, but
79 %%% {\bf without any warranty\/}; without even the implied warranty of
80 %%% {\bf merchantability\/} or {\bf fitness for a particular purpose}. See
81 %%% the GNU General Public License for more details.
82
83 %%% You should have received a copy of the GNU General Public License in
84 %%% the file |License| along with this package; if not, write to the Free
85 %%% Software Foundation, Inc., 675~Mass Ave, Cambridge, MA~02139,~USA.
86
87
88 %%% \sect But before we start we declare some shorthands for category
89 %%% codes. By declaring the at sign~(`|@|') as well as the
90 %%% underscore~`(|_|)' as letters we can use them in our macros. (I agree
91 %%% with D.~Knuth that |\identifier_several_words_long| is more readable
92 %%% than |\IdentifierSeveralWordsLong| and in every case better than
93 %%% |\p@@@s|.) With the at sign we can use the ``private'' Plain macros
94 %%% and with the underscore we can make our own macros more readable. But
95 %%% as we have to restore these category codes at the end of this macro
96 %%% file we store their former values in control sequences. This method is
97 %%% better than to use a group because not all macros have to be defined
98 %%% global this way.
99
100 %%% Only the first macro file read in defines the |Cat| cseqs.
101
102 %%% \beginprog
103 \ifx \CatEscape\undefined
104 \chardef\CatEscape=0
105 \chardef\CatOpen=1
106 \chardef\CatClose=2
107 \chardef\CatIgnore=9
108 \chardef\CatLetter=11
109 \chardef\CatOther=12
110 \chardef\CatActive=13 % \active of plain.tex
111 \chardef\CatInvalid=15
112
113 \chardef\CatAtCode=\catcode`\@
114 \chardef\CatUsCode=\catcode`\_
115 \fi
116
117 \catcode`\@=\CatLetter % top level macro file
118 \catcode`\_=\CatLetter
119 %%% \endprog
120
121
122 %%% \sect Let's identify this macro file against the user and in the Log file.
123
124 %%% \beginprog
125 \begingroup
126 \catcode`\$=\CatIgnore
127 \catcode`\:=\CatIgnore
128 \message{Verbatim identifiers, $Revision: 1.1 $}
129 \endgroup
130 %%% \endprog
131
132
133 %%% \sect The usual verbatim macros use |\dospecials| to change the
134 %%% catcode of all special characters. We have to add `\v' to this list.
135 %%% The old meaning is stored in |\idv_OrigDospecials|.
136
137 %%% \beginprog
138 \let\idv_OrigDospecials=\dospecials
139 \begingroup
140 \def\do#1{\noexpand\do\noexpand#1}
141 \xdef\dospecials{\idv_OrigDospecials\do\|}
142 \endgroup
143 \let\idv_dospecials=\dospecials
144
145 \def\makevertactive{\catcode`\|\CatActive \let\dospecials\idv_dospecials}
146 \def\makevertother{\catcode`\|\CatOther \let\dospecials\idv_OrigDospecials}
147
148 \makevertactive
149 %%% \endprog
150
151
152 %%% \sect Now we can define `\v'. This definition is a little bit tricky,
153 %%% as it redefines itself to |\egroup| to close the hbox. But if the hbox
154 %%% is ended, `\v' is restored to its original meaning. |\origvert| is
155 %%% given the original meaning of `\v'. |\vbar| is the character from the
156 %%% current font that has the ASCII code of a vertical bar, sometimes this
157 %%% {\it is\/} a vertical bar.
158
159 %%% \beginprog
160 \let\origvert=|
161 \chardef\vbar=`\|
162
163 \def\idv_setup_verbatim{%
164 \def\do##1{\catcode`##1\CatOther}\idv_OrigDospecials
165 \parskip\z@skip \parindent\z@
166 \obeylines \obeyspaces \frenchspacing
167 \tt
168 }
169
170 \def|{%
171 \leavevmode
172 \hbox\bgroup
173 \let\par\space \idv_setup_verbatim
174 \let|\egroup
175 }
176 %%% \endprog
177
178
179 %%% \sect We are finished;
180 %%% restore the catcodes and prevent from following garbage.
181
182 %%% \beginprog
183 \catcode`\@=\CatAtCode
184 \catcode`\_=\CatUsCode
185
186 \endinput
187 %%% \endprog
188
189
190 %%% %% \sect {\it Acknowledgements:}\quad I would like to thank XXX
191
192
193 %%% \bye
194
195 %%%
196 %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
197 %%% %
198 %%% % $Log: idverb.doc,v $
199 %%% % Revision 1.1 1995/03/13 23:18:11 schrod
200 %%% % Started to manage this package with CVS. Made minor code cleanup.
201 %%% %
202
203 %%% %
204 %%% % Pre-CVS Log:
205 %%% %
206 %%% % 27 Jul 89 js Initial revision.
207
208
209 %%%
210 %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
211 %%% Local Variables:
212 %%% mode: plain-TeX
213 %%% TeX-master: t
214 %%% TeX-brace-indent-level: 4
215 %%% End: