home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fonts 1
/
freshfonts1.bin
/
programs
/
amiga
/
pastex
/
macros
/
misc
/
plain.tex
< prev
next >
Wrap
Text File
|
1991-08-09
|
44KB
|
1,230 lines
% This is the plain TeX format that's described in The TeXbook.
% N.B.: A version number is defined at the very end of this file;
% please change that number whenever the file is modified!
% And don't modify the file under any circumstances.
\catcode`\{=1 % left brace is begin-group character
\catcode`\}=2 % right brace is end-group character
\catcode`\$=3 % dollar sign is math shift
\catcode`\&=4 % ampersand is alignment tab
\catcode`\#=6 % hash mark is macro parameter character
\catcode`\^=7 \catcode`\^^K=7 % circumflex and uparrow are for superscripts
\catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts
\catcode`\^^I=10 % ascii tab is a blank space
\chardef\active=13 \catcode`\~=\active % tilde is active
\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par"
\message{Preloading the plain format: codes,}
% We had to define the \catcodes right away, before the message line,
% since \message uses the { and } characters.
% When INITEX (the TeX initializer) starts up,
% it has defined the following \catcode values:
% \catcode`\^^@=9 % ascii null is ignored
% \catcode`\^^M=5 % ascii return is end-line
% \catcode`\\=0 % backslash is TeX escape character
% \catcode`\%=14 % percent sign is comment character
% \catcode`\ =10 % ascii space is blank space
% \catcode`\^^?=15 % ascii delete is invalid
% \catcode`\A=11 ... \catcode`\Z=11 % uppercase letters
% \catcode`\a=11 ... \catcode`\z=11 % lowercase letters
% all others are type 12 (other)
% Here is a list of the characters that have been specially catcoded:
\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
\do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
% (not counting ascii null, tab, linefeed, formfeed, return, delete)
% Each symbol in the list is preceded by \do, which can be defined
% if you want to do something to every item in the list.
% We make @ signs act like letters, temporarily, to avoid conflict
% between user names and internal control sequences of plain format.
\catcode`@=11
% INITEX sets up \mathcode x=x, for x=0..255, except that
% \mathcode x=x+"7100, for x = `A to `Z and `a to `z;
% \mathcode x=x+"7000, for x = `0 to `9.
% The following changes define internal codes as recommended
% in Appendix C of The TeXbook:
\mathcode`\^^@="2201 % \cdot
\mathcode`\^^A="3223 % \downarrow
\mathcode`\^^B="010B % \alpha
\mathcode`\^^C="010C % \beta
\mathcode`\^^D="225E % \land
\mathcode`\^^E="023A % \lnot
\mathcode`\^^F="3232 % \in
\mathcode`\^^G="0119 % \pi
\mathcode`\^^H="0115 % \lambda
\mathcode`\^^I="010D % \gamma
\mathcode`\^^J="010E % \delta
\mathcode`\^^K="3222 % \uparrow
\mathcode`\^^L="2206 % \pm
\mathcode`\^^M="2208 % \oplus
\mathcode`\^^N="0231 % \infty
\mathcode`\^^O="0140 % \partial
\mathcode`\^^P="321A % \subset
\mathcode`\^^Q="321B % \supset
\mathcode`\^^R="225C % \cap
\mathcode`\^^S="225B % \cup
\mathcode`\^^T="0238 % \forall
\mathcode`\^^U="0239 % \exists
\mathcode`\^^V="220A % \otimes
\mathcode`\^^W="3224 % \leftrightarrow
\mathcode`\^^X="3220 % \leftarrow
\mathcode`\^^Y="3221 % \rightarrow
\mathcode`\^^Z="8000 % \ne
\mathcode`\^^[="2205 % \diamond
\mathcode`\^^\="3214 % \le
\mathcode`\^^]="3215 % \ge
\mathcode`\^^^="3211 % \equiv
\mathcode`\^^_="225F % \lor
\mathcode`\ ="8000 % \space
\mathcode`\!="5021
\mathcode`\'="8000 % ^\prime
\mathcode`\(="4028
\mathcode`\)="5029
\mathcode`\*="2203 % \ast
\mathcode`\+="202B
\mathcode`\,="613B
\mathcode`\-="2200
\mathcode`\.="013A
\mathcode`\/="013D
\mathcode`\:="303A
\mathcode`\;="603B
\mathcode`\<="313C
\mathcode`\=="303D
\mathcode`\>="313E
\mathcode`\?="503F
\mathcode`\[="405B
\mathcode`\\="026E % \backslash
\mathcode`\]="505D
\mathcode`\_="8000 % \_
\mathcode`\{="4266
\mathcode`\|="026A
\mathcode`\}="5267
\mathcode`\^^?="1273 % \smallint
% INITEX sets \uccode`x=`X and \uccode `X=`X for all letters x,
% and \lccode`x=`x, \lccode`X=`x; all other values are zero.
% No changes to those tables are needed in plain TeX format.
% INITEX sets \sfcode x=1000 for all x, except that \sfcode`X=999
% for uppercase letters. The following changes are needed:
\sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
% The \nonfrenchspacing macro will make further changes to \sfcode values.
% Finally, INITEX sets all \delcode values to -1, except \delcode`.=0
\delcode`\(="028300
\delcode`\)="029301
\delcode`\[="05B302
\delcode`\]="05D303
\delcode`\<="26830A
\delcode`\>="26930B
\delcode`\/="02F30E
\delcode`\|="26A30C
\delcode`\\="26E30F
% N.B. { and } should NOT get delcodes; otherwise parameter grouping fails!
% To make the plain macros more efficient in time and space,
% several constant values are declared here as control sequences.
% If they were changed, anything could happen; so they are private symbols.
\chardef\@ne=1
\chardef\tw@=2
\chardef\thr@@=3
\chardef\sixt@@n=16
\chardef\@cclv=255
\mathchardef\@cclvi=256
\mathchardef\@m=1000
\mathchardef\@M=10000
\mathchardef\@MM=20000
% Allocation of registers
% Here are macros for the automatic allocation of \count, \box, \dimen,
% \skip, \muskip, and \toks registers, as well as \read and \write
% stream numbers, \fam codes, \language codes, and \insert numbers.
\message{registers,}
% When a register is used only temporarily, it need not be allocated;
% grouping can be used, making the value previously in the register return
% after the close of the group. The main use of these macros is for
% registers that are defined by one macro and used by others, possibly at
% different nesting levels. All such registers should be defined through
% these macros; otherwise conflicts may occur, especially when two or more
% more macro packages are being used at once.
% The following counters are reserved:
% 0 to 9 page numbering
% 10 count allocation
% 11 dimen allocation
% 12 skip allocation
% 13 muskip allocation
% 14 box allocation
% 15 toks allocation
% 16 read file allocation
% 17 write file allocation
% 18 math family allocation
% 19 language allocation
% 20 insert allocation
% 21 the most recently allocated number
% 22 constant -1
% New counters are allocated starting with 23, 24, etc. Other registers are
% allocated starting with 10. This leaves 0 through 9 for the user to play
% with safely, except that counts 0 to 9 are considered to be the page and
% subpage numbers (since they are displayed during output). In this scheme,
% \count 10 always contains the number of the highest-numbered counter that
% has been allocated, \count 14 the highest-numbered box, etc.
% Inserts are given numbers 254, 253, etc., since they require a \count,
% \dimen, \skip, and \box all with the same number; \count 20 contains the
% lowest-numbered insert that has been allocated. Of course, \box255 is
% reserved for \output; \count255, \dimen255, and \skip255 can be used freely.
% It is recommended that macro designers always use
% \global assignments with respect to registers numbered 1, 3, 5, 7, 9, and
% always non-\global assignments with respect to registers 0, 2, 4, 6, 8, 255.
% This will prevent ``save stack buildup'' that might otherwise occur.
\count10=22 % allocates \count registers 23, 24, ...
\count11=9 % allocates \dimen registers 10, 11, ...
\count12=9 % allocates \skip registers 10, 11, ...
\count13=9 % allocates \muskip registers 10, 11, ...
\count14=9 % allocates \box registers 10, 11, ...
\count15=9 % allocates \toks registers 10, 11, ...
\count16=-1 % allocates input streams 0, 1, ...
\count17=-1 % allocates output streams 0, 1, ...
\count18=3 % allocates math families 4, 5, ...
\count19=0 % allocates \language codes 1, 2, ...
\count20=255 % allocates insertions 254, 253, ...
\countdef\insc@unt=20 % the insertion counter
\countdef\allocationnumber=21 % the most recent allocation
\countdef\m@ne=22 \m@ne=-1 % a handy constant
\def\wlog{\immediate\write\m@ne} % write on log file (only)
% Here are abbreviations for the names of scratch registers
% that don't need to be allocated.
\countdef\count@=255
\dimendef\dimen@=0
\dimendef\dimen@i=1 % global only
\dimendef\dimen@ii=2
\skipdef\skip@=0
\toksdef\toks@=0
% Now, we define \newcount, \newbox, etc. so that you can say \newcoun