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
|
% $Id: idverb.doc,v 1.1 1995/03/13 23:18:11 schrod Exp $
%----------------------------------------------------------------------
% Written by Joachim Schrod <schrod@iti.informatik.th-darmstadt.de>.
% Copyright conditions see below.
%
% idverb.doc --- typeset identifiers verbatim
%
% [plain TeX in MAKEPROG]
% (history at end)
\input progdoc
\input names.sty
\def\v{{\tt \vbar\/}}
\title{Identifiers Verbatim \`a la {\ttitlefont WEB}}
\chap Introduction.
This macro files allows to write identifiers in a \WEB{} like style,
i.e.\ as {\tt \origvert identifier\origvert\/}. The identifiers are
typeset verbatim in the monospace type face. The macros
|\makevertother| and |\makevertactive| are available to activate and
deactivate the special behaviour of the vertical bar.
\sect This macro file uses the namespace |idv|.
\beginprog
\ifx \IdvLoaded\undefined
\def\IdvLoaded{$Revision: 1.1 $}
\else \endinput \fi % <-- one line!
\endprog
\sect These macros are supported. Send bug reports, comments and
repairs.
The reference version may be retrieved via anonymous ftp from
|ftp.th-darmstadt.de| [130.83.47.112], directory |pub/tex/plain|. It's
placed there as a gzipped tar file. (The information on the
IP~number is dated March 13, 1995. It might have changed, also this is very
unlikely. Use your friendly nameserver.)
\sect This is freely distributable software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version~2 of the
License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but
{\bf without any warranty\/}; without even the implied warranty of
{\bf merchantability\/} or {\bf fitness for a particular purpose}. See
the GNU General Public License for more details.
You should have received a copy of the GNU General Public License in
the file |License| along with this package; if not, write to the Free
Software Foundation, Inc., 675~Mass Ave, Cambridge, MA~02139,~USA.
\sect But before we start we declare some shorthands for category
codes. By declaring the at sign~(`|@|') as well as the
underscore~`(|_|)' as letters we can use them in our macros. (I agree
with D.~Knuth that |\identifier_several_words_long| is more readable
than |\IdentifierSeveralWordsLong| and in every case better than
|\p@@@s|.) With the at sign we can use the ``private'' Plain macros
and with the underscore we can make our own macros more readable. But
as we have to restore these category codes at the end of this macro
file we store their former values in control sequences. This method is
better than to use a group because not all macros have to be defined
global this way.
Only the first macro file read in defines the |Cat| cseqs.
\beginprog
\ifx \CatEscape\undefined
\chardef\CatEscape=0
\chardef\CatOpen=1
\chardef\CatClose=2
\chardef\CatIgnore=9
\chardef\CatLetter=11
\chardef\CatOther=12
\chardef\CatActive=13 % \active of plain.tex
\chardef\CatInvalid=15
\chardef\CatAtCode=\catcode`\@
\chardef\CatUsCode=\catcode`\_
\fi
\catcode`\@=\CatLetter % top level macro file
\catcode`\_=\CatLetter
\endprog
\sect Let's identify this macro file against the user and in the Log file.
\beginprog
\begingroup
\catcode`\$=\CatIgnore
\catcode`\:=\CatIgnore
\message{Verbatim identifiers, $Revision: 1.1 $}
\endgroup
\endprog
\sect The usual verbatim macros use |\dospecials| to change the
catcode of all special characters. We have to add `\v' to this list.
The old meaning is stored in |\idv_OrigDospecials|.
\beginprog
\let\idv_OrigDospecials=\dospecials
\begingroup
\def\do#1{\noexpand\do\noexpand#1}
\xdef\dospecials{\idv_OrigDospecials\do\|}
\endgroup
\let\idv_dospecials=\dospecials
\def\makevertactive{\catcode`\|\CatActive \let\dospecials\idv_dospecials}
\def\makevertother{\catcode`\|\CatOther \let\dospecials\idv_OrigDospecials}
\makevertactive
\endprog
\sect Now we can define `\v'. This definition is a little bit tricky,
as it redefines itself to |\egroup| to close the hbox. But if the hbox
is ended, `\v' is restored to its original meaning. |\origvert| is
given the original meaning of `\v'. |\vbar| is the character from the
current font that has the ASCII code of a vertical bar, sometimes this
{\it is\/} a vertical bar.
\beginprog
\let\origvert=|
\chardef\vbar=`\|
\def\idv_setup_verbatim{%
\def\do##1{\catcode`##1\CatOther}\idv_OrigDospecials
\parskip\z@skip \parindent\z@
\obeylines \obeyspaces \frenchspacing
\tt
}
\def|{%
\leavevmode
\hbox\bgroup
\let\par\space \idv_setup_verbatim
\let|\egroup
}
\endprog
\sect We are finished;
restore the catcodes and prevent from following garbage.
\beginprog
\catcode`\@=\CatAtCode
\catcode`\_=\CatUsCode
\endinput
\endprog
%% \sect {\it Acknowledgements:}\quad I would like to thank XXX
\bye
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Log: idverb.doc,v $
% Revision 1.1 1995/03/13 23:18:11 schrod
% Started to manage this package with CVS. Made minor code cleanup.
%
%
% Pre-CVS Log:
%
% 27 Jul 89 js Initial revision.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Local Variables:
mode: plain-TeX
TeX-master: t
TeX-brace-indent-level: 4
End:
|