% MAKE FORM LETTER for multiple receivers via % plain TeX, LaTeX 2.09 or LaTeX2e % % written by Zhuhan JIANG % University of Western Sydney % Parramatta NSW 2150. % Email: z.jiang@uws.edu.au % % FILENAME: formlett.sty % VERSION: 2.3 May 2003 % COPYRIGHT: GNU convention preferred. % % % NEW COMMANDS % \paras \blockparas \addressparas \PAGENO \NOPAGENUMBERS % \paradefaults \loaddefaultparas \delparadefaults \paranames % \showparas \preview \previewtrue \previewfalse \existfile % \localparastrue \localparasfalse \nodefaultstrue \nodefaultsfalse % \beginpilemode \endpilemode \delimiters \defaultmarks \blockmarks % \beginblockmode \endblockmode \beginlinemode \endlinemode % \beginrawblockmode \endrawblockmode \beginrawlinemode \endrawlinemode % \beginletter \endletter \moreletter \inputletter \inputfile % \boxmore \textbox \addressbox \ADDRESSBOX \fillzeros % \beginlist \endlist \beginrawlist \endrawlist \printfile % \begincomment \endcomment \begincolumns \endcolumns \readstyles % \beginlabels \endlables \smooth \initstyle \initclass \labelsquit % \firstread \beginfile \endfile \checkparas \ifemptyparas \cachedata % \newarray \delarray \readarray \checkARRAYNAME \ifemptydata % % % NOTE % You only need to know a SMALL portion of the above commands % in order to use the style file: easy to use is our key purpose! % % % VERSION HISTORY: % 1.0 8/93 % 1.2 10/93 major rewriting, only basic mode still % compatible with 1.0; % support for raw text list added % 1.3 fixed a minor bug of 1.2; % support for commenting out letters added % 2.0 11/93 compatible with 1.2, 1.3; % labels utility added; support for fixed number % of parameter lines added % 2.03 2/94 TAB char represents 8 spaces instead of 4; % fixed a bug on multi-columns output % 2.1 1/95 added parameter checker and dynamic array facilities; % compatible with LaTeX2e; % slight name changes: \figbox -->\textbox % 2.2 1/95 renamed an internal command (\array) to avoid % conflict with LaTex. % 2.3 5/2003 separated programmer's manual from the style file, % added a new user manual. % % % %SIMPLE EXAMPLE in Plain TeX: % % \input formlett.sty % \beginletter \pageno=1 % \paras--\paras[2]--\paras[3]\par % \paras[1][2] -- \paras[2][2] -- \paras[4][4] -- \paras[][2] % \vfill\eject % \endletter % \preview % \moreletter % first letter % 1-ONE;;;1-FOUR+% % 2-ONE;2-TWO;2-THREE;++;;;4-FOUR! % % \moreletter % second letter % 1-one;1-two;1-three;1-four % +2-one;;2-three; ++ ;;;4-four! % \end % % % %TYPICAL EXAMPLE in LaTeX % % \documentstyle[formlett]{article} % \textwidth=3.2in % \begin{document} % % \beginletter % \paranames % optional % \tt<>;% % \tt<>;% % +\tt<>;% % \tt<>;% % \tt<>! % \loaddefaultparas % optional % % \NOPAGENUMBERS\parindent=0pt % \noindent{\it\paras[1]}\par % \blockparas[2]\par\bigskip % % Dear \paras[1][2],\par\medskip % We have been looking for % \paras[2][2] for quite a while % without any luck, could you help % us out? If so, please ring % \paras[3][2]. \par\medskip % Cheers!\hfill Michael\vfill\eject % \endletter % \preview \showparas % % \paradefaults % optional % To whom this may concern % +Sir or Madam;something;% % 061-225-9905! % % % %\beginlabels % optional % % uncomment the above line and its matching % % \endlabels later on, if you want to get the % % mailing labels. % % So one LaTeX run to get all the letters, and % % an EXTRA run to produce all the labels by % % activating \beginlabels % % % \blockmarks % \beginblockmode % % Mrs L Stenson % \#1-20 Sunset Street % Hillside, Norway % ------ separate groups % Louise % a Bible % 220-8888 % ========= separate cluster % % ...... force entry next line % % Above empty line active % % \endblockmode comment ignored % % \defaultmarks % \moreletter % S Wales,;% % \addressbox[2in][1em]{% % University of Manchester Institute % of Science and Technology, This is % a long address line: it will be % wrapped up automatically.}% % +;a \TeX\ package \gstr\ manual and % many more (\cstr)! % % \beginlinemode % Z Jiang % UNE, Arimdale % % T Ribbons % UMIST, Manchester % \endlinemode % % \beginpilemode % % C Anderson;42nd Street;USA+Christine;your service invoice! % % D Holmes;Flat \#2, Finneybank Rd;London+David;the tax receipt;% % 071-902 7799! % % \endpilemode % % %\endlabels % % uncomment the above line and if its matching % % \beginlabels is set previously for labels % % % \begincomment{} % this is only a tip % % Comment out the letters that you already sent % % \moreletter parameters for letter one! % \moreletter letter two! % % \endcomment % % \end{document} % % %%%%% To run the above examples, remove the first '%' character in each line % % % % %BEGINMACROS % % \ifx\ENDINPUT\undefined\else\message{skipped}\endinput\fi % \message{2.3 <26/5/2003>}% % {\catcode`\@=11\relax \def\temp@macro{\space\space\space\space}% \wlog{\temp@macro FORMLETT version 2.3 May 2003 By Z Jiang}% \wlog{\temp@macro University of Western Sydney, Australia}% \wlog{\temp@macro Email: z.jiang@uws.edu.au}}% % % SAVE @'s STATUS % \xdef\EntryFormLett{\the\catcode`\@}\catcode`\@=11\relax \gdef\MAX@CHR@CODE{255}% maximum charcode for saving catcode % % change it to 127 for TeX 2 % % may change it to 0 if no raw mode is to be used % IS LATEX ? % \newif\ifISLATEX \ifx\pageno\undefined@\global\ISLATEXtrue\else\global\ISLATEXfalse\fi % % a private \l@@p \def\l@@p#1\repe@t{\def\b@dy{#1}\iter@te}% \def\iter@te{\b@dy\let\n@xt=\iter@te \else\let\n@xt=\relax\fi \n@xt}% \let\repe@t=\fi % % % NEW MEASURES etc % \def\new@measures{% \def\temp@@macro##1##2##3{\expandafter\ifx\csname ##3temp##2##1\endcsname \relax\edef\next{\noexpand\csname new##1\noexpand\endcsname \csname ##3temp##2##1\endcsname}% \else\let\next\relax\fi\next}% \def\temp@macro##1{% \temp@@macro{##1}{@}{}\temp@@macro{##1}{@@}{}\temp@@macro{##1}{@@@}{}}% \temp@macro{count}\temp@macro{toks}\temp@macro{box}\temp@macro{read}% \temp@@macro{if}{@}{if}\temp@@macro{if}{@@}{if}\temp@@macro{if}{@@@}{if}% \def\temp@@macro##1{\expandafter\ifx\csname temp##1dim\endcsname \relax\edef\next{\noexpand\csname newdimen\noexpand\endcsname \csname temp##1dim\endcsname}% \else\let\next\relax\fi\next}% \temp@@macro{@}\temp@@macro{@@}\temp@@macro{@@@}% }% \let\temp@@@macro=\wlog\def\wlog#1{}\new@measures % % %%% GENERAL STACK % \def\make@STKcount{\csname newcount\endcsname \STKcount\global\STKcount=0\relax}% \ifx\STKcount\undefined@ \def\next{\make@STKcount}\else\def\next{}\fi \next % ensures stack pointer not flushed if this piece of code % is loaded again % \long\def\push#1{\global\advance\STKcount1\relax \expandafter\gdef\csname STK\the\STKcount\string~\endcsname{#1}}% % \def\popnil{\expandafter\let\expandafter\temp@macro \csname STK\the\STKcount\string~\endcsname \ifnum\STKcount>0\global\expandafter\let \csname STK\the\STKcount\string~\endcsname=\undefined@ \global\advance\STKcount-1% \else \def\temp@macro{}\global\STKcount=0% \fi\relax % \temp@macro for pop }% % \def\pop{\popnil\temp@macro}% % % %% GET PARAMETERS % \long\def\get@nepara[#1][#2]{{\def\next@{#2}% \ifx\next@\empty\push{#1}\else\push{#2}\fi}\ag@in}% % \long\def\get@para\left@#1\right@{% \def\check@{% \ifx[\next@ \def\full@####1{\get@nepara[#1]####1}% \else \def\full@{\get@nepara[#1][#1]}\fi \full@}% \futurelet\next@\check@}% % \long\def\do@nepara\left@#1\right@#2\p@r@end{% \gdef\p@r@data{#2}\global\advance\p@r@count1\get@para\left@#1\right@}% % \def\ag@in{\ifx\p@r@data\empty \def\next@{\relax \getp@r@s\run@CMD}\else \def\next@{\expandafter\do@nepara\p@r@data\p@r@end}\fi \next@}% % \def\run@CMD{\csname STK\the\STKcount\string~\endcsname}% % \newcount\p@r@count \long\def\st@ckparas#1\p@r@end{% \global\p@r@count=0\gdef\p@r@data{#1}\ag@in}% % % % PARAMETER ASSIGNMENT % %% \newcount\temp@count \newtoks\p@r@one \newtoks\p@r@two \newtoks\p@r@three \newtoks\p@r@four \newtoks\p@r@five \newtoks\p@r@six \newtoks\p@r@seven \newtoks\p@r@eight \newtoks\p@r@nine \def\getp@r@s{\temp@count=\p@r@count {\loop \ifnum\temp@count>0 % \expandafter\let\expandafter \temp@macro\csname STK\the\STKcount\string~\endcsname \ifcase\temp@count \or \global\p@r@one=\expandafter{\temp@macro}% \or \global\p@r@two=\expandafter{\temp@macro}% \or \global\p@r@three=\expandafter{\temp@macro}% \or \global\p@r@four=\expandafter{\temp@macro}% \or \global\p@r@five=\expandafter{\temp@macro}% \or \global\p@r@six=\expandafter{\temp@macro}% \or \global\p@r@seven=\expandafter{\temp@macro}% \or \global\p@r@eight=\expandafter{\temp@macro}% \or \global\p@r@nine=\expandafter{\temp@macro}% \else \errmessage{Parameter capacity exceeded.}% % this should never happen: TeX's max para no. is 9 \fi \global\expandafter\let \csname STK\the\STKcount\string~\endcsname=\undefined@% \global\advance\STKcount-1% \global\advance\temp@count-1\relax \fi \ifnum\temp@count>0 % \repeat}}% % \def\clrp@r@s{%GLOBALLY clear \global\p@r@one={}\global\p@r@two={}\global\p@r@three={}% \global\p@r@four={}\global\p@r@five={}\global\p@r@six={}% \global\p@r@seven={}\global\p@r@eight={}\global\p@r@nine={}}% % The above is the minimum for setting default parametrisation % % % ARRAY STRUCTURE % % \newarray\ARRAYNAME % \delarray\ARRAYNAME % % \ARRAYNAME(A1,..,An)={T} % \readarray{ARRAYNAME}{ B1 & B2 & ... & Bm } % \dataheight % % \data(A1,...,An)=\data( A1 + (A2-1)*\dataheight + % ... + (An-1)*\dataheight^{n-1} ) % if \normalindextrue % =\data( An + (An-1 -1)*\dataheight + % ... + (A1)*\dataheight^{n-1} ) % if \normalindexfalse % % \checkARRAYNAME(A1,..,An) % \ifemptydata valid when \checkARRAYNAME is just executed % \cachedata: keeps the data of \ARRAYNAME(m) % when \checkARRAYNAME(m) is executed % % e.g. % % \newarray\Table % \readarray{Table}{one&two& \unknownmacro && &six} % \Table(7)={seven} % \dataheight=0 % or 1 or < 0 % \Table(7) = \Table(2,6,1) % 7=1+(2-1)+(6-1)+(1-1) % \normalindexfalse % \dataheight=3 % \Table(7) = \Table(1,7) = \Table(3,1) % \normalindextrue % \Table(7) = \Table(7,1) = \Table(1,3) % % \checkTable(4) \ifemptydata (4)=empty \fi % \checkTable(5) \ifemptydata\else (5)=nonempty \fi % \ifx\cachedata\space ={\tt }\fi % \checkTable(1000) \ifemptydata (1000)=empty \fi % % \delarray\Table % % \xdef\EntryArrayJob{\the\catcode`\@}\catcode`\@=11\relax \newif\ifemptydata \newcount\dataheight \newif\ifnormalindex \normalindexfalse % \newcount\array@width \newcount\index@count \newcount\index@total \newif\ifone@VEC \newif\if@rev@index % \newtoks\temp@toks \newcount\temp@count % \newcount\temp@@count \newcount\temp@@@count % \long\def\assign@VEC#1(#2)=#3{\temp@count=#2 \relax \get@max@count{total@#1}\temp@count \expandafter\gdef\csname#1#2\string~\endcsname{#3}} \def\get@VEC#1(#2){\csname#1#2\string~\endcsname} \def\clrarr@y#1(#2){% \global\expandafter\let\csname#1#2\string~\endcsname=\undefined@} % \def\testarr@y#1(#2){% \expandafter\let\expandafter\temp@macro\csname#1#2\string~\endcsname \ifx\temp@macro\relax \def\temp@macro{}\fi}% % \def\arr@y#1(#2){\def\check@VEC{% \ifx=\next@VEC \def\full@VEC####1{\assign@VEC#1(#2)####1}% \else \def\full@VEC{\get@VEC#1(#2)}\fi \full@VEC}%check@VEC \futurelet\next@VEC\check@VEC} % \def\get@index(#1)#2\safty@mark{\one@VEC#2,\safty@mark \def\next@@VEC{#1}\ifx\next@@VEC\empty\def\next@@VEC{\array@width}\fi \if@rev@index {\temp@count=1 \advance\index@count1 \relax \ifnum\index@count<\index@total \loop \multiply\temp@count \next@@VEC \advance\index@count-1 \relax \ifnum\index@count>0 \repeat \fi \global\temp@@count\temp@count }% \else \multiply\temp@@count \next@@VEC \fi \ifnum\temp@@count=0 \temp@@count=1 \relax \fi \advance\temp@count-1 \ifnum\temp@count<0 \temp@count=0 \fi \multiply\temp@count \temp@@count \advance\temp@@@count by \temp@count \advance\index@count1 \ifone@VEC \def\next@@VEC{\index@total=\index@count \advance\temp@@@count1 }% \else \one@VEC#2\safty@mark \edef\next@@VEC{\noexpand\get@index(#1)% \the\temp@toks\noexpand\safty@mark}% \fi \next@@VEC}% % \def\one@VEC#1,#2\safty@mark{\def\temp@macro{#2}\temp@toks={#2}% \ifx\temp@macro\empty \one@VECtrue \else \one@VECfalse \fi \temp@count=#1 \relax }% % \def\get@all@index(#1)#2\safty@mark{% \temp@@@count=0 \temp@@count=0 \index@count=0 \@rev@indexfalse \get@index(#1)#2\safty@mark \ifnormalindex\else \temp@@@count=0 \temp@@count=0 \index@count=0 \@rev@indextrue \get@index(#1)#2\safty@mark \fi }% % \def\read@array[#1]#2#3{\temp@count=1 \def\one@item##1#1##2\safty@mark{\def\temp@macro{##2}\temp@toks={##2}% \ifx\temp@macro\empty\else \def\temp@macro{\one@item##2\safty@mark}\fi {\temp@toks={##1}\def\temp@@macro{\arr@y{#2}(\the\temp@count)=}% \expandafter\temp@@macro\expandafter{\the\temp@toks}}% \expandafter\edef\csname total@#2\endcsname{\the\temp@count}% \advance\temp@count1 \temp@macro}% \one@item#3#1\safty@mark }% % \def\strip@esc#1{\temp@count=\escapechar \escapechar=-1 % \temp@toks=\expandafter{\string#1}\escapechar\temp@count} \def\get@max@count#1#2{\edef\temp@macro{\csname #1\endcsname}% \ifnum\temp@macro<#2 \expandafter\xdef\csname #1\endcsname{\the#2}\fi}% % \def\newarray#1{\strip@esc{#1}% \expandafter\gdef\csname total@\the\temp@toks\endcsname{0}% \expandafter\edef\csname\the\temp@toks\endcsname(##1)% {\noexpand\get@all@index(\noexpand\dataheight)##1\noexpand\safty@mark % \noexpand\get@max@count{total@\the\temp@toks}\noexpand\temp@@@count \noexpand\arr@y{\the\temp@toks}(\noexpand\the\noexpand\temp@@@count)}% \expandafter\edef\csname check\the\temp@toks\endcsname(##1)% {\noexpand\get@all@index(\noexpand\dataheight)##1\noexpand\safty@mark \noexpand\testarr@y{\the\temp@toks}(\noexpand\the \noexpand\temp@@@count)\noexpand\let\noexpand\cachedata \noexpand\temp@macro\noexpand\ifx\noexpand\temp@macro\noexpand\empty \noexpand\emptydatatrue\noexpand\else\noexpand\emptydatafalse \noexpand\fi}}% % \def\delarray#1{\strip@esc{#1}% delete array globally \temp@count=0 \temp@@count=\csname total@\the\temp@toks\endcsname \loop \expandafter\global\expandafter\let \csname\the\temp@toks\string~\endcsname\undefined@ \advance\temp@count1 % \ifnum\temp@count<\temp@@count \repeat % global loop for less memory \global\expandafter\let\csname total@\the\temp@toks\endcsname\undefined@ \global\expandafter\let\csname \the\temp@toks\endcsname\undefined@ \global\expandafter\let\csname check\the\temp@toks\endcsname\undefined@ }% % \def\readarray#1#2{\read@array[&]{#1}{#2}}% % \catcode`\@=\EntryArrayJob\relax % % % EXIST FILE ? % % \temp@iftrue if the file #1 exist when tested via \existfile{#1}% % \newread\temp@read \def\existfile#1{\temp@iftrue \openin\temp@read=#1\relax \ifeof\temp@read \temp@iffalse \fi \closein\temp@read}% % % RAW CHARACTERS % \def\raw@chars[#1][#2][#3][#4][#5]{% % #1=11, #2=\`=12, #3=^^I=10, #4=char32=10, #5=^^M=5 % all chars of catcode 11 or 12 are NOT changed \temp@count=-1\relax % \l@@p \advance\temp@count1\relax % \temp@@count=\the\catcode\temp@count \relax \ifnum\temp@@count=11 \else \ifnum\temp@@count=12 \else \catcode\temp@count=11\relax \fi\fi \ifnum\temp@count<\MAX@CHR@CODE\repe@t % \catcode`\%=#1\catcode`\^=#1\catcode`\_=#1% \catcode`\&=#1\catcode`\$=#1\catcode`\#=#1% \catcode`\{=#1\catcode`\}=#1\catcode`\@=#1% \catcode`\~=#1\catcode`\\=#1% \catcode`\`=#2\catcode`\^^I=#3\catcode`\ =#4% \catcode`\^^M=#5\relax % }% % \chardef\temp@char=`\`\catcode`\`=13\relax \def\rm@ligature{\def`{\null\string`}}% \catcode\temp@char=12\relax % \catcode`\^^I=13\relax% \def\set@tab{\def^^I{\ \ \ \ \ \ \ \ }}\catcode`\^^I=10\relax% \catcode`\^^M=13\relax\def\set@cr{\def^^M{\par}}\catcode`\^^M=5\relax% \catcode`\ =13\relax\def\set@space{\def {\ }}\catcode`\ =10\relax% % % TEST EMPTY LINE % \catcode`\ =13\relax% space active % % Delete leading spaces (catcode=13) % Throw the rest to \temp@macro \long\def\del@truespaces#1#2\s@fetymark{\temp@iffalse% \def\temp@macro{#1}\def\one@space{ }\def\temp@@macro{}% \ifx\temp@macro\one@space% front spaces not allowed \def\temp@macro{#2}% \ifx\temp@macro\empty\temp@iftrue% \else\def\temp@@macro{\del@truespaces#2\s@fetymark}\fi% \fi% \temp@@macro}% % \catcode`\ =10\relax% % % \temp@iftrue if empty line, % \temp@macro holds nonspace part (space catcode=13 or normal) \long\def\is@emptyline#1{\def\one@space{ }% \def\temp@macro{#1}\def\temp@@macro{}\temp@iftrue \ifx\temp@macro\empty \else \ifx\temp@macro\one@space \else \def\temp@@macro{\del@truespaces#1\s@fetymark}% \fi \fi \temp@@macro}% % % TEST STRING % %% \newif\iftemp@if \newtoks\temp@toks % return \iftemp@iftrue if yes, % \first@half,\second@half are global \long\def\test@str#1#2{% \long\def\strip@endmark##1\s@fetymarkI#1\s@fetymark{% \gdef\second@half{##1}}% \long\def\strip@markI##1\s@fetymarkI\s@fetymark{% \gdef\first@half{##1}}% \long\def\p@rse##1#1##2\s@fetymark{% \gdef\first@half{##1}% \gdef\second@half{##2}% \ifx\second@half\empty \strip@markI##1\s@fetymark \temp@iffalse \else \strip@endmark##2\s@fetymark \temp@iftrue \fi}% \temp@toks={#2\s@fetymarkI#1\s@fetymark}% \expandafter\p@rse\the\temp@toks }% % % #1 supposed to a toks register \long\def\test@tokstr#1#2{% #1 =toks \temp@toks={#2}% \edef\temp@macro{\noexpand\test@str{#1}{\the\temp@toks}}% \temp@macro }% % % MAKE ESCAPE CHAR % % \esc@=the character '\' of catcode 11 \newtoks\name@endtoks \newtoks\true@endtoks \catcode`\*=0\relax *catcode`*\=11*relax *gdef*esc@{\}%*name@endtoks={\endrawlist}% *catcode`*\=0*relax \catcode`\*=12\relax % % % TWO DIMENSIONAL ARRAY / LETTER PARAMETER STACKS % \def\stack@num@twodim[#1]{\temp@count=-1% \expandafter\ifx\csname #1*0\string~\endcsname\undefined@ \temp@count=0\fi \expandafter\ifx\csname #1*0\string~\endcsname\relax \temp@count=0\fi \relax \ifnum\temp@count<0 \temp@count=\csname #1*0\string~\endcsname \relax \else \expandafter\gdef \csname #1*0\string~\endcsname{0}% \fi }% % % \newcount\R@Wcount \R@Wcount=0 \newcount\R@Dcount \R@Dcount=0 \newif\ifload@defaults \load@defaultsfalse % i.e. to LET stack (not DEF) % \long\def\rowpush#1{% \ifload@defaults % for default para stack \ifnum\R@Dcount>0\else \global\R@Dcount=1 \fi \stack@num@twodim[DEF\the\R@Dcount]% \advance\temp@count1\relax \expandafter\gdef \csname DEF\the\R@Dcount*\the\temp@count\string~\endcsname{#1}% \expandafter\xdef\csname DEF\the\R@Dcount*0\string~\endcsname {\the\temp@count}% \else \ifnum\R@Wcount>0\else \global\R@Wcount=1 \fi \stack@num@twodim[LET\the\R@Wcount]% \advance\temp@count1\relax \expandafter\gdef \csname LET\the\R@Wcount*\the\temp@count\string~\endcsname{#1}% \expandafter\xdef\csname LET\the\R@Wcount*0\string~\endcsname {\the\temp@count}% \fi }% % \def\clr@row{% \ifload@defaults % for default para stack \stack@num@twodim[DEF\the\R@Dcount]% {\loop \ifnum\temp@count>0\relax \global\expandafter\let \csname DEF\the\R@Dcount*\the\temp@count\string~\endcsname=\undefined@% \advance\temp@count-1\relax \fi \ifnum\temp@count>0 \repeat}% \global\expandafter\let \csname DEF\the\R@Dcount*0\string~\endcsname=\undefined@ \else \stack@num@twodim[LET\the\R@Wcount]% {\loop \ifnum\temp@count>0\relax \global\expandafter\let \csname LET\the\R@Wcount*\the\temp@count\string~\endcsname=\undefined@% \advance\temp@count-1\relax \fi \ifnum\temp@count>0 \repeat}% \global\expandafter\let \csname LET\the\R@Wcount*0\string~\endcsname=\undefined@ \fi }% % \def\clr@allrows{% \ifload@defaults % for default para stack {\loop \ifnum\R@Dcount>0\relax {\clr@row}% \global\advance\R@Dcount-1\relax \fi \ifnum\R@Dcount>0 \repeat}% \global\R@Dcount=0\relax \else {\loop \ifnum\R@Wcount>0\relax {\clr@row}% \global\advance\R@Wcount-1\relax \fi \ifnum\R@Wcount>0 \repeat}% \global\R@Wcount=0\relax \fi }% % % LOAD DEFAULT % update paras in LET array with defaults in DEF array % % \newtoks\temp@toks \newif\ifnodefaults \nodefaultsfalse \def\sub@loop{% \sub@loop is always called via {\sub@loop} \loop % inner loop: reverse order \temp@@count=0 % flag -> not counter: 0=no need for updating \expandafter\ifx\csname LET\the\temp@@@count*\the\temp@count \string~\endcsname\undefined@ \temp@@count=1\fi \expandafter\ifx\csname LET\the\temp@@@count*\the\temp@count \string~\endcsname\relax \temp@@count=1\fi\relax % \expandafter\ifx\csname LET\the\temp@@@count*\the\temp@count \string~\endcsname\trivi@l \temp@@count=1\fi\relax % \ifnum\temp@@count>0 \expandafter\let\expandafter\temp@macro \csname DEF\the\temp@@@count*\the\temp@count\string~\endcsname \temp@toks=\expandafter{\temp@macro}% \ifx\temp@macro\relax \global\expandafter\let \csname LET\the\temp@@@count*\the\temp@count\string~\endcsname =\undefined@ \else \expandafter\xdef \csname LET\the\temp@@@count*\the\temp@count\string~\endcsname {\the\temp@toks}\fi \fi \advance\temp@count-1\relax \ifnum\temp@count>0 \repeat}% for speed % % above macro not to stand alone % it is removed from \loaddefaultparas for better speed % \def\loaddefaultparas{% \ifnodefaults\else % active only if \nodefaultsfalse \def\trivi@l{\b@group\relax\e@group}% == empty parameter \temp@count=\R@Wcount {\loop % legalise LET array's extension \advance\temp@count1\relax \ifnum\temp@count>\R@Dcount\else \expandafter\xdef \csname LET\the\temp@count*0\string~\endcsname{0}\fi \ifnum\temp@count<\R@Dcount \repeat}% \ifnum\R@Wcount<\R@Dcount \global\R@Wcount=\R@Dcount \fi % \temp@@@count=1 % row counter {\loop \stack@num@twodim[DEF\the\temp@@@count]% \temp@@count=\temp@count\relax \stack@num@twodim[LET\the\temp@@@count]% \ifnum\temp@count<\temp@@count \temp@count=\temp@@count\relax \fi % update LET array's counter \expandafter\xdef \csname LET\the\temp@@@count*0\string~\endcsname{\the\temp@count}% % now \temp@count is current max row width {\sub@loop}% update a row \advance\temp@@@count 1\relax \ifnum\temp@@@count>\R@Wcount\temp@@count=0\else\temp@@count=1\fi \relax \ifnum\temp@@count>0 \repeat}% \fi % of \ifnodefaults }% % % HOUSE KEEPING % \newif\ifshowp@r@ \showp@r@true % default mode \def\show@paras{\showp@r@true\lettercontents}% \def\showparas{\show@paras}% % \def\b@group{\iflocalparas\bgroup\fi}% \def\e@group{\iflocalparas\egroup\fi}% % \long\def\lettercontents{}% % \def\inputletter#1{\save@catcodes[OLD][0][\MAX@CHR@CODE][/13/]\beginletter \save@catcodes[TMP][0][\MAX@CHR@CODE][]\get@catcodes[OLD]\existfile{#1}% \iftemp@if \input#1% \else \immediate\write16{Letter File <#1> not found.}\fi \get@catcodes[TMP]\endletter}% % \def\inputfile#1{\relax\existfile{#1}\iftemp@if \input#1 \else \immediate\write16{File <#1> not found.}\fi \relax}% % \def\preview{\preview@}% % % % PAGE NUMBER % for both TeX and LaTeX % \ifISLATEX \let\PAGENO=\c@page \def\NOPAGENUMBERS{\pagestyle{empty}}\else \let\PAGENO=\pageno \let\NOPAGENUMBERS=\nopagenumbers \fi % % % SINGLE PARAMETER % \def\paras{\push{% \edef\next@@{\noexpand\rowcolp@r@s[\the\p@r@two][\the\p@r@one]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@1\right@\left@1\right@\p@r@end}% % % NOTE: % 1. default parameters are enclosed between \left@ and \right@, % and is supplied after \st@ckparas. All defaults (may be empty) must % be supplied. % 2. \rowcolp@r@s is the name of the macro that doesn't take defaults % 3. \the\p@r@one, .., \the\p@r@nine represent #1,.., #9 . % 4. \paras is the new macro that behaves like \rowcolp@r@s but now % takes defaults % 5. change accordingly if one wants to implement defaults to other % existing macros. % 6. limitation: '[' and ']' are now not allowed as macro parameters. % % \def\rowcolp@r@s[#1][#2]{% \ifpreview {\leavevmode \boxmore[1pt]{\boxmore[3pt]{\hbox {\font\tiny@rm=cmr5\tiny@rm ~#1 -- #2~}}}}\relax \else \csname LET#1*#2\string~\endcsname \fi}% % % % GET \paras[m][n] AND TEST EMPTYNESS % \checkparas[m][n]{T} stores true content of \Tm*n~ into \cachedata % and set \ifemptyparas to true if the content is empty % % Typical use: \checkparas[m][n]{LET} \checkparas[m][n]{DEF} % \newif\ifemptyparas \def\check@@paras[#1][#2]#3{% \expandafter\let\expandafter\cachedata\csname #3#1*#2\string~\endcsname \ifx\cachedata\relax \def\cachedata{}\else \temp@toks=\expandafter{\cachedata}% \def\cachedata\b@group\relax##1\e@group\safty@mark{\def\cachedata{##1}}% \expandafter\cachedata\the\temp@toks\safty@mark \fi \ifx\cachedata\empty\emptyparastrue\else\emptyparasfalse\fi}% \def\check@paras[#1][#2]#{\check@@paras[#1][#2]}% \def\checkparas{\push{% \edef\next@@{\noexpand\check@paras[\the\p@r@two][\the\p@r@one]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@1\right@\left@1\right@\p@r@end}% % % % ADDRESS BOXES % % \newbox\temp@box\newdimen\temp@dim \long\def\fig@box[#1]#2{%#1=width of box \setbox\temp@box=\vbox{\hsize #1\noindent\strut #2\strut}% \temp@dim=\ht\temp@box \advance\temp@dim\dp\temp@box\advance\temp@dim-2ex \dp\temp@box=\temp@dim\ht\temp@box=2ex\box\temp@box}% % \long\def\textbox{\push{% \edef\next@@{\noexpand\fig@box[\the\p@r@one]}% \popnil\next@@}\st@ckparas\left@8truecm\right@\p@r@end}% % \ifx\figbox\undefined@\let\figbox\textbox\fi % compatibility with ver 2.03 % \long\def\box@more[#1]#2{\vbox{\hrule\hbox{\vrule\kern#1\vbox {\kern#1\hbox{#2}\kern#1}\kern#1\vrule}\hrule}}% % \long\def\boxmore{\push{% \edef\next@@{\noexpand\box@more[\the\p@r@one]}% \popnil\next@@}\st@ckparas\left@3pt\right@\p@r@end}% % \long\def\address@box[#1][#2]#3{% \noindent\hskip#2\textbox[#1]{\hskip-#2\relax #3}}% % \long\def\addressbox{\push{% \edef\next@@{\noexpand\address@box% [\the\p@r@one][\the\p@r@two]}% \popnil\next@@}\st@ckparas\left@8truecm\right@\left@1.5em\right@\p@r@end}% % \long\def\ADDRESSBOX#1#2#3{% intended for \blockparas \noindent\hskip#2\textbox[#1]{\hskip-#2\relax #3}}% % % % BLOCKPARAS and ADDRESSPARAS % \newcount\blockC@Lcount \newcount\blockT@Pcount \long\def\block@paras[#1][#2][#3][#4]{% #2-th group, from #1 to end, % each para is surrounded by #3 from left and #4 from right % If #4=\relax, an extra {} is applied to the \paras so that % #3 may be a macro acting on the \paras \def\next@one{#2}\def\next@two{#1}\def\next@three{#3}\def\next@four{#4}% \ifx\next@one\empty\def\next@one{1}\fi \ifx\next@two\empty\def\next@two{1}\fi \ifpreview {\leavevmode % three line border box \boxmore[1pt]{\boxmore[1pt]{\boxmore[3pt]{\hbox {\font\tiny@rm=cmr5\tiny@rm \font\small@tt=cmtt8% ~\next@one ~-- \next@two~(+):~ \small@tt\meaning\next@three ~<> \meaning\next@four}}}}}\relax \else \blockC@Lcount=-1% \expandafter\ifx\csname LET\next@one*0\string~\endcsname\undefined@ \blockC@Lcount=0\fi \expandafter\ifx\csname LET\next@one*0\string~\endcsname\relax \blockC@Lcount=0\fi \relax \ifnum\blockC@Lcount<0 \blockC@Lcount=\csname LET\next@one*0\string~\endcsname\relax \fi \blockT@Pcount=\next@two \advance\blockT@Pcount by-1\relax \l@@p % not to be grouped \advance\blockT@Pcount1\relax \ifnum\blockT@Pcount>\blockC@Lcount\else \def\temp@macro{\relax}% some overhead, but safer \ifx\next@four\temp@macro % add {} to \paras, so that a macro can act % on the whole \paras \next@three{\csname LET\next@one*\the\blockT@Pcount\string~\endcsname}% \else \next@three\csname LET\next@one*\the\blockT@Pcount \string~\endcsname\next@four \fi \fi \ifnum\blockT@Pcount<\blockC@Lcount\repe@t \fi}% % % \def\blockparas{\push{% \edef\next@@{\noexpand\block@paras[\the\p@r@one][\the\p@r@two]% [\the\p@r@three][\the\p@r@four]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@1\right@\left@1\right@% \left@\noindent\right@\left@\par\right@\p@r@end}% % % \long\def\address@paras[#1][#2][#3][#4]{% \block@paras[#1][#2][\par\noindent\ADDRESSBOX{#3}{#4}][\relax]\par}% % \def\addressparas{\push{% \edef\next@@{\noexpand\address@paras[\the\p@r@one][\the\p@r@two]% [\the\p@r@three][\the\p@r@four]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@1\right@\left@1\right@% \left@8truecm\right@\left@1.5em\right@\p@r@end}% % % % MAIN PROCESSING MACRO % \newif\ifconti@one \newif\ifconti@two \newif\ifl@stline \newif\ifl@stLINE \newif\ifpreview \previewfalse \newif\iflocalparas \localparastrue % \newtoks\name@paratoks \name@paratoks={;}% \newtoks\name@grouptoks \name@grouptoks={+}% \newtoks\name@clustertoks \name@clustertoks={!}% % % \long\def\delimiters#1#2#3{% LONG MACRO % %%%% MAIN GET: get a group of parameters from a cluster % \long\def\refillst@ck##1#3{\def\d@t@one{##1#3}% {\loop\conti@onefalse \ifx\d@t@one\undefined@ \else \@ddoneline\conti@onetrue\fi \ifconti@one\repeat}}% % \long\def\testl@stline##1#2##2#3##3\s@fetymark{% \def\next{##2}\ifx\next\empty \l@stlinetrue \else \l@stlinefalse \fi \def\next{##3}\def\nextsample{#2#3}% \ifx\next\nextsample\l@stlinefalse\fi}% % \long\def\l@stline##1#3{{\sub@fill{##1}}\let\d@t@one=\undefined@}% \long\def\onem@reline##1#2##2#3{{\sub@fill{##1}}\def\d@t@one{##2#3}}% % \long\def\@ddoneline{\temp@toks=\expandafter{\d@t@one}% \expandafter\testl@stline\the\temp@toks#2#3\s@fetymark \ifl@stline \expandafter\l@stline\the\temp@toks \else \expandafter\onem@reline\the\temp@toks \fi}% % %%%% SUB GET : get parameters from a group % \long\def\sub@fill##1{% \ifload@defaults \global\advance\R@Dcount by 1\else \global\advance\R@Wcount by 1\fi\relax \clr@row\def\d@t@two{\relax##1#3}% %%care: extra \relax added {\loop\conti@twofalse \ifx\d@t@two\undefined@ \else \@ddoneLINE\conti@twotrue\fi \ifconti@two\repeat}}% % \long\def\moreletter##1#3{\showp@r@false \clr@allrows\refillst@ck##1#3\lettercontents\clr@allrows\showp@r@true}% % \def\endletter{\relax}% \long\def\true@letter##1\endletter{\long\def \lettercontents{\begingroup\catcode`\^^M=5\relax \def\pstr{#1}\def\gstr{#2}\def\cstr{#3}\relax##1\relax\endgroup}}% \let\beginletter\true@letter % \long\def\testl@stLINE##1#1##2#3##3\s@fetymark{% \def\next{##2}\ifx\next\empty% \l@stLINEtrue \else \l@stLINEfalse \fi% \def\next{##3}\def\nextsample{#1#3}% \ifx\next\nextsample\l@stLINEfalse\fi}% % \long\def\l@stLINE##1#3{% \rowpush{\b@group##1\e@group}\let\d@t@two=\undefined@}% \long\def\onem@reLINE##1#1##2#3{% \rowpush{\b@group##1\e@group}\def\d@t@two{\relax##2#3}}%%care % \long\def\@ddoneLINE{\temp@toks=\expandafter{\d@t@two}% \expandafter\testl@stLINE\the\temp@toks#1#3\s@fetymark% \ifl@stLINE\expandafter\l@stLINE\the\temp@toks % \else \expandafter\onem@reLINE\the\temp@toks \fi}% % \def\para@names{\ifshowp@r@ \def\next@@{{\load@defaultsfalse\clr@allrows}\refillst@ck}\else \long\def\next@@####1#3{\relax}\fi \next@@}% % \long\def\para@defaults##1#3{\load@defaultstrue \clr@allrows\refillst@ck##1#3\load@defaultsfalse}% % \def\preview@{{\previewtrue\moreletter #3}}% % \long\def\out@letter##1#3{\showp@r@false\clr@allrows \refillst@ck##1#3\lettercontents\clr@allrows\showp@r@true \pile@letters}% % \name@paratoks={#1}\name@grouptoks={#2}\name@clustertoks={#3}% % }% END OF LONG MACRO % \long\def\paranames#1!{\ifshowp@r@ \begingroup\delimiters{;}{+}{!}\para@names#1!\endgroup\fi}% \long\def\paradefaults#1!{% \begingroup\delimiters{;}{+}{!}\para@defaults#1!\endgroup}% % \def\delparadefaults{{\load@defaultstrue\clr@allrows}}% % \def\defaultmarks{\delimiters{;}{+}{!}}% \def\blockmarks{\delimiters{....}{----}{====}}% % % % TEST MACRO % % test if a token is a macro % \newif\iftemp@if \def\sub@ismacro#1#2#3#4#5#6#7\s@fetymark{% check only 'm,c,:' \if#1m\else\temp@iffalse\fi % \if#2a\else\temp@iffalse\fi \if#3c\else\temp@iffalse\fi % \if#4r\else\temp@iffalse\fi \if#6:\else\temp@iffalse\fi }% \if#5o\else\temp@iffalse\fi % \def\ismacro#1#2\s@fetymark{%\expandafter\ismacro\meaning\token\s@fetymark \temp@iftrue \if#1\esc@\else \sub@ismacro#1#2\s@fetymark \fi }% % \long\def\del@token#1{}% \def\del@space#1 {}% % % PILEMODE: the basic mode % \def\pile@letters{% \def\check@{% \def\buffer@{\out@letter}% \def\one@space{ }% \expandafter\ismacro\meaning\next@\s@fetymark % \ifx\next@\undefined@\temp@iftrue \fi % \iftemp@if % \ifx\par\next@ \def\buffer@{\expandafter\pile@letters\del@token}% \else \ifx\endpilemode\next@\def\buffer@{}\fi % \fi % \else % \if\one@space\next@% \def\buffer@{\expandafter\pile@letters\del@space}% \fi % \fi\buffer@}% \futurelet\next@\check@}% % \def\beginpilemode{\showp@r@false \def\preview{}\def\showparas{}\pile@letters}% \def\endpilemode{% \def\preview{\preview@}\def\showparas{\show@paras}\showp@r@true}% % % % LINEMODE: cr separate paras, empty line eject letter % \catcode`\^^M=13\relax% % % remove empty or space only lines, then control to \line@chkline \long\def\line@curbfront#1^^M{% \is@emptyline{#1}% \iftemp@if \def\buffer@{\line@curbfront}% \else \def\buffer@{\line@chkline#1^^M}% control to \line@chkline \fi \buffer@ }% % % \newtoks\temp@@toks % \name@endtoks and \true\end@toks must be given on entry \long\def\line@chkline#1^^M{% \test@tokstr{\the\name@endtoks}{#1}% \iftemp@if % \temp@toks=\expandafter{\first@half}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if\else% \expandafter\rowpush\expandafter{\expandafter% \b@group\expandafter\relax\the\temp@toks\e@group}% \fi% \temp@toks=\expandafter{\second@half}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if \temp@toks={}\fi% \iftemp@if\else % {\is@rawmode9/1/13/13/1/13/32/1/13/96/1/13/0/0/0/% \iftemp@if \message{}\let\ =\space % \wlog{(Verbatim: \second@half)}\fi}\fi% \ifnum\R@Wcount=0\temp@@toks={}\else% \temp@@toks={\showp@r@false\lettercontents\clr@allrows\showp@r@true}% \fi% \edef\buffer@{\the\temp@@toks\the\true@endtoks\the\temp@toks}% \else % \temp@toks=\expandafter{\first@half}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if% \temp@@toks={\showp@r@false\lettercontents\clr@allrows\showp@r@true}% \edef\buffer@{\the\temp@@toks\noexpand\line@curbfront}% \else% \expandafter\rowpush\expandafter{\expandafter% \b@group\expandafter\relax\the\temp@toks\e@group}% \let\buffer@=\line@chkline% \fi% \fi \buffer@% }% % \catcode`\^^M=5\relax% % % NORMAL LINEMODE HANDLER % \def\beginlinemode{% \true@endtoks={\endlinemode}% \name@endtoks={\endlinemode}\showp@r@false\catcode`\^^M=13\relax % \def\preview{}\def\showparas{}\clr@allrows\line@curbfront }% % \def\endlinemode{\catcode`\^^M=5\relax%\defaultmarks \def\preview{\preview@}\def\showparas{\show@paras}\showp@r@true }% % % RAW TEXT LINEMODE HANDLER % \def\endrawlinemode{\get@catcodes[RAW]\showp@r@true}% \def\beginrawlinemode#{\begin@rawlinemode}% \def\begin@rawlinemode#1{\save@catcodes[RAW][0][\MAX@CHR@CODE][]% \def\temp@macro{#1}% #1=token to end the list \ifx\temp@macro\empty \temp@toks=\expandafter{\esc@}% \name@endtoks=\expandafter{\the\temp@toks endrawlinemode}% \else \name@endtoks={#1}% \fi \true@endtoks={\endlinemode\endrawlinemode}% \rm@ligature\set@space\set@tab\raw@chars[11][13][13][13][13]% \showp@r@false\clr@allrows\line@curbfront }% % % % BLOCKMODE: cr separate paras % % line containing '+' (\name@grouptoks) separates groups % line containing '!' (\name@clustertoks) separates clusters % \catcode`\^^M=13\relax% % % remove empty or space only lines, then control to \block@chkline \long\def\block@curbfront#1^^M{% \is@emptyline{#1}% \iftemp@if \let\buffer@=\block@curbfront % \else \test@tokstr{\the\name@endtoks}{#1}% \iftemp@if \def\buffer@{\block@chkline#1^^M}% \else \test@tokstr{\the\name@clustertoks}{#1}% \iftemp@if \let\buffer@=\block@curbfront% \else \test@tokstr{\the\name@grouptoks}{#1}% \iftemp@if \def\buffer@{\block@chkline#1^^M}% \else \test@tokstr{\the\name@paratoks}{#1}% \iftemp@if \let\buffer@=\block@chkline% \else \def\buffer@{\block@chkline#1^^M}% control to \block@chkline \fi % \fi % \fi% \fi % \fi \buffer@ }% % % \name@endtoks and \true\end@toks must be given on entry \long\def\block@chkline#1^^M{% \test@tokstr{\the\name@endtoks}{#1}% \iftemp@if % \ifnum\R@Wcount=0% \temp@toks={\clr@allrows\showp@r@true}% \else% \temp@toks={\showp@r@false\lettercontents\clr@allrows\showp@r@true}% \fi% \edef\buffer@{\the\temp@toks\the\true@endtoks}% \else % \test@tokstr{\the\name@clustertoks}{#1}% \iftemp@if% \def\buffer@{\showp@r@false\lettercontents\clr@allrows% \showp@r@true\block@curbfront}% \else% \test@tokstr{\the\name@grouptoks}{#1}% \iftemp@if% \ifnum\R@Wcount<1\global\R@Wcount=1\relax\fi % \global\advance\R@Wcount1\relax% \else% \rowpush{\b@group\relax#1\e@group}% \fi% \let\buffer@=\block@chkline % \fi% \fi \buffer@% }% % \catcode`\^^M=5\relax% % % NORMAL BLOCKMODE HANDLER % \def\beginblockmode{% \true@endtoks={\endblockmode}% \name@endtoks={\endblockmode}\showp@r@false\catcode`\^^M=13\relax % \def\preview{}\def\showparas{}\clr@allrows\block@curbfront }% % \def\endblockmode{\catcode`\^^M=5\relax%\defaultmarks \def\preview{\preview@}\def\showparas{\show@paras}\showp@r@true }% % % RAW TEXT BLOCKMODE HANDLER % \def\endrawblockmode{\get@catcodes[RAW]\showp@r@true}% \def\beginrawblockmode#{\begin@rawblockmode}% \def\begin@rawblockmode#1{\save@catcodes[RAW][0][\MAX@CHR@CODE][]% \def\temp@macro{#1}% #1=token to end the list \ifx\temp@macro\empty \temp@toks=\expandafter{\esc@}% \name@endtoks=\expandafter{\the\temp@toks endrawblockmode}% \else \name@endtoks={#1}% \fi \true@endtoks={\endblockmode\endrawblockmode}% \rm@ligature\set@space\set@tab\raw@chars[11][13][13][13][13]% \showp@r@false \clr@allrows\block@curbfront }% % % % DATAMODE: every lines eject a letter (raw tex mode) % \catcode`\^^M=13\relax % \newcount\data@count % % % \name@endtoks and \true\end@toks must be given on entry \long\def\data@chkline#1^^M{\test@tokstr{\the\name@endtoks}{#1}% \iftemp@if % \first@half is raw text \temp@toks=\expandafter{\first@half}% \temp@@toks=\expandafter{\second@half}% \edef\temp@macro{\the\temp@toks\the\temp@@toks}% \temp@toks=\expandafter{\temp@macro}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if \else\message{}\let\ =\space % \wlog{(Ignored: \first@half<->\second@half)}\fi % \ifnum\R@Wcount=0\temp@@toks={}\else% \ifnum\R@Wcount=\total@data@num\else \message{}% \wlog{(Number of data lines at odds)}\fi % \temp@@toks={\showp@r@false\lettercontents\clr@allrows\showp@r@true}% \fi% \edef\buffer@{\the\temp@@toks\the\true@endtoks}% \else % \temp@toks=\expandafter{\first@half}\advance\data@count1 % \expandafter\rowpush\expandafter{\expandafter% \b@group\expandafter\relax\the\temp@toks\e@group}% \ifnum\data@count<\total@data@num % \let\buffer@=\data@chkline% \else \data@count=0 % \temp@@toks={\showp@r@false\lettercontents\clr@allrows\showp@r@true}% \edef\buffer@{\the\temp@@toks\noexpand\data@chkline}% \fi% \fi \buffer@ }% % \def\begindatamode{\push{% \edef\next@@{\noexpand\begin@datamode[\the\p@r@one]}% \popnil\next@@}\st@ckparas\left@\right@\p@r@end}% % \def\begin@datamode[#1]#{\begin@@datamode[#1]}% \def\begin@@datamode[#1]#2{\save@catcodes[RAW][0][\MAX@CHR@CODE][]% % #1=token to end the list, #2=number of lines for each block \edef\total@data@num{#2}\def\temp@macro{#1}% \ifx\total@data@num\empty \def\total@data@num{1}\fi % \ifnum\total@data@num<1 \def\total@data@num{1}\fi % \ifx\temp@macro\empty % \temp@toks=\expandafter{\esc@}% \name@endtoks=\expandafter{\the\temp@toks enddatamode}% \else \name@endtoks={#1}\fi % \true@endtoks={\endlinemode\endrawlinemode}% \rm@ligature\set@space\set@tab\raw@chars[11][13][13][13][13]% \showp@r@false\clr@allrows\data@count=0 % \def\temp@macro##1^^M{% \test@tokstr{\the\name@endtoks}{##1}% \iftemp@if\else \temp@toks={##1}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if\else \message{}\let\ =\space % \wlog{(Ignored: ##1)}\fi % \fi % \test@tokstr{\the\name@endtoks}{##1}% \iftemp@if \temp@toks=\expandafter{\first@half}% \temp@@toks=\expandafter{\second@half}% \edef\temp@@macro{\noexpand\data@chkline % \the\temp@toks\the\name@endtoks\the\temp@@toks\noexpand^^M}% \else\def\temp@@macro{\data@chkline}\fi\temp@@macro }% \temp@macro }% % \catcode`\^^M=5\relax% % % % BASIC SETUP % \new@measures \defaultmarks % set up the default delimiters % % % RAW TEXT LISTING and MORE ON MACRO PARAMETER DEFAULTING % % % FLUSH ZEROS \fillzeros[] % %% \newcount\temp@count \newcount\temp@@count \def\fillzeros[#1]#2{\temp@@count=#2\relax \ifnum\temp@@count<0 \temp@@count=-\temp@@count\fi \temp@count=1\relax {\loop\ifnum\temp@@count<10 \else \global\divide\temp@@count by 10 \global\advance\temp@count by 1 \fi \ifnum\temp@@count=10\relax\global\temp@@count=11\relax\fi \ifnum\temp@@count>10 \repeat}% \ifnum#2<0 \advance\temp@count1\relax-\fi {\loop\ifnum\temp@count<#1\relax0\advance\temp@count1\fi \ifnum\temp@count<#1 \repeat}% \temp@@count=#2\relax\ifnum\temp@@count<0 \temp@@count=-\temp@@count\fi \the\temp@@count}% % % % BEGINLIST--ENDLIST: activate and % \catcode`\^^M=13% \newcount\linecount\global\linecount=1% {\obeyspaces\gdef {\ }}% % % % % \name@endtoks: token to end the list % \true@endtoks: tokens to be executed at the end % \name@endtoks and \true@endtoks must be defined on entry % \no@emptylinefalse: the first or the last line empty % \newif\ifno@emptyline % iftemp@if \newif\ifprint@file \global\print@filefalse % \def\begin@list[#1][#2][#3][#4][#5][#6]{% \global\linecount=#1\catcode`\^^M=13\no@emptylinetrue % \ifprint@file \def^^M{\put@linenumber}\else\def^^M{\par}\fi % \def\put@linenumber{\par\noindent\hbox to #5{}% \rlap{\hskip-1em\hskip#6% \ifnum#3>0\relax\hbox to0em{\hss#4\fillzeros[#3]\linecount~~}\fi}% \global\advance\linecount#2\relax}% \def\out@aline{% \ifno@emptyline % \expandafter\is@emptyline\expandafter{\first@half}% \ifprint@file \temp@@iffalse \else\temp@@iftrue \fi % \else \temp@iffalse \temp@@iftrue % \fi \no@emptylinefalse% \iftemp@if \else % \iftemp@@if \put@linenumber \fi % \first@half \par % extra \par is absorbed, put here for last line \fi }% \def\readyt@quit{\no@emptylinetrue% {\is@rawmode9/1/13/13/1/13/32/1/13/96/1/13/0/0/0/% \iftemp@if \expandafter\is@emptyline\expandafter{\second@half}% \iftemp@if\else\message{}\let\ =\space % \wlog{(Verbatim: \second@half)}\fi\fi}% \temp@toks=\expandafter{\first@half}% \temp@@toks=\expandafter{\second@half}% \edef\first@half{\the\temp@toks\the\temp@@toks}\out@aline % \edef\temp@macro{\the\true@endtoks}% \temp@macro % \second@half removed }% \def\moret@get{\out@aline\get@phys@line}% \long\def\get@phys@line##1^^M{% \test@tokstr{\the\name@endtoks}{##1}% \iftemp@if \let\temp@macro=\readyt@quit \else \let\temp@macro=\moret@get % \fi % \temp@macro }% \catcode`\ =13\relax\get@phys@line% }% % % \def\endlist{\catcode`\^^M=13% \catcode`\ =10\let^^M=\par\catcode`\^^M=5}% \def\beginlist[#1][#2][#3][#4][#5][#6]{% \name@endtoks={\endlist}\true@endtoks={\endlist}% \begin@list[#1][#2][#3][#4][#5][#6]}% % \catcode`\^^M=5\relax% % % % BEGINRAWLIST -- ENDRAWLIST \beginrawlist [...]{endtoken} % defaults for [..] supported, last {..} compulsory ({} allowed though) % % \beginrawlist [][][][]% % [][]{} % =\linecount: starts with where it is left % = empty: \endrawlist ends the rawlist, otherwise % ends it % =0: no line numbering % Use \leftskip and \rightskip to control the wrapped positions % \def\endrawlist{\endgroup}% \def\begin@@rawlist[#1][#2][#3][#4][#5][#6]#7{\begingroup \def\temp@macro{#7}% #7=token to end the list \ifx\temp@macro\empty \name@endtoks=\expandafter{\esc@ endrawlist}% \else \name@endtoks={#7}% \fi \true@endtoks={\endlist\endrawlist}% \rm@ligature\set@tab\set@cr\set@space \raw@chars[11][13][13][13][13]% \begin@list[#1][#2][#3][#4][#5][#6]}% % \def\begin@rawlist[#1][#2][#3][#4][#5][#6]#{% \begin@@rawlist[#1][#2][#3][#4][#5][#6]}% % \def\beginrawlist{\push{% \edef\next@@{\noexpand\begin@rawlist [\the\p@r@one][\the\p@r@two][\the\p@r@three][\the\p@r@four]% [\the\p@r@five][\the\p@r@six]}% \popnil\clrp@r@s\next@@}% end of push \font\tiny@rm=cmr5% \edef\temp@macro{% \noexpand\left@\the\linecount\noexpand\right@ \noexpand\left@1\noexpand\right@ \noexpand\left@0\noexpand\right@ \noexpand\left@\noexpand\tiny@rm\noexpand\right@ \noexpand\left@0pt\noexpand\right@ \noexpand\left@0pt\noexpand\right@}% \expandafter\st@ckparas\temp@macro\p@r@end}% % % % % PRINTFILE verbatim \printfile [...]{filename} % [...] same as \beginrawlist % \catcode`\^^M=13\relax % \def\print@@file[#1][#2][#3][#4][#5][#6]#7{% \temp@toks={\bgroup\print@filetrue % \beginrawlist[#1][#2][#3][#4][#5][#6]{}}% \existfile{#7}% \iftemp@if % \edef\temp@macro##1{\the\temp@toks % \noexpand\input##1\leavevmode % \setbox\temp@box=\lastbox\esc@ endrawlist^^M% \global\advance\linecount-1\relax\egroup\vskip-\baselineskip}% \else \def\temp@macro##1{\message{(File #7 not found)}}% \fi % \temp@macro{#7}}% \catcode`\^^M=5\relax % % \def\print@file[#1][#2][#3][#4][#5][#6]#{% \print@@file[#1][#2][#3][#4][#5][#6]}% % \def\printfile{\push{% \edef\next@@{\noexpand\print@file [\the\p@r@one][\the\p@r@two][\the\p@r@three][\the\p@r@four]% [\the\p@r@five][\the\p@r@six]}% \popnil\clrp@r@s\next@@}% end of push \font\tiny@rm=cmr5% \edef\temp@macro{% \noexpand\left@\the\linecount\noexpand\right@ \noexpand\left@1\noexpand\right@ \noexpand\left@6\noexpand\right@ \noexpand\left@\noexpand\tiny@rm\noexpand\right@ \noexpand\left@0pt\noexpand\right@ \noexpand\left@-10pt\noexpand\right@}% \expandafter\st@ckparas\temp@macro\p@r@end}% % % % COMMENT OUT TEXT % \begincomment{password} \endcomment or password % \catcode`\^^M=13% \def\begin@@comment{\let\par\relax % \catcode`\^^M=13\message{< Skip}% \temp@count=0\temp@@count=0\relax% \long\def\get@phys@line##1^^M{% \ifnum\temp@@count<500\advance\temp@@count1\else % \message{\the\temp@count}\temp@@count=1\fi\relax % \global\advance\temp@count1\relax % \test@tokstr{\the\name@endtoks}{##1}% \iftemp@if % \def\temp@macro{\message{\the\temp@count\space lines}% \expandafter\is@emptyline\expandafter{\second@half}% \iftemp@if\message{>}\else % \message{ >}% \wlog{(Ignored: \second@half)}% \fi \the\true@endtoks }% \else \let\temp@macro=\get@phys@line % \fi \temp@macro }% \catcode`\ =13\relax\get@phys@line}% % \def\end@comment{\catcode`\^^M=13\catcode`\ =10\def^^M{\par}\catcode`\^^M=5}% \catcode`\^^M=5\relax% % \def\endcomment{\endgroup}% \read@buffline\temp@macro \def\begin@comment#1{\begingroup\nullfont \tolerance=10000 \hbadness=10000 \vbadness=10000 \hfuzz=\maxdimen \vfuzz=\maxdimen \def\temp@macro{#1}% #1=token to end the list \ifx\temp@macro\empty \name@endtoks=\expandafter{\esc@ endcomment}% \else \name@endtoks={#1}% \fi \true@endtoks={\end@comment\endcomment}% \rm@ligature\set@tab\set@cr\set@space\def\ { }% \raw@chars[11][11][11][13][13]\begin@@comment}% % \def\begincomment#{\begin@comment}% essentially an \outer macro % % SAVE CATCODES % \def\toks@of@catcodes#1#2[#3]{{% #3=/13/221/233/ must be increasing,or empty % return: global \temp@toks=0/0/0/ % or /startnum/totalnum/catcode/ ... /0/0/0/ \def\get@triplet/##1/##2\ZZ{\temp@@@count=##1\relax \def\temp@macro{##2}\ifx\temp@macro\empty\else\def\temp@macro{/##2}\fi}% \def\temp@macro{#3}\def\temp@@macro{}\temp@count=#1\relax \loop \temp@@count=#2\relax \temp@@@count=\temp@@count\relax \ifx\temp@macro\empty \temp@iffalse\else \expandafter\get@triplet\temp@macro\ZZ % \ZZ is not defined \ifnum\temp@@@count>#2 \else \temp@@count=\temp@@@count \advance\temp@@count-1\relax \fi\fi \edef\temp@@@macro{\noexpand\str@@catcodes {\the\temp@count}{\the\temp@@count}}\temp@@@macro \temp@@toks=\expandafter{\temp@@macro}% \edef\temp@@macro{\the\temp@@toks\the\temp@toks}% \ifnum\temp@@@count>\temp@@count \temp@count\temp@@@count \else\temp@count\temp@@count \fi \advance\temp@count1\relax \ifnum\temp@count>#2 \temp@iffalse \else \temp@iftrue\fi \iftemp@if \repeat \global\temp@toks=\expandafter{\temp@@macro0/0/0/}}}% % \def\str@@catcodes#1#2{\ifnum#1>#2 \global\temp@toks={}\else {\temp@@@count#1\relax \global\temp@toks={}% result in \temp@toks \loop \temp@count=0\temp@@count=\the\catcode\temp@@@count\relax \l@@p \advance\temp@count1\advance\temp@@@count1\relax \ifnum\temp@@@count>#2\relax\temp@iffalse\else\temp@iftrue\fi \iftemp@if\ifnum\the\catcode\temp@@@count=\temp@@count \else\temp@iffalse\fi\fi \iftemp@if\repe@t \temp@@count=\temp@@@count \advance\temp@@count-\temp@count\relax \edef\temp@macro{\the\temp@toks \the\temp@@count/\the\temp@count/\the\catcode\temp@@count/}% \global\temp@toks=\expandafter{\temp@macro}% \ifnum\temp@@@count>#2\relax\temp@iffalse\else\temp@iftrue\fi \iftemp@if \repeat }\fi}% % \def\act@catcodes#1/#2/#3/{% activate catcodes, must be ended by /0/0/0/ \temp@count=#2\relax \ifnum\temp@count>0 \let\temp@macro\act@catcodes\temp@@iftrue \else \let\temp@macro\relax\temp@@iffalse\fi \temp@count=0 \temp@@count=#1\relax \iftemp@@if\else\temp@count=#2\relax\fi \l@@p \iftemp@@if \temp@@@count=\the\catcode\temp@@count \relax \ifnum\temp@@@count=#3\relax\else \catcode\the\temp@@count=#3\relax\fi \advance\temp@count1 \advance\temp@@count1\relax \fi \ifnum\temp@count<#2 \repe@t \temp@macro}% % % \def\is@rawmode#1/#2/#3/{% chk if catcode is 11 or 12, % exceptions must be ended by /0/0/0/ \temp@iftrue\temp@count=#2\relax \ifnum\temp@count>0 \let\temp@macro\act@catcodes\temp@@iftrue \else \let\temp@macro\relax\temp@@iffalse\fi \temp@count=0 \temp@@count=#1\relax \iftemp@@if\else\temp@count=#2\relax\fi \l@@p \iftemp@@if \temp@@@count=\the\catcode\temp@@count \relax \ifnum\temp@@@count=#3\relax\else \ifnum\temp@@@count=11\relax\else \ifnum\temp@@@count=12\relax\else \temp@iffalse \fi\fi\fi \advance\temp@count1 \advance\temp@@count1\relax \fi \ifnum\temp@count<#2 \repe@t\temp@macro}% % % % #1=name, #2=1st char, #3=last char, #4=exceptions \def\save@catcodes[#1][#2][#3][#4]{\toks@of@catcodes{#2}{#3}[#4]% \expandafter\xdef\csname CAT@#1@CODES\endcsname{\the\temp@toks}}% % \def\get@catcodes[#1]{% \expandafter\let\expandafter\temp@macro\csname CAT@#1@CODES\endcsname \expandafter\act@catcodes\temp@macro}% % % SAVE STATUS % \def\save@status{\edef\temp@macro{% status to \temp@macro \noexpand\pagegoal=\the\pagegoal \noexpand\hsize=\the\hsize \noexpand\vsize=\the\vsize \noexpand\hyphenpenalty=\the\hyphenpenalty \noexpand\overfullrule=\the\overfullrule \noexpand\pretolerance=\the\pretolerance \noexpand\tolerance=\the\tolerance \noexpand\hbadness=\the\hbadness \noexpand\vbadness=\the\vbadness \noexpand\hfuzz=\the\hfuzz \noexpand\vfuzz=\the\vfuzz \noexpand\spaceskip=\the\spaceskip \noexpand\xspaceskip=\the\xspaceskip \noexpand\looseness=\the\looseness \noexpand\parfillskip=\the\parfillskip }}% % % % MULTI-COLUMNS % \newif\ifwarn@me \newbox\partial@page \newtoks \old@output@toks %\newtoks\new@footline % replacing \footline for a TeX bug if footline is lost % % makeshift remedy for LaTeX % One must define \makefootline etc for realistic export to general LaTeX \ifx\makeheadline\undefined@ \let\makeheadline\relax\fi \ifx\makefootline\undefined@ \def\makefootline{}\fi \ifx\advancepageno\undefined@\def\advancepageno{\global\advance\count0 1}\fi % \def\make@headline{{\hsize=\page@width \makeheadline}}% \def\make@footline{{\hsize=\page@width \makefootline}}% \def\simple@pageout#1{\shipout\vbox{\make@headline \vbox to\page@height{#1}\make@footline}\advancepageno}% % \def\page@sofar[#1]{\unvbox\partial@page \temp@count=0 % \loop\ifnum\temp@count<#1 \wd\temp@count=\hsize\advance\temp@count1 \repeat \temp@count=1 \hbox to\page@width{\box0 % \loop\ifnum\temp@count<#1 \hfil\box\temp@count \advance\temp@count by1 \repeat}\temp@count=0 % \ifx\topins\undefined@\else\ifvoid\topins\else\temp@count=1 \fi\fi \ifx\footins\undefined@\else\ifvoid\footins\else\temp@count=1 \fi\fi \ifwarn@me \ifnum\temp@count=1 \message{}% \wlog{Insertions (e.g. footnotes) may be pushed to later pages. Try manual pagebreak to overcome possible overfull vbox due to insertions. I pray for you.}\global\warn@mefalse \fi\fi}% % \def\columns@out[#1]{\splittopskip=\topskip\splitmaxdepth=\maxdepth \temp@dim=\page@height \advance\temp@dim by -\ht\partial@page \temp@count=0 \loop\ifnum\temp@count<#1 \ifdim\temp@dim>0pt \setbox\temp@count=\vsplit255 to\temp@dim \else \setbox\temp@count=\vbox{}\fi \advance\temp@count by1 \repeat \simple@pageout{\page@sofar[#1]}\unvbox255\penalty\outputpenalty}% % \def\balance@columns[#1]{\setbox\temp@box=\vbox{\unvbox255}% %% For materials more than one page but less than two pages \temp@@dim=\ht\partial@page \temp@dim=\ht\temp@box \divide\temp@dim by \column@num \advance\temp@dim by \temp@@dim \advance\temp@dim by \dp\temp@box \ifdim\temp@dim>\page@height \message{(!)}% \temp@@@dim=\temp@@dim \advance\temp@@@dim by -\page@height \advance\temp@@@dim by \baselineskip \ifdim\temp@@@dim>0pt \message{}% \wlog{Space left in previous page too narrow.}\else {\vbadness=10000 \vfuzz=\maxdimen \predisplaypenalty 0 \postdisplaypenalty 0 % \splittopskip=\topskip \splitmaxdepth=\maxdepth \temp@dim=\page@height \advance\temp@dim by -\temp@@dim \advance\temp@dim by \maxdepth \temp@count=0 \loop \ifnum\temp@count<#1 % \setbox\temp@count=\vsplit\temp@box to\temp@dim \advance\temp@count by1 \repeat \global\setbox\temp@box\box\temp@box \simple@pageout{\page@sofar[#1]}}\fi\fi % push the rest into the next page \temp@dim=\ht\temp@box \advance\temp@dim by\topskip \advance\temp@dim by -\baselineskip \divide\temp@dim by #1 \splittopskip=\topskip {\vbadness=10000 \vfuzz=\maxdimen \splitmaxdepth=\maxdepth \loop \setbox\temp@@box=\copy\temp@box \temp@count=1 \l@@p \ifnum\temp@count<#1 % \setbox\temp@count=\vsplit\temp@@box to\temp@dim \advance\temp@count by1 \repe@t \ifdim\ht\temp@@box>\temp@dim \advance\temp@dim by1pt \repeat \temp@count=1 \temp@@count=0 \loop \ifnum\temp@count<#1 % \setbox\temp@@count=\vbox to\temp@dim{\unvbox\temp@count}% \advance\temp@count by1 \advance\temp@@count by1 \repeat \temp@count=#1 \advance\temp@count by-1 % \setbox\temp@count=\vbox to \temp@dim{\unvbox\temp@@box}\page@sofar[#1]}% \global\setbox\temp@box=\null\global\setbox\temp@@box=\null}% % \def\begincolumns{\push{% \edef\next@@{\noexpand\begin@columns[\the\p@r@one][\the\p@r@two]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@2\right@\left@10pt\right@\p@r@end}% % \def\begin@columns[#1][#2]{% #1 will be expanded via \edef \save@status \old@output@toks=\expandafter{\the\output}% \let\old@entry@status\temp@macro %\begingroup \edef\column@num{#1}\warn@metrue \temp@@count=0 \temp@count=\column@num \relax \ifnum\temp@count>9 \temp@@count=1 \fi \ifnum\temp@count<1 \temp@@count=1 \fi \ifnum\temp@@count>0 % \errhelp{I think a format other than 1-9 columns in a page is crazy. But if you do have such devious wishes, I can only keep my fingers crossed for you.}% \errmessage{Column number \column@num\space is too ambitious!}\fi \ifISLATEX\edef\page@width{\the\textwidth}\edef\page@height{\the\textheight}% \else \edef\page@width{\the\hsize}\edef\page@height{\the\vsize}\fi \tolerance=10000 \hbadness=10000 \vbadness=10000 \hfuzz=\maxdimen \vfuzz=\maxdimen \overfullrule=0pt \par\penalty-1 %avoid page loss near the page break margin \message{(\column@num\space cols|#2)}% \output={\global\setbox\partial@page=\vbox{\unvbox255\bigskip}}\eject \output={\columns@out[\column@num]}% \divide\hsize by \column@num \temp@dim=#2 \ifnum \temp@dim<0 \message{Intercolumn skip [#2] insensible, reset to 0pt.}% \else \advance\hsize by -#2 \fi\multiply\vsize by \column@num \advance\vsize by 1pc}% % \def\endcolumns{% \hbox{}\output={\balance@columns[\column@num]}\eject%\endgroup \old@entry@status \output=\expandafter{\the\old@output@toks}% \global\setbox\partial@page=\null}% \pagegoal=\vsize % % SMOOTH PASSAGES FOR MULTICOLUMNS % \def\smooth{\spaceskip=0.3em plus .8em minus .1em \xspaceskip=0.6pt plus 1em minus .2em \pretolerance=10 \tolerance=10000 \looseness=-10000 \parfillskip=0pt plus10fill\relax}% % % MAKE LABELS % \beginlabels[#1][#2][#3][#4][#5][#6] % defaults: #1=15pt #2=\sl #3=1 #4=1 #5=2.6in #6=2em % \endlabels % \def\begin@labels[#1][#2][#3][#4][#5][#6]{% \ifISLATEX \temp@dim=\textwidth \else\temp@dim=\hsize\fi \temp@@dim=#1 \advance\temp@@dim #5 \def\label@size{#5}% \advance\temp@@dim\temp@@dim \advance\temp@@dim10pt \ifdim\temp@@dim<\temp@dim \temp@count=2 \else \temp@count=1 \temp@dim=0pt \fi\relax \edef\temp@macro{\noexpand\begincolumns[\the\temp@count][10pt]}% \temp@macro %\nullfont \long\def\peudo@letter##1\endletter{% \def\lettercontents{\begingroup \hbadness=10000 \vbadness=10000 \hfuzz=\maxdimen \vfuzz=\maxdimen \overfullrule=0pt \vbox{#2 \par\vskip\baselineskip \vskip#1\addressparas[#3][#4][#5][#6]\vskip#1 \hbox{\font\tiny@rm=cmr5 \tiny@rm \leaders\hbox to .8em{\hss.\hss}\hskip\label@size}\par}% \endgroup}}% \let\beginletter\peudo@letter\beginletter\endletter}% % \def\beginlabels{\push{% \edef\next@@{\noexpand\begin@labels[\the\p@r@one][\the\p@r@two]% [\the\p@r@three][\the\p@r@four][\the\p@r@five][\the\p@r@six]}% \popnil\clrp@r@s\next@@}\st@ckparas \left@ 20pt\right@ \left@ \tt\raggedright\right@ \left@ 1\right@ \left@ 1\right@ \left@ 2.6in\right@ \left@ 2em\right@ \p@r@end}% % \def\endlabels{\endcolumns\let\beginletter\true@letter}% % % % LABELS: make labels via a 2nd read of file % \long\def\firstread#1{% nil if read after \labelsquit \ifx\ENDINPUT\undefined\def\temp@macro{#1}\else\def\temp@macro{}\fi \temp@macro}% % % \def\initstyle{\push{% \edef\next@@{\noexpand\init@labels[\the\p@r@one]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@\right@\p@r@end}% \let\initlabels\initstyle % for compatibility with version 2.03 % \long\def\init@labels[#1]#{\init@@labels[#1]}% \long\def\init@@labels[#1]#2#{\init@@@labels[#1]#2}% \long\def\init@@@labels[#1]#2#3{\def\labels@initiated{}\let\next\relax \ifISLATEX \ifx\ENDINPUT\undefined@ \def\temp@macro{#2}% \ifx\temp@macro\empty\temp@toks={article}\else\temp@toks={#2}\fi \temp@@toks={#3}\edef\temp@@macro{\noexpand\documentstyle [#1]{\the\temp@toks}\the\temp@@toks\noexpand\begin{document}}% \else\def\temp@@macro{}\fi \else \def\temp@@macro{}\message{}% \wlog{(\string\initstyle\space ignored for plain TeX)}\fi \temp@@macro}% % % \def\initclass{\push{% \edef\next@@{\noexpand\init@class[\the\p@r@one][\the\p@r@two]}% \popnil\clrp@r@s\next@@}\st@ckparas\left@\right@\left@\right@\p@r@end}% % \long\def\init@class[#1][#2]#{\init@@class[#1][#2]}% \long\def\init@@class[#1][#2]#3#{\init@@@class[#1][#2]#3}% \long\def\init@@@class[#1][#2]#3#4{\def\labels@initiated{}\let\next\relax \ifISLATEX \ifx\ENDINPUT\undefined@ \def\temp@macro{#3}% \ifx\temp@macro\empty\temp@toks={article}\else\temp@toks={#3}\fi \temp@@toks={#4}\edef\temp@@macro{\noexpand\documentstyle [#1]{\the\temp@toks}\the\temp@@toks\noexpand\begin{document}}% \ifx\documentclass\undefined@\else \edef\temp@@macro{\noexpand\documentclass[#2]{\the\temp@toks}% \noexpand\read@style[,]{#1}\the\temp@@toks \noexpand\begin{document}}% \fi \else\def\temp@@macro{}\fi \else \def\temp@@macro{}\message{}% \wlog{(\string\initclass\space ignored for plain TeX)}\fi \temp@@macro}% % \def\readstyles#1{\xdef\EntryReadStyle{\the\catcode`\@}\catcode`\@=11\relax \read@style[,]{#1}\catcode`\@=\EntryReadStyle\relax}% % \def\read@style[#1]#2{\def\one@item##1#1##2\safty@mark{\temp@toks={##1}% \expandafter\input@a@style\the\temp@toks..\safty@mark\def\temp@macro{##2}% \ifx\temp@macro\empty\else\def\temp@macro{\one@item##2\safty@mark}\fi \temp@macro}\one@item#2#1\safty@mark }% \def\input@a@style#1.#2.#3\safty@mark{\def\temp@macro{#2}% \ifx\temp@macro\empty\def\temp@macro{sty}\fi\def\temp@@macro{#1.}% \temp@toks=\expandafter\expandafter\expandafter {\expandafter\temp@@macro\temp@macro}\def\temp@@macro{#1}% \ifx\temp@@macro\empty\else\ifx\temp@@macro\space\else \expandafter\inputfile\expandafter{\the\temp@toks}\fi\fi }% % % \def\labelsquit{\push{% \edef\next@@{\noexpand\labels@quit[\the\p@r@one][\the\p@r@two]% [\the\p@r@three][\the\p@r@four][\the\p@r@five][\the\p@r@six]}% \popnil\clrp@r@s\next@@}\st@ckparas \left@ 20pt\right@ \left@ \tt\raggedright\right@ \left@ 1\right@ \left@ 1\right@ \left@ 2.6in\right@ \left@ 2em\right@ \p@r@end}% % \def\labels@quit[#1][#2][#3][#4][#5][#6]#{% \labels@@quit[#1][#2][#3][#4][#5][#6]}% \def\labels@@quit[#1][#2][#3][#4][#5][#6]#7{% \ifISLATEX \else\def\labels@initiated{}\fi \ifx\labels@initiated\undefined \message{}\wlog{(\string\initstyle\space must be activated first)}% \let\next\relax \else \def\temp@macro{#7}% \ifx\temp@macro\empty\def\temp@macro{\jobname}\fi \ifx\ENDINPUT\undefined \temp@toks={[#1][#2][#3][#4][#5][#6]}% \message{(Re-read \jobname.tex)}% \edef\next{\noexpand\beginlabels \the\temp@toks\noexpand\input \temp@macro}% \else \def\next{\endlabels\end{document}}\fi \let\ENDINPUT\relax \fi \next}% % % % WRITE FILE % \catcode`\^^M=13\relax % % % \temp@read, \name@endtoks and \true\end@toks must be given on entry \long\def\file@chkline#1^^M{\test@tokstr{\the\name@endtoks}{#1}% \iftemp@if \temp@toks=\expandafter{\first@half}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if\else \expandafter % \immediate\write\expandafter\temp@read\expandafter{\first@half}\fi % \immediate\closeout\temp@read \temp@toks=\expandafter{\second@half}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if \else\message{}\wlog{(Ignored: \the\temp@toks)}\fi % \edef\buffer@{\the\true@endtoks}% \else \expandafter\immediate\expandafter % \write\expandafter\temp@read\expandafter{\first@half}% \let\buffer@\file@chkline % \fi \buffer@ }% % \def\beginfile{\push{% \edef\next@@{\noexpand\begin@file[\the\p@r@one]}% \popnil\next@@}\st@ckparas\left@\right@\p@r@end}% % \def\begin@file[#1]#{\begin@@file[#1]}% \def\begin@@file[#1]#2{\save@catcodes[RAW][0][\MAX@CHR@CODE][]% % #1=token to end the list, #2=filename \edef\temp@macro{#2}% \ifx\temp@macro\empty \def\temp@macro{scr@tch@.tex}\fi % \wlog{(File <\temp@macro> written)}% \immediate\openout\temp@read=\temp@macro \def\temp@macro{#1}% \ifx\temp@macro\empty \temp@toks=\expandafter{\esc@}% \name@endtoks=\expandafter{\the\temp@toks endfile}% \else \name@endtoks={#1}\fi\true@endtoks={\endlinemode\endrawlinemode}% \rm@ligature\set@space\set@tab\raw@chars[11][11][11][13][13]\let\ =\space % \def\temp@macro##1^^M{% \test@tokstr{\the\name@endtoks}{##1}% \iftemp@if\else \temp@toks={##1}% \expandafter\is@emptyline\expandafter{\the\temp@toks}% \iftemp@if\else \expandafter\immediate\expandafter % \write\expandafter\temp@read\expandafter{\the\temp@toks}\fi % \fi % \test@tokstr{\the\name@endtoks}{##1}% \iftemp@if \temp@toks=\expandafter{\first@half}% \temp@@toks=\expandafter{\second@half}% \edef\temp@@macro{\noexpand\file@chkline % \the\temp@toks\the\name@endtoks\the\temp@@toks\noexpand^^M}% \else\def\temp@@macro{\file@chkline}\fi\temp@@macro }% \temp@macro }% % \catcode`\^^M=5\relax% % % % FONTS % %\font\BOLD=cmbx10 at 24.88pt \font\hbold=cmbx10 at 20.74pt %\font\lbold=cmbx10 at 17.28pt \font\bbold=cmbx10 at 14.4pt %\font\bold=cmbx10 at 12pt \font\sbold=cmbx8 %\font\tbold=cmbx5 \font\ssan=cmss8 %\font\SAN=cmss10 at 24.88pt \font\hsan=cmss10 at 20.74pt %\font\lsan=cmss10 at 17.28pt \font\bsan=cmss10 at 14.4pt %\font\san=cmss10 at 12pt \font\nsan=cmss10 %\font\ROMAN=cmr10 at 24.88pt \font\hroman=cmr10 at 20.74pt %\font\lroman=cmr10 at 17.28pt \font\broman=cmr10 at 14.4pt %\font\roman=cmr10 at 12pt \font\sroman=cmr8 %\font\troman=cmr5 \font\stt=cmtt8 % % % LEAVE MACROS % \let\wlog\temp@@@macro\let\temp@@@macro\undefined@ % \catcode`\@=\EntryFormLett\relax \endinput % %ENDMACROS