%Tools database to cooperate with blue.tex %Januari 95, cgl@rc.service.rug.nl %To print the formats properly, copy %the following 11-lines job and %substitute the semicolon token %(=escape char) for `semi-col'. (2x) % ---Kees--- %\input blue.tex %\hfuzz25pt %\title{File: tools.dat} %\issue{Version 1.0} %\beginscript %\thisverbatim={\catcode`\`semicol'=0 % \catcode`\!=12 % \catcode`\|=12 % \input tools.dat} %\beginverbatim %`semi-col'endverbatim %\endscript % % % %Syntax included tools %\tool\tool %...the file which otherwise would %...have been input %\endinput %Disadvantages: %-No outer defs allowed. % (\newtoks\x via \csname x\endcsname) %-No \par-s, use \endgraf % % % %Contents: %- binarytreetool %- bridgetool %- crosswordstool %- hanoitool %- indextool % (Sorting in BLUe, quick.tex % heap.tex and BLUe's Index) %- language english, russian %- ntglogo %- smileys %- xyztool %- partlogotool %- pascaltool % % % %Tools are sorted on name. %;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%binarytree% \tool\bintreetool %Because redefined in manmac & BLUe's system. \catcode`\^=7 % \def\startbintree{\catcode`\^^M=9 \nodes}%neglect e-o-l % \def\nodes#1#2{\ifx\sedon#2 \levelone#1 \sedon\fi \ea\def\csname#1\endcsname{#2}\nodes} \def\sedon#1\nodes{\fi \setbintree\endgroup} \let\endbintree\sedon % \def\fork{\vbox{\offinterlineskip %Connection lines ____|____ % | | \hbox{\ea%empty branche? \ifx\csname\the\ltree\the\m \endcsname\relax \vrule width\tophnshalf height0pt depth0pt \else%non-empty branche \vrule height\vnodesep \vbox to\vnodesep{\hrule width\tophnshalf\vss}% \kern-.2pt\vrule height 2\vnodesep depth-\vnodesep\relax \fi\advance\m1 \ea%empty branche \ifx\csname\the\ltree\the\m \endcsname\relax \vrule width\tophnshalf height0pt depth0pt \else%non-empty branch \kern-.4pt\vrule height 2\vnodesep depth-\vnodesep\relax \vbox to\vnodesep{\hrule width\tophnshalf\vss}% \vrule height\vnodesep\relax \fi}\kern1ex%Separation below %connection lines %The sibling nodes \hbox to\tophns {\hbox to0pt{\strut\hss \csname\the\ltree\the\m \endcsname\hss}\hss \global\advance\m1 \hbox to0pt{\strut\hss \csname\the\ltree\the\m \endcsname\hss}}}} % \def\setbintree{%level >=1 \ltree0 \m0 %bounds for recursion \lu1 %dynamic for the rows \advance\levelone1 %defaults \tophns30ex \vnodesep3ex %hook to override defaults if neede \the\everybintree \the\thisbintree %dependent quantities \treewidth3\tophns \tophnshalf\tophns \divide\tophnshalf2 %root, level 00 \vbox{\levelline{\vbox{\offinterlineskip \hbox to0pt{\strut\hss \csname\the\ltree\the\m \endcsname\hss}}}% \loop\advance\ltree1 \multiply\lu2 \levelline{\noindent\m1 \fork \loop\ifnum\m<\lu \kern\tophns \advance\m1 \fork \repeat}\tophns\tophnshalf \divide\tophnshalf2 \ifnum\ltree<\levelone \repeat}\thisbintree{}}%end \bintree % \def\levelline#1{\hbox to\treewidth{\hss#1\hss}} \endinput %end%%%%%%%%%%%%%%%%%%%%binarytreel%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%b(inary)t(ree)l%!cgl;newcol \tool\bttool \message{ ---bttool, Aug 95, cgl--- } \def\drawbt{\whiteS{120}% \trttxt{\hss{\small\csname\node\endcsname}}% \ea\ifx\csname\node0\endcsname\relax \tbward\fi%Backtrack \S{80}\advance\k-125 {\W{\the\k}\S{80}\edef\node{\node0}% \drawbt}% \E{\the\k}\S{80}\edef\node{\node1}% \drawbt\relax} \def\tbward#1\relax{\fi} % \everybt{\k1024\unitlength.02ex\x0pt\y0pt} %\thisbt{} \prebt{$$\multiply\count1by280 \ea\ydim\ea{\the\count1} \ea\yoffset\ea{\ea-\the\count1}} \postbt{$$} \obeylines% \def\bt#1 #2 {\ifx\endbt#2\count1=#1 \tbdne\fi% \ea\def\csname#1\endcsname{#2}\bt}% \def\tbdne#1\bt{\fi\def\node{1}% \the\prebt\the\everybt\the\thisbt% \beginpicture\drawbt\endpicture% \the\postbt\endgroup}% \endinput %end%%%%%%%%%%%%%%%%%b(inary)t(ree)l%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%brd% \tool\bridgetool \message{ ---bridgetool, Jan 95, cgl--- } %Typesetting bridge publications %via (plain) TeX. Version May 92. %The macros can als be used within LaTeX. %Version: 1.1 March 1994 (basically %unmodified since publication in 1990) %Author: Kees van der Laan % Hunzeweg 57, 9893PB, Garnwerd (Gr) % The Netherlands. 05941-1525, % cgl@rc.service.rug.nl %Examples of use have been published in %TUGboat, 11, 2, 265--276, and MAPS 91.2. %(A few are appended at the end.) %The macros consists of 3 indep. parts: %- dec.tex ((language) declarations, % used register and % control sequences) %- bid.tex (macros for bidding and % layout of games) %- play.tex (macros for discussing the % course of a play) % %;numvrb %%%%%%%dec.tex%%%%%%% %Card definitions \def\sp{$\spadesuit$} \def\h{$\heartsuit$} \def\d{$\diamondsuit$} \def\cl{$\clubsuit$} %(Toks register) control sequences %for hands used by play macros: %showgame, pc, strip \ea\let\ea\NT\csname newtoks\endcsname \NT\hnd%Dynamically one of: \NT\Ns\NT\Es\NT\Ss\NT\Ws \NT\Nh\NT\Eh\NT\Sh\NT\Wh \NT\Nd\NT\Ed\NT\Sd \NT\Wd %Beware! Already %in TUGboat.sty in lower case \NT\Nc\NT\Ec\NT\Sc\NT\Wc % \def\bridgeenglish{ %In central figure NESW \def\N{N}\def\E{E}\def\S{S}\def\W{W} %In heading bplay \def\NS{NS}\def\EW{EW} \def\TRICK{Trick} %Definition of hands %used by bbid \def\FIH{North}\def\SEH{East} \def\THH{South}\def\FOH{West} }% end \bridgeenglish \bridgeenglish%default % \def\LEADN{\gdef\FIP{N}\gdef\SEP{E}% \gdef\THP{S}\gdef\FOP{W}} \def\LEADE{\gdef\FIP{E}\gdef\SEP{S}% \gdef\THP{W}\gdef\FOP{N}} \def\LEADS{\gdef\FIP{S}\gdef\SEP{W}% \gdef\THP{N}\gdef\FOP{E}} \def\LEADW{\gdef\FIP{W}\gdef\SEP{N}% \gdef\THP{E}\gdef\FOP{S}} %Definition of counters %used by bplay \csname newcount\endcsname\trno %trick number %Definition of dimensions used in bbid \csname newdimen\endcsname\wr %width column \wr=7ex \relax \def\bidwidth{4\wr} %used in crdima \csname newbox\endcsname\NESW % \def\dutch{ \def\FIH{Noord}\def\SEH{Oost} \def\THH{Zuid}\def\FOH{West} \def\N{N}\def\E{O}\def\S{Z} \def\W{W}\def\EW{OW}\def\NS{NZ} \def\TRICK{Slag} \setbox\NESW\hbox{\NESWfig} }%end \dutch % \def\french{ \def\FIH{Nord}\def\SEH{Est} \def\THH{Sud}\def\FOH{Ouest} \def\N{N}\def\E{E}\def\S{S} \def\W{O}\def\EW{EO}\def\NS{NS} \def\TRICK{Lev\'ee} \setbox\NESW\hbox{\NESWfig} }%end \french %end input dec.tex % %%%%%%%bid.tex%%%%%%% %Modified central figure \def\hand#1#2#3#4{% %Example: \hand{AKJ765}{AK9}{--}{T983} \vtop{\hbox{\strut\sp\enspace#1} \hbox{\strut\h\enspace#2} \hbox{\strut\d\enspace#3} \hbox{\strut\cl\enspace#4}}%end \vtop }%end \hand % \def\crdima#1#2#3#4#5#6{% %purpose: layout bridge hand %#1 left upper text %#2 right upper text %#3, #4, #5, #6: N, E, S, W hands \vbox{\halign{ &##\quad\cr #1& #3& #2\cr $\vcenter{#6}$&$\vcenter{\copy\NESW}$& $\vcenter{#4}$\cr & #5& \cr }%end \halign }%end \vbox }%end \crdima % \def\NESWfig{% \hbox{\vrule \vbox{\offinterlineskip\tabskip0pt \hrule\kern.25ex\halign{\hskip.5ex ##\tabskip.5ex&\hfil##\hfil& ##\hskip.5ex \tabskip0pt\cr \noalign{\vskip.5ex} &\hbox to 2ex{\hss\N\hss}& \cr \noalign{\vskip.25ex} \kern.25ex\W& &\E\kern.25ex \cr\noalign{\vskip.25ex} &\hbox to 2ex{\hss\S\hss}& \cr \noalign{\vskip.5ex} }%end \halign \kern.25ex\hrule}%end \vbox \vrule}%end \hbox }% end \NESWfig \setbox\NESW\hbox{\NESWfig} % \def\ebid{\errormessage{% bbid command is missing}} % \def\bbid{\bgroup% \def\ebid{\egroup\egroup\egroup} \def\alert{$^A$} \def\think{$\ldots$\thinspace} % etc. \vtop\bgroup \halign to\bidwidth\bgroup \tabskip2ex plus 1ex minus 1ex& ##\hfil\cr \FIH\hfil& \SEH\hfil& \THH\hfil&\FOH\hfil\cr \noalign{\vskip.5ex} }%end \bbid %end input bid.tex% % %%%%%%%play.tex%%%%%%% %\input{play.tex} %Modified 11/11/91 Central table %\bplay etc % bplay, showgame, pc, strip \def\eplay{\errormessage{% bplay command is missing}} % \def\bplay{\bgroup\global\trno=0 \def\eplay{\egroup\egroup} \def\bintermezzo{\noalign\bgroup \smallskip\noindent} \def\eintermezzo{\smallskip\egroup} \tabskip1ex plus 1fill \halign to\hsize\bgroup \tabskip1ex plus 1ex minus 1ex \global\advance\trno by 1 % \hbox to.5\wr{\hss\the\trno\hss}%<=! \hbox to\wr{\pc\FIP##\hss}\hfil& \hbox to\wr{\pc\SEP##\hss}\hfil& \hbox to\wr{\pc\THP##\hss}\hfil& \hbox to\wr{\pc\FOP##\hss}\hfil \tabskip4ex plus2ex minus1ex& \hbox to.5\wr{\hss##\hss} \tabskip1ex plus 1ex minus 1ex& \hbox to.5\wr{\hss##\hss} \tabskip1ex plus 1fill\cr %End template line, next is headline \omit\hbox to1\wr{\TRICK\hss}\hfil& \omit\hfil&\omit\hfil&\omit\hfil& %Note only 3 \omits \NS&\EW\cr%Headline }% end \bplay % \def\pc#1#2#3{% Version 3/3/90 %Function: prints card #2#3 and % deletes it from player #1 %#1 the hand N, E, S, W(uppercase) %#2 colour s, h, d, or c %#3 card value A K Q ... 2, or x %(or your (consistent/language) choice) %%%% 1. Update hand \#1#2; e.g. \Ns %%% \xdef\hnd{\csname #1#2\endcsname} \strip{#3}{\hnd}% %%%% 2. print card in table %%% \xdef\colour{\csname #2\if#2cl\else \if#2sp\fi\fi\endcsname} \colour\thinspace #3% % %Needed for immediate postfix mark(s) }% end \pc % \def\strip#1#2{% Version 3/3/90 %Function: deletes card value #1 % from #2, i.e., \Ns, or ... \def\wis##1#1##2\wis{% %Function: #1 is deleted from argument % in \wis ... \wis and result % is assigned to \hnd % (last card is replaced by --) \global\hnd={##1##2} \xdef\pa{##1} \xdef\pb{##2} \ifx\pa\empty {\ifx\pb\empty \global\hnd={--}% void colour \fi}\fi }% end \wis \expandafter\wis\the #2\wis }% end \strip % \def\showgame{ %Purpose: Shows all cards still active % in the play, via \Ns, ..., \Wc, % (note use of upper case for players) %Used: \crdima, \hand, \LFTINF, \RGTINF % \Ns, ..., \Wc $$\crdima{\LFTINF}{\RGTINF}% {\hand{\the\Ns}{\the\Nh}{\the\Nd}% {\the\Nc}}% {\hand{\the\Es}{\the\Eh}{\the\Ed}% {\the\Ec}}% {\hand{\the\Ss}{\the\Sh}{\the\Sd}% {\the\Sc}}% {\hand{\the\Ws}{\the\Wh}{\the\Wd}% {\the\Wc}}% $$}% end \showgame %end input play.tex %In total: 215 lines \endinput %Examples: diagram, bidding, course of play. % %\hsize=.5\hsize %1. Diagram %$$\crdima{N/None}{\vtop{\hbox{Deal:} % \hbox{demo}}}% % {\hand{J74}{AJ}{QJT2}{Q874}}%N % {\hand{K86}{T9542}{874}{T3}}%E % {\hand{QT952}{Q83}{AK5}{A6}}%S % {\hand{A3}{K76}{963}{KJ952}}%W %$$ %2. Bidding %$$\bbid %1\cl\alert& ? no& 1\sp&\think no\cr % 2\sp& no& 4\sp& a.p.\cr %\noalign{\vskip.5ex} %\alert\ means Alert, % conventional bid\hidewidth\cr %? means explanation % asked\hidewidth\cr %\think means think %% pause\hidewidth\cr %\ebid $$ %3. Course of play %\def\LFTINF{Puzzle} %\def\RGTINF{\vtop{\hbox{6NT,} % \hbox{by East}}} % %\Ns={KQ76}\Es={T9}\Ss={8542}\Ws={AJ3} %\Nh={J98} \Eh={A2}\Sh={QT74}\Wh={K653} %\Nd={J942}\Ed={T5}\Sd={Q876}\Wd={AK3} %\Nc={65}\Ec={KJ9xxxx}\Sc={2}\Wc={AQT} % %\showgame % %*Problem* How must NS defend in %order to guarantee 1 trick? % %*Solution* Start with a \h\ %lead in order to break communication. %N must discard \h s %and S must discard \sp s. %\smallskip\noindent %\LEADS %\bplay %%\noalign{\LEADS} %h4! & hK & h8 & h2 & -- & 1\LEADW\cr %%\noalign{\LEADW} %cA & c5 & cx & c2 & -- & 2\cr %cQ & c6 & cx & s2 & -- & 3\cr %cT & h9 & cK & s4 & -- & 4\LEADE\cr %%\noalign{\LEADE} %cJ & s5 & s3 & s6 & -- & 5\cr %c9 & s8 & h5 & s7 & -- & 6\cr %cx & d6 & sJ & d2 & -- & 7\cr %\bintermezzo %On lead of the next \cl\ %neither South nor North can be %squeezed as can be seen from% %\def\RGTINF{\vtop{\hbox{NS squeezed on} % \hbox{\c\ continuation?}}} %\showgame %with continuation %\eintermezzo %cx & h7 & h6 & hJ & -- & 8\cr %dT & d7 & dA & d4 & -- & 9\LEADW\cr %%\noalign{\LEADW} %dK & d9 & d5 & d8 & -- & 10\cr %h3 & dJ & hA & hT & -- & 11\LEADE\cr %\noalign{\LEADE} %sT & hQ & sA & sQ & -- & 12\LEADW\cr %\noalign{\LEADW} %d3 & sK & s9 & dQ & 1 & 12\cr %\eplay %\bye %;nonum % %Contents % %Declarations. % Newtoks, \NT alias.............10 % \hnd, \Ns, \Es, \Ss, \Ws....12 % \Nh, \Eh, \Sh, \Wh....13 % \Nd, \Ed, \Sd, \Wd....14 % \Nc, \Ec, \Sc, \Wc....17 % \bridgeenglish..............19-30 % \dutch......................51-58 % \french.....................60-67 % \N, \E, \S, \W..............21 % \NS, \EW....................23 % \TRICK......................24 % \FIH, \SEH, \THH, \FOH...27-28 % \sp, \h, \cl, \d..............3-6 % \LEADN \LEADE \LEADS \LEADW 32-38 % Newcount % \trno.......................42 % Newdimen % \wr.........................46 % \bidwidth{4\wr}.............47 % Newbox % \NESW...................49, 111 % % \hand........................72-78 % \crdima......................80-92 % \bbid, \ebid......116-127, 113-114 % \alert.......................118 % \think.......................119 %%%%%%%play.tex%%%%%%% % \bplay, \eplay....138-162, 135-136 % \bintermezzo, \eintermezzo 140-142 % \pc........................164-179 % \hnd.........................172 % \colour......................175 % \strip.....................181-196 % \showgame..................198-213 % Examples % diagram..................219-226 % bidding..................227-238 % course of play...........239-289 % %History of changes %July 1994 \c and \s changed into % \cl and \sp, % \colour adapted %March 1994 Prepared for NTG's CD-ROM % Examples of use added % NESW figure adapted %Jan 1994 Submitted to CTAN. %end%%%%%%%%%%%%%%%%%%%%%%%bridge%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%crs% \tool\crosswordstool \message{ ---crosswordstool, Jan 95, cgl--- } %From Typesetting crosswords via TeX %EuroTeX 92, MAPS 92.1 %NOTE In order to use natural input, %spaces except for the last one, and not %let this choice for ;] (space=\relax) %work through globally, start with %\bgroup\obeyspaces\let =\relax %\bdata % %\edata %$$\crw$$%(or \sol) %\egroup %;numvrb \puzzletrue \csize3ex % %;numvrb %;vrblin99 \def\bdata{\bgroup\obeylines\obeyspaces% \store} \def\store#1\edata{\egroup\def\data{#1}} %{\obeyspaces\global\let =\relax} \def\usersize{} % ;vrblin=199 {\catcode`\^=7 \catcode`\^^M=13 %local scope \gdef\crw{\cnt0\relax\boxit{\usersize% \hrule\ea\fifol\data\lofif^^M}}% \gdef\sol{\boxit{\def\num{}\puzzlefalse% \usersize\hrule\ea\fifol\data\lofif^^M}}% \gdef\fifol#1^^M{\ifx\lofif#1\lofif\fi% \processl{#1}\fifol}}%end local scope% % %;vrblin=299 \def\lofif#1\fifol{\fi} \def\processl#1{\hbox{\fifo#1\ofif}\hrule} \def\fifo#1{\ifx\ofif#1\ofif\fi% \process#1\fifo} \def\ofif#1\fifo{\fi} % \def\process#1{\if*#1\cc\else% \ifx\relax#1\cc\else% \ifnum`#1=\uccode`#1\capchar#1\else% \lowchar#1\fi\fi\fi} \def\lowchar#1{\hbox to\csize{\vrule height.8\csize depth.2\csize\relax% \ifpuzzle\null\else\hss\uppercase{#1}% \fi\hss\vrule}} \def\capchar#1{\hbox to\csize{\vrule height.8\csize depth.2\csize\relax% \num\ifpuzzle\null\else\hss#1\fi% \hss\vrule}} \def\cc{\vrule height.8\csize depth% .2\csize width\csize} % \def\num{\global\advance\cnt1\relax% \vbox to.8\csize{\rlap{\kern1pt% \fiverm\the\cnt\hss}\vfil}}% % %;vrblin=399 \def\boxit#1{\vbox{\hrule\hbox{\vrule% \vbox{#1}\vrule}\hrule}}% cgl, oct92 \endinput %;nonum %Contents %\newif % \ifpuzzle (blue.tex) %\newcount % \cnt (blue.tex) %\newdimen % \csize (blue.tex) %Data % \bdata........................100 % \store........................102 % \edata........................102 % \usersize.....................104 %Crw % \crw..........................201 % \sol..........................203 %Auxiliaries % \fifol........................205 % \process, \processl......305, 301 % \lofif........................300 % \lowchar......................309 % \capchar......................313 % \cc...........................317 % \num..........................320 % \boxit........................400 %History of changes %July 1994 In tools.dat to cooperate % with blue.tex % \global\let =\relax removed. %Jan 1994 Submitted CTAN %1992 Submitted to EuroTeX and MAPS %end%%%%%%%%%%%%%%%%%%%%%%%%%crs%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%hanoi% \tool\hanoitool \message{ ---hanoitool, Jan 95, cgl---} %Tower of Hanoi macros %hanoi.tex version 19 dec 91 %;numvrb %\hanoi changed into \sethanoi June 95 %\n=number of disks \brd=breadth towers %\hgt=height tower \dskhgt=height disk \csname newcount\endcsname\n \csname newcount\endcsname\brd \csname newcount\endcsname\hgt \csname newcount\endcsname\dskhgt \def\preloop{%To create loopcnt, a %local loopcounter %(see also loopy.TeX). \bgroup \advance\count10 by 1 \countdef\loopcnt=\count10 %Symbolic name \loopcnt=1 %(default) }%end \preloop \def\postloop{\loopcnt=0 %Restore \egroup}%end \postloop % %Hanoi macros, top level \def\sethanoi#1{%Argument can be digit(s) %or a counter (numeric) \n=#1 %Assign argument value to \n \def\II{}\def\III{}%Empty towers %Next is inspired by the TeXbook, %p374, 378 %The initial tower for \I is created %The initial tower for \I is created % \def\I{\disksep\i\disksep\ii % \disksep\iii...\disksep\`n'} %next to the defs for \i,\ii,...\`n'. \preloop\ag\def\ag\I\ag{% \loop \ea\xdef\csname\romannumeral\loopcnt \endcsname{\the\loopcnt} \ag\disksep%separator \ea\ag\csname \romannumeral\loopcnt\endcsname \ifnum\loopcnt<\n \advance\loopcnt by 1 \repeat \ag} \postloop %For printing, values are needed for \brd=\n %Breadth of largest disk \advance\brd by 3 %Little room extra \dskhgt=1 %Height of disks \hgt=\n\multiply\hgt by2 %\hgt is height \advance\hgt by1 %of towers \showtowers %Print initial state \Hanoi\I\II\III\n }%end \sethanoi % \def\Hanoi#1#2#3#4{%Moves from #1 to #2, %with aid of tower #3. %The number of disks is #4, in a counter. \ifnum#4=1 %For Tower of 1 disk, %just move the disk \movedisk\from#1\to#2% \showtowers%Print towers after move \else%Problem of #4 disks is solved by %- problem of (#4-1) disks, %- a move, and %- a problem of (#4-1) disks. {\advance#4 by-1 \Hanoi#1#3#2#4}% \movedisk\from#1\to#2% \showtowers%Print towers after move {\advance#4 by-1 \Hanoi#3#2#1#4}% \fi}%end \Hanoi % %Moving of the disks, TeXbook, App. D.2 %Slightly adapted versions of \lop ( %called \movedisk with function that %first element of #1 is prefixed to #2) %and \lopoff modification \def\movedisk\from#1\to#2{%Move disk from %tower #1 to tower #2 \ea\lopoffx#1\lopoffx#1#2} \def\lopoffx\disksep#1#2\lopoffx#3#4{\ea \gdef\ea#4\ea{\ea\disksep\ea#1#4} \gdef#3{#2}%restore stub}%end\lopoffx }%end \movedisk % %Printing tower status \def\showtowers{%Display pyramids \endgraf\quad\hbox{\pt\I\ \pt\II\ \pt\III }\endgraf }%end \showtowers % %Auxiliaries \def\gobble#1{}%To eat character % \def\disksep#1{\hbox to\brd ex{\hss \vrule width#1ex height\dskhgt ex \hss}% }%end \disksep % \def\pt#1{%Print Tower. %#1 is \I, \II, or \III \vbox to\hgt ex{\baselineskip=.2ex\vss #1% %Format pointer underneath \hbox to\brd ex{\hss \ea\gobble\string#1\hss}% }%end vbox }%end \pt \endinput %;nonum %Contents %\Hanoi .........................51--66 %\hanoi .........................19--49 %\movedisk ......................73--79 %\showtowers ....................82--85 %Auxiliaries % \preloop .....................8--15 % \postloop ...................16--17 % \lopoffx ....................76--78 % \gobble .........................88 % \disksep.....................90--93 % \pt ........................95--103 %History of changes %Jan 95 \\ changed into \disksep %March 1994 Contents added % From tugboat.sty into tug.ppt % 1991 MAPS and TUGboat versions %end**%%%%%%%%%%%%%%%%%%%%%%%sort%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%sort% \tool\indextool \message{ ---indextool, Jan 95, cgl--- } %Shorthands ;numvrb %Counters in blue.tex %\newcount\n %\newcount\k %\newcount\kk\n=0 %\newcount\kzero\kzero0 %Bias value %\newcount\pk %\newcount\pkone%Used in sortcs %\newcount\frst%First value of range %\newcount\last %Last value of range %\newcount\slast%Successor \last %\newcount\dif %Difference \last-\frst %\newcount\nw %Number of words %\newcount\nc %Number of chars/comp %\newcount\numex %Number of exchanges %\newcount\rndval%Random number %\newcount\rndnum%Seed random generator %\newcount\rndtmp%Temporary value %\newcount\status%Status comparison %;vrblin=100 %Storing: from copy \def\seq#1\qes{\k0 \fifow#1 \wofif{} } %Auxiliaries: FIFO \def\fifow#1 {\ifx\wofif#1\n\k\wofif\fi \processw{#1}\fifow} \def\wofif#1\fifow{\fi} \def\processw#1{\advance\k1 \ea \gdef\csname\the\k\endcsname{#1}} % %Storing: from file \def\storefrom#1{%#1 is file name \immediate\openin\inx=#1 \k\kzero \continuetrue \loop\ifeof\inx\continuefalse\fi \ifcontinue\advance\k1{}% \read\inx t\ea o\csname\the\k\endcsname \repeat\advance\k-1\n\k \immediate\closein\inx} % %Storing: random numbers \def\storerandomn#1{%#1 number of numbers \n#1\k0 \loop\ifnum\k<\n\advance\k1 \rnd\ea \xdef\csname\the\k\endcsname{\the\rndval} \repeat} % %With, due to Reid, 1987 %Moved into kernel blue.tex %\def\rnd{\global\multiply\rndnum371{}% % \global\advance\rndnum1{}% % \ifnum\rndnum>99999\relax % \rndtmp\rndnum \divide\rndtmp100000 % \multiply\rndtmp100000 % \global\advance\rndnum-\rndtmp % \fi\global\rndval\rndnum % \global\divide\rndval1000 } % %Storing: random words \def\storerandomw#1{%#1 number of words \n#1\nw\n\def\defarr{\ea\gdef \csname\the\nw\endcsname} {\loop\ifnum0<\nw{\ag\defarr\ag{% \randomword}}\advance\nw-1 \repeat}}%end s-r-w. % \def\randomword{\rnd \nc\rndval \divide\nc15 \advance\nc2 \loop\ifnum0<\nc\randomchar \advance\nc-1 \repeat}%end r-word % %Random character is modified \def\randomchar{\rnd \multiply\rndval29 \divide\rndval100 \ifnum26=\rndval\rndval0 \fi \ifnum26<\rndval\rndval4 \fi %Mod cgl: I \ag-ed the letter \ea\ag\ifcase\rndval a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\fi}%end r-char %;vrblin=200Typeset %Parameters: Separators \def\sepn{, }%Number separator \def\sepw{ } %Word separator %\csname newtoks\endcsname\indword \let\sep\sepw % \def\prc#1{\init{#1}\def\prc##1{% \ifnum\last=##1{}\else\ifnum\slast=##1{}% \last\slast\advance\slast1{}\else \prtfl\sepn\init{##1}\fi\fi}} % \def\init#1{\frst=#1\last=#1\slast=#1{}% \advance\slast1{}} % %Print range: \frst-\last (or \last). \def\prtfl{\the\frst\ifnum\frst<\last \advance\frst1{}\ifnum\frst=\last\sepn \else\nobreak--\nobreak\fi\the\last\fi} % %Printing sequences \def\prts{{\k\kzero%print \1...\n \def\sep{\let\sep=\sepw}% \loop\ifnum\k<\n\advance\k1 \sep\csname\the\k\endcsname \repeat}}%end \prts % \let\prtw=\prts % \def\prtn{{\k\kzero%Print number sequence \loop\ifnum\k<\n\advance\k1 \ea\prc\csname\the\k\endcsname \repeat\prtfl}}%end \prtn % \def\typindentry#1{%#1 a def \ea\splitintoks#1% \ifcase\digit\the\indword\or {\tt\the\indword}\or {\tt\char92\the\indword}\or $\langle\hbox{\the\indword}\rangle$\fi{} {\oldstyle\pagenrs}.} \def\hyphen{{\rm-}} \def\comma{{\rm, }} % \def\splitintoks#1 !#2 #3.{\indword{#1}% \chardef\digit=#2{}\def\pagenrs{#3}} % \def\prtind{{\k\kzero \def\sep{\let\sep\sepw}% \loop\ifnum\k<\n\advance\k1 \sep\ea\typindentry\csname\the\k\endcsname% \repeat}} %;vrblin=300 %Sorting in O(nlog n) \def\sortn{\let\cmp\cmpn\sort\prtn} % \def\sortaw{\let\cmp\cmpaw\sort\prtw} % \def\sortw{\let\cmp\cmpw{\accdef\sort}\prtw} % \def\sort{\heapsort} % %Paramaters: ij and accent string \def\accstr{\`\'\"\^\c} % \def\accdef{\def\i{i}\def\j{j}% \def\'##1{##1a}\def\`##1{##1g}% \def\"##1{##1t}\def\^##1{##1h}% \def\c##1{##1c}} % \def\ij{ij} % %Sorting parameters: exchange macro \def\xch#1#2{%#1, #2 counter variables \ea\let\ea\auxone\csname\the#1\endcsname \ea\let\ea\auxtwo\csname\the#2\endcsname \ea\global\ea\let\csname\the#2\endcsname \auxone \ea\global\ea\let\csname\the#1\endcsname \auxtwo} % %Sorting parameters: number comparison \def\cmpn#1#2{%#1, #2 are def-s %Result: \status= 0, 1, 2, if % \val{#1} =, >, < \val{#2} \ifnum#1=#2\global\status0 \else \ifnum#1>#2\global\status1 \else \global\status2 \fi\fi} % %Parameters: comparison of words \def\cmpw#1#2{%#1, #2 are def-s %Result: \status= 0, 1, 2, if % \val{#1} =, >, < \val{#2} \let\nxt\nxtw\cmpc#1#2} % \def\cmpaw#1#2{%#1, #2 are defs with as %replacement text the words. %Result: \status= 0, 1, 2, if % \val{#1} =, >, < \val{#2} \let\nxt\nxtaw\cmpc#1#2} % \def\cmpc#1#2{%#1, #2 are def-s %Result: \status= 0, 1, 2, if % \val{#1} =, >, < \val{#2} \ifproof\global\advance\nc1 \let\aa#1\let\bb#2\fi \global\status0 \continuetrue {\loop\ifx\empty#1\continuefalse\fi \ifx\empty#2\continuefalse\fi \ifcontinue\nxt#1\nxtt\nxt#2\nxtu \lge\nxtt\nxtu \repeat}\ifnum0=\status \ifx\empty#1\ifx\empty#2\else \global\status2 \fi \else\ifx\empty#2\global\status1 \fi \fi\fi % \ifproof\immediate\write16{\aa % \ifnum0=\status=\else % \ifnum1=\status>\else % <\fi\fi\bb} % \fi%end ifproof } % \def\lge#1#2{%#1 and #2 letter values %Result: \status= 0, 1, 2, if % #1 =, >, < #2. %and \continuefalse if #1=/#2. \ifnum#1=#2{}\else\continuefalse \ifnum#1<#2\global\status2 \else \global\status1 \fi \fi} % \def\nxtw#1#2{\def\pop##1##2\pop{% \gdef#1{##2}\def\head{##1}}%head and tail \ea\pop#1\pop%split in head and tail \ea\loc\head\accstr%\head is an accent cs? \if<\head\ea\pop#1\pop\fi \iffound\let\acs\head \ea\pop#1\pop%next head and tail \ea\let\ea#2\csname ot\acs\head\endcsname \else\ea\let\ea#2\csname ot\head\endcsname \fi} % \def\loc#1#2{\def\locate##1#1##2\end {\ifx\empty##2\empty\foundfalse \else\foundtrue\fi}\ea\locate#2.#1\end} % %Parameters: for ASCII words \def\nxtaw#1#2{%Result: value of first %letter of string supplied in #1 is delivered %in #2. (To be used as a number (\chardef)). %#1, #2 are control sequences. \def\pop##1##2\pop{\gdef#1{##2}% \chardef#2=`##1{}}\ea\pop#1\pop} % \def\cmpir#1#2{%#1, #2 defs %Result: \status= 0, 1, 2 if % \val{#1} =, >, < \val{#2} %\immediate\write16{Compared are: #1 and #2}% \ea\ea\ea\decom\ea#1#2} % \def\decom#1 !#2 #3.#4 !#5 #6.{% \def\one{#1}\def\four{#4}\cmpw\one\four \ifnum0=\status%Compare secondary keys \ifnum#2<#5{}\global\status2{}\else \ifnum#2>#5{}\global\status1{}\else %Compare tertiary keys \ifnum#3<#6{}\global\status2{}\else \ifnum#3>#6{}\global\status1{}\fi \fi \fi \fi \fi} % \def\red{%Reduction of \1,...,\n \k0\kk0\let\refer\empty \loop\ifnum\k<\n\advance\k1 \ea\let\ea\record\csname\the\k\endcsname \ea\splitwn\record% \ifx\refer\word%extend with number \ea\xdef\csname\the\kk\endcsname{% \csname\the\kk\endcsname, \num}% \else%write record to \kk \advance\kk1\let\refer\word\ea\global \ea\let\csname\the\kk\endcsname\record \fi \repeat\n=\kk} % \def\redrng{%Reduction of \1,...,\n, with %range representation of page numbers {\k1\kk0 \ifnum\n>0 \ea\let\ea\record\csname\the\k\endcsname \ea\splitwn\record\let\refer\word \let\nrsrng\empty\prcrng\num\fi \loop\ifnum\k<\n\advance\k1 \ea\let\ea\record\csname\the\k\endcsname \ea\splitwn\record% \ifx\refer\word%extend \nrsrng with number \prcrng\num \else%write record to \kk \advance\kk1 \strnrs \ea\xdef\csname\the\kk\endcsname{\refer{} \nrsrng.}\let\nrsrng\empty\init\num \prcrng\num\let\refer\word \fi \repeat\ifnum1<\n \advance\kk1 \strnrs \ea\xdef\csname\the\kk\endcsname{\word{} \nrsrng.} \global\n\kk\fi}} % \def\prcrng#1{\init{#1}\def\prcrng##1{% \ifnum##1=\last\else\ifnum##1=\slast \last\slast\advance\slast1 \else \strnrs\init{##1}\fi\fi}} % \let\sepn\comma \def\strnrs{\dif\last\advance\dif-\frst \edef\nrsrng{\ifx\nrsrng\empty\else \nrsrng\nx\nx\nx\sepn\fi\the\frst\ifnum0<\dif \ifnum1=\dif\nx\nx\nx\sepn\the\last \else\nx\nx\nx\hyphen\the\last \fi \fi}} % \def\splitwn#1 !#2 #3.{\def\word{#1 !#2}% \def\num{#3}} % \def\getdig#1 !#2 #3.{\def\dig{#2}} % \def\sortcs{\global\k0\global\pk\n \global\pkone\pk\global\advance\pkone1 %Invariant: 1:k non-cs % pk+1:n control seq-s \loop\global\advance\k1 \ifnum\k<\pkone \ea\ea\ea\getdig\csname\the\k\endcsname.% \if2\dig{\continuetrue \loop \ifnum\k=\pk\continuefalse \else\ea\ea\ea\getdig\csname\the\pk \endcsname.% \if2\dig \else\xch\k\pk\continuefalse \fi \fi\global\pkone\pk\global\advance\pk-1 \ifcontinue \repeat}% \fi \repeat}%Result\1:\pk non-cs, \pkone:\n cs %;vrblin=500 %Parameters: Ordering table %suffix g stands for grave, ` % a stands for aigue, ' % h stands for hat, ^ % t stands for trema, " % c stands for cedille. \ea\chardef\csname ot=\endcsname=12 \ea\chardef\csname ot/\endcsname=11 \ea\chardef\csname ot-\endcsname=13 \ea\chardef\csname ot,\endcsname=14 \ea\chardef\csname ot.\endcsname=15 \ea\chardef\csname ot"\endcsname=9 \ea\chardef\csname ot&\endcsname=5 \ea\chardef\csname ot'\endcsname=7 \ea\chardef\csname ot`\endcsname=8 \ea\chardef\csname ot*\endcsname=10 \ea\chardef\csname ot<\endcsname=28 \ea\chardef\csname ot>\endcsname=29 \ea\chardef\csname ot!\endcsname=30 \ea\chardef\csname ot?\endcsname=31 \ea\chardef\csname ot[\endcsname=13 \ea\chardef\csname ot]\endcsname=14 \ea\chardef\csname ot0\endcsname=16 \ea\chardef\csname ot1\endcsname=17 \ea\chardef\csname ot2\endcsname=18 \ea\chardef\csname ot3\endcsname=19 \ea\chardef\csname ot4\endcsname=20 \ea\chardef\csname ot5\endcsname=21 \ea\chardef\csname ot6\endcsname=22 \ea\chardef\csname ot7\endcsname=23 \ea\chardef\csname ot8\endcsname=24 \ea\chardef\csname ot9\endcsname=25 \chardef\ota=35 \chardef\otA=35 \chardef\otaa=35 \chardef\otag=35 \chardef\otat=35\chardef\otah=35 \chardef\otb=40 \chardef\otB=40 \chardef\otc=46 \chardef\otC=46 \chardef\otcc=46 \chardef\otd=53 \chardef\otD=53 \chardef\ote=60 \chardef\otE=60 \chardef\otea=60 \chardef\oteg=60 \chardef\otet=60 \chardef\oteh=60 \chardef\otf=67 \chardef\otF=67 \chardef\otg=74 \chardef\otG=74 \chardef\oth=81 \chardef\otH=81 \chardef\oti=88 \chardef\otI=88 \chardef\otit=88 \chardef\otih=88 \chardef\otj=95 \chardef\otJ=95 \chardef\otjt=95 \chardef\otk=102 \chardef\otK=102 \chardef\otl=109 \chardef\otL=109 \chardef\otm=116 \chardef\otM=116 \chardef\otn=123 \chardef\otN=123 \chardef\oto=130 \chardef\otO=130 \chardef\otoa=130 \chardef\otog=130 \chardef\otot=130 \chardef\otoh=130 \chardef\otp=137 \chardef\otP=137 \chardef\otq=143 \chardef\otQ=143 \chardef\otr=150 \chardef\otR=150 \chardef\ots=157 \chardef\otS=157 \chardef\ott=164 \chardef\otT=164 \chardef\otu=171 \chardef\otU=171 \chardef\otut=171 \chardef\otuh=171 \chardef\otv=178 \chardef\otV=178 \chardef\otw=185 \chardef\otW=185 \chardef\otx=192 \chardef\otX=192 \chardef\otij=199 \chardef\otIJ=199 \chardef\oty=200 \chardef\otY=200 \chardef\otz=206 \chardef\otZ=206 %\endinput%;nonum %cgl@rc.service.rug.nl %Contents sort.tex %Counters (blue.tex).............5--19 %newifs ..(blue.tex)............20--23 %Storing %from copy ...................101--108 % \seq...\qes ...................102 %from file ...................110--117 % \storefrom ...............112--117 %random generated items % \storerandomn ............124--125 % \rnd .....................128--134 % \storerandomw ............138--143 % \randomword ..............145--149 % \randomchar ..............152--161 %Typeset % parameters ................202-205 % \prc .....................207--210 % \init ....................212--213 % \prtfl ...................216--218 % \prts ....................221--225 % \prtw .........................227 % \prtn ....................229--232 % \typeindentry.............234--240 % \splitintoks..............244--245 % \prtind ..................247--251 %Sorting % \sortn ........................302 % \sortaw .......................304 % \sortw ........................306 % \sort .........................308 % \accstr .......................311 % \accdef ..................313--316 % \ij ...........................318 % \xch .....................321--327 % \cmpn ....................330--335 % \cmpw ....................338--341 % \cmpaw ...................343--347 % \cmpc ....................349--369 % \lge .....................371--378 % \nxtw ....................380--388 % \loc .....................391--393 % \nxtaw ...................396--401 % \cmpir ...................403--407 % \decom ...................409--420 % \red .....................421--434 % \redrng ..................436--457 % \prcrng ..................459--462 % \strnrs ..................465--471 % \splitwn .................473--474 % \getdig .......................476 % \sortcs ..................478--497 %Ordering table ..............501--569 %History of changes %Oct 1994 OT modified with respect to % Index sorting. % Sorting macros adapted and % extended. %March 1994 Contents added to file sort.tex. %Jan 1994 Macros released for CTAN. %Spring 1993 Abridged version Sorting in BLUe % for TUG'93 (Aston) TB 14.3, 1993. %Fall 1992 Release for MAPS 93.1. %end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%sort%;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%heap% %heapsort.tex Jan, 93 %\newcount\n\newcount\lc\newcount\r %\newcount\ic\newcount\uone %\newcount\jc\newcount\jj\newcount\jjone %\newif\ifgoon %Non-descending sorting \def\heapsort{%data in \1 to \n \r=\n\heap\ic=1{}% {\loop\ifnum\r>1{}\xch\ic\r \advance\r-1{}\sift\ic\r \repeat}} % \def\heap{%Transform \1..\n into heap \lc=\n\divide\lc2{}\advance\lc1{}% {\loop\ifnum\lc>1{}\advance\lc-1{}% \sift\lc\n\repeat}} % \def\sift#1#2{%#1, #2 counter variables \jj=#1\uone=#2\advance\uone1{}\goontrue {\loop\jc=\jj \advance\jj by\jj \ifnum\jj<\uone \jjone=\jj \advance\jjone1{}% \ifnum\jj<#2{}\cmpval\jj\jjone \ifnum2=\status\jj=\jjone\fi\fi \cmpval\jc\jj\ifnum2>\status\goonfalse\fi \else\goonfalse\fi \ifgoon\xch\jc\jj\repeat}} % \def\cmpval#1#2{%#1, #2 counter variables %Result: \status= 0, 1, 2 if % \val{#1} =, >, < \val{#2} \ea\let\ea\aone\csname\the#1\endcsname \ea\let\ea\atwo\csname\the#2\endcsname \cmp\aone\atwo} %\endinput %cgl@rc.service.rug.nl %end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%heap%;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%quick% %quick.tex Jan 93 %\newcount\low\newcount\up\newcount\m \def\quicksort{%Values given in %\low,...,\up are sorted, non-descending. %Parameters: \cmp, comparison. \ifnum\low<\up\else\brk\fi %\refval, a reference value selected at random. \m=\up\advance\m-\low%Size-1 of array part \ifnum10<\m\rnd\multiply\m\rndval \divide\m99{}\advance\m\low \xch\low\m \fi \ea\let\ea\refval\csname\the\low\endcsname \m=\low\k=\low\let\refvalcop=\refval {\loop\ifnum\k<\up\advance\k1{}% \ea\let\ea\oneqs\csname\the\k\endcsname \cmp\refval\oneqs\ifnum1=\status \global\advance\m1{}\xch\m\k\fi \let\refval=\refvalcop \repeat}\xch\low\m {\up=\m\advance\up-1{}\quicksort}% {\low=\m\advance\low1{}\quicksort}\krb} % \def\brk#1\krb{\fi}\def\krb{\relax} %\endinput %cgl@rc.service.rug.nl %end%%%%%%%%%%%%%%%%%%%%%%%%quick%;nonum!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%index% %From BLUe's Index Oct 94%;numvrb \catcode`\@=11 %Some unused macros are left in. %\newread\inxin %\newtoks\indword %\newtoks\indexfile %To parameterize the resulting index %\newtoks\irfile %To parameterize the IRs %\newtoks\indexname %\newtoks\preindex %\newtoks\postindex %\newtoks\ignores %\newtoks\conseqs %\newtoks\consyms %\newtoks\srtkeys %\newtoks\srtkeypairs %Initializations \proofmodetrue \irfile{index} \indexfile{index.elm} \preindex{\head{\the\indexname}} \postindex{} \immediate\openout\inx=index \conseqs{\c\space\bf\it\rm\tt\sub\relax} \consyms{\`\'\"\^\~} \srtkeypairs{\AmSTeX{amstex} \LAMSTeX{lamstex} \LaTeX{latex} \PS{PostScript} \TeX{tex}} \srtkeys{\AmSTeX\LAMSTeX\LaTeX\PS\TeX} \let\sub\relax %Macros % %User level %;vrblin=100 \def\sortindex{%Nov 1994, cgl %Purpose: %To sort IR file. %Input: default index is sorted % ( file specified in \irfile) %Output: file index.elm. \newpage\immediate\closeout\inx \filetoarray{\the\irfile} \immediate\write16{Sorting n=\the\n. Please wait, O(nlog n) process.} \let\cmp\cmpir\let\nxtw\nxtwindex \otindex\let\ \space {%Make sortkey defs \ea\sokdef\the\srtkeypairs\fedkos\relax \sort \let\spaceseparator\space \setupnxtokens\def\ {\nx\ }% \immediate\write16{Range reduction.} \redrngtofile{index.srt} \immediate\write16{After reduction and writing to file index.srt; n=\the\n.} \immediate\write16{Transform index.srt-->index.elm.} \tawfiletofile{index.srt}{\the \indexfile}}} % %Set up set of \srtkeys \def\setupsrtkeys{\ea \sok\the\srtkeypairs\kos\relax} %;vrblin=150 \def\pasteupindex{%May 1995, cgl %Purpose: %To set index in (balanced) doublecolumn. %The index is preceded by %\chapterhead{\the\indexname} %and by the contents of %\preindex and followed by contents of %\postindex. %Input: default index.elm is set % (file specified in \indexfile). %Biased by manmac's \begindoublecolumns %\chapterhead{\the\indexname}%in preindex \begingroup\def\space{{\tt\char32 }}% \the\preindex\endgraf \pageheight\vsize \pagewd\hsize \pagewidth\pagewd%anachronism \parindent1em \output={\global\setbox\partialpage= \vbox{\unvbox255\bigskip}}% \eject \output={\bluedoublecolumnout}% % \hsize=8.5cm \vsize=51cm%blue.tex values %2*\hsize+(\hfil)=\pagewd \divide\hsize2 \advance\hsize-1cm \advance\vsize\vsize \advance\vsize1cm \parskip0pt plus.8pt\relax \obeylines\everypar{% \hangindent2\parindent}% \ea\let\csname par\endcsname\endgraf \let\sub\endgraf % \input\the\indexfile\relax % %endpasteupindex part biased by %manmac's \enddoublecolumns \output={\balancecolumns}\eject \endgroup \pagegoal=\vsize\the\postindex} % %Add an element #1 to toks var #2 \def\add#1to#2{#2\ea{\the#2#1}} % %Inner level % %IR creation % \let\spaceseparator\space %;vrblin=200 %Things are set up within \makexref to %allow dynamical use. \def\makexref{\ifproofmode%Mod cgl oct 94 \setupsrtkeys \bgroup\def\ {\string\ }% \def\process##1{\def##1{\string##1 }}% \ea\ea\ea\fifo\ea\the\ea\conseqs \the\srtkeys\ofif \def\process##1{\def##1{\string##1}}% \ea\fifo\the\consyms\ofif \xdef\writeit{\write\inx{\text{} !\xreftype\spaceseparator \nx\number\pageno.}}\writeit \egroup \else\ifhmode\kern0pt\fi\fi \ifsilent\ignorespaces\else{\next}\fi} % %Sorting %;vrblin=250 \def\cmpir#1#2{%#1, #2 defs %Result: \status= 0, 1, 2 if % \val{#1} =, >, < \val{#2} %\immediate\write16{Compared are: *#1* % and *#2*}% \ea\ea\ea\decom\ea#1#2} % \def\nxtwindex#1#2{% %Function: %On input: #1 contains the `word' %As result: #2 contains the value % of the first non-ignored token as given % in the ordering table. %#1 contains the rest of the `word' \def\pop##1##2\pop{% \gdef#1{##2}\def\pophead{##1}}%head and tail \ea\pop#1\pop%split in head and tail \ignores\ea\ea\ea{\ea \the\ea\conseqs\the\consyms}% \ea\loc\pophead{\the\ignores}% \iffound\ifx\empty#1 \chardef#2=0 \else\nxtwindex#1#2 \fi \else \ea\loc\pophead{\the\srtkeys}% \iffound\xdef\pophead{\pophead}% \ea\ea\ea\gdef\ea\ea\ea#1\ea\ea\ea {\ea\pophead#1}% \nxtwindex#1#2 \else \ea\let\ea#2\csname ot\pophead\endcsname \fi \fi} % \def\otindex{%Parameters: Ordering `table' %Special cases \ea\chardef\csname ot \endcsname=0 \ea\chardef\csname ot\space\endcsname=0 %{|}~(\char126) in ASCII after lowercase %^ active character %Bulk according to ACII \def\process##1{\ea\chardef \csname ot##1\endcsname=`##1 } %lowercase letters \fifo abcdefghijklmnopqrstuvwxyz\ofif \chardef\otij=`y \chardef\otIJ=`y %other characters \fifo !"##$&'()*+,-./0123456789:;<=>?@ []_`\ofif %uppercase letters equal lowercase \def\process##1{\ea\chardef \csname ot##1\endcsname=\lccode`##1 } \uppercase{\fifo abcdefghijklmnopqrstuvwxyz\ofif} } % %Range reduction %;vrblin=400 \def\redrngtofile#1{%Reduction of \1,...,\n, %with range representation of page numbers \immediate\openout\inx=#1 {\k1\kk0 \ifnum\n>0 \ea\ea\ea\splitwn\csname\the\k\endcsname \let\refer\word \let\nrsrng\empty\prcrng\num\fi \loop\ifnum\k<\n\advance\k1 \ea\ea\ea\splitwn\csname\the\k\endcsname \ifx\refer\word%extend \nrsrng with number \prcrng\num \else%write record to \kk \advance\kk1 \strnrs \immediate\write\inx{\refer\spaceseparator \nrsrng.}% \let\nrsrng\empty\init\num \prcrng\num\let\refer\word \fi \repeat\ifnum1<\n \advance\kk1 \strnrs \immediate\write\inx{\refer\spaceseparator \nrsrng.}% \global\n\kk\fi }\immediate\closeout\inx} % %Copying %;vrblin=500 \def\filetoarray#1{%#1 is file name \immediate\openin\inxin=#1\relax \ifeof\inxin\immediate\write16{File #1 empty or non-existent.}% \fi \n\kzero\continuetrue \loop\ifeof\inxin\continuefalse\fi \ifcontinue\advance\n1 \immediate \read\inxin t\ea o\csname\the\n\endcsname %\immediate\write16{k: \number\n: % \csname\the\n\endcsname}% \repeat\advance\n-1 \immediate\closein\inxin} % \def\tawfiletofile#1#2{\continuetrue \immediate\openin\inxin=#1\relax \immediate\openout\inx=#2\relax \loop\read\inxin to\IR \ifeof\inxin\continuefalse\fi \ifcontinue\trfandwrite\IR \repeat \immediate\closein\inxin \immediate\closeout\inx } % \def\setupnxtokens{% \def\process##1{\def##1{\nx##1}}% \ea\ea\ea\fifo\ea\the\ea\conseqs \the\srtkeys\ofif \def\process##1{\def##1{\string##1}}% \ea\fifo\the\consyms\ofif } % \def\trfandwrite#1{\ea\splitintoks#1% \immediate\write\inx{\nx\noindent \ifcase\digit{\the\indword}\or {\nx\tt\the\indword}\or \nx\cs{\the\indword}\or $\nx\langle\hbox{\the\indword}\nx\rangle $\fi\spaceseparator{\nx \oldstyle\pagenrs}}}%Period deleted % \def\splitintoks#1 !#2 #3.{\indword{#1}% \chardef\digit=#2\relax\def\pagenrs{#3}} % %Typesetting;vrblin=600 \def\bluedoublecolumnout{% %Biased by manmac's doublecolumnout \splittopskip=\topskip \splitmaxdepth=\maxdepth \dimen@\pageheight \advance\dimen@ by-\ht\partialpage \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \blueonepageout\pagesofar \unvbox255 \penalty\outputpenalty} % \def\blueonepageout#1{% %Biased by manmac's \onepageout \shipout\vbox{% \vbox to\baselineskip{\null \the\headline\vss}% \kern2ex \vbox to\pageheight{#1\vss}% \kern1ex \the\footline }\advancepageno} % %Auxiliaries;vrblin=700 %SetOfKeys \def\sok#1#2{%Function: %Build from \srtkeykpairs \srtkeys %via \ea\sok\srtkeypairs\kos\relax \ifx#1\kos\kos\fi \srtkeys\ea{\the\srtkeys#1}\sok} \def\kos#1\sok{\fi} % \def\sokdef#1#2{%Function: %Build from \srtkeypairs srtkey defs \ifx#1\fedkos\fedkos\fi \def#1{#2}\sokdef} \def\fedkos#1\sokdef{\fi} \endinput%;nonum %Table of contents: blue.ind %Variables % \indexname...........(blue.tex) % \preindex....................21 % \postindex...................22 % \indword.............(blue.tex) % \indexfile...........(blue.tex) % \irfile..............(blue.tex) % \conseqs.....................24 % \consyms.....................25 % \srtkeys.....................31 % \srtkeypairs..............26-30 % \ignores.............(blue.tex) %User level macros % \sortindex..............101-125 % \pasteupindex...........151-187 % \add#1to#2..................190 %Lower level macros %IR Creation % \makexref...............203-216 %Sorting % \cmpir..................251-256 % \nxtwindex..............258-282 % \otindex................284-304 %Range reduction % \redrngtofile...........401-424 %Copying % \filetoarray............501-512 % \tawfiletofile..........514-523 % \trfandwrite............533-540 % \setupnxtokens..........525-531 % \splitintoks............542-543 %OTR doublecolumns % \bluedoublecolumnout....601-609 % \blueonepageout.........611-620 %Auxiliaries % \sok....................702-707 % \sokdef.................709-713 %History of changes %Nov 1994 Set up. %end%%%%%%%%%%%%%%%%%%%index%;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%ntglogo% \tool\ntglogotool %;numvrb \message{ ---ntglogo, Jan 95, cgl--- } \font\calx=cmsy10 scaled \magstep4 \def\ntglogo{\vbox{% \hbox{{\calx N}ederlandstalige} \hbox{\hskip1em{\calx T}\kern-.2ex \raise-.5ex\hbox{E}\kern.1exX} \hbox{\hskip2em{\calx G}ebruikersgroep}}} \setbox\ntglogobox\ntglogo %end%%%%%%%%%%%%%%%%%%%ntglogo%!cgl;nonum \endinput % % % %begin%%%%%%%%%%%%%%%%%%%%%%ntginfo% \tool\ntginfotool %;numvrb \message{ ---ntginfo, Jan 95, cgl--- } \def\dropntglogo{\noindent \hangindent5\generalindent\hangafter-5 \smash{\lower3.5\baselineskip \hbox to0pt{\hskip-.9\hangindent \copy\ntglogobox\hss}}} \def\ntginfo{% \dropntglogo is the Dutch-language-oriented \TeX{} \UG, founded in {\oldstyle1988}. The activities comprise two meetings per year, with the wealthy MAPS\Dash Minutes and APpendiceS\Dash sent out before each meeting.\\ The activities are biased by sharing experience in using \AllTeX, \MF, literate programming, SGML, Adobe's \PS{} and PDF, next to multi-media, in short, sharing knowledge about Electronic Publishing, biased by \AllTeX. The intricacies of the World-Wide-Web in relation to using \AllTeX{} is also explored. Less than {\oldstyle5}\% of our energy was devoted to organizational matters in the past. Apart from the regular MAPS we enjoy MAPS specials. Up till {\oldstyle1994} NTG's PR set and David Salomon's courseware\Dash Advanced \TeX: Insights and Hindsights\Dash have appeared in this series. The {\oldstyle 1994} special has the title {\oldstyle 100} FAQ: Everything you will ever have to know about \AllTeX.\ftn{Courtesy Bobby Bodenheimer and ukTUG, Reprint Baskerville, {\oldstyle4}, {\oldstyle6}.} \smallskip Important activities, listed in historical order, have been \bigskip {\generalindent5\generalindent \item{\oldstyle1988\quad} NTG's discussion list and fileserver on the air \item{\oldstyle1989\quad} NTG days, various courses have been offered since \item{\oldstyle1990\quad} SGML-\TeX{} conference, Babel emerges \item{\oldstyle1992\quad} Belgian commissioner for Flemish \AllTeX ies \item{\oldstyle1993\quad} Goddijn's Bulletin Board \item{\oldstyle1994\quad} 4All\TeX{} CD-ROM with turnkey-\TeX{} system \item{\oldstyle1995\quad} Euro\TeX, BLUe's system emerges \smallskip }\bigskip Close contacts have been maintained over the years with the TUG\Dash \TUG\Dash and the other LUGs\Dash Language-oriented \TUG s. One can subscribe for a joint membership of NTG and TUG. \smallskip The regular subscription fee for an individual NTG membership is in the order of {\it f}~{\oldstyle90} per year. Students are granted a discount. An institutional membership is possible. \smallskip Enquiries, casu quo a registration form, can be obtained from NTG's secretary Postbus {\oldstyle394}, {\oldstyle1740} AJ Schagen, ntg@nic.surfnet.nl.} \endinput %end%%%%%%%%%%%%%%%%%%%ntginfo%;nonum!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%smileys% \tool\smileystool %;numvrb \message{ ---smileys, July 95, cgl--- }% %Assumed \mfs etc. available \def\eyes{{\x250\unitlength\y150\unitlength \putatxy}%l-eye {\x750\unitlength\y150\unitlength \putatxy}%r-eye }% \def\lefteyes{{\x200\unitlength\y150\unitlength \putatxy}%l-eye {\x700\unitlength\y150\unitlength \putatxy}%r-eye }% \def\squinteyes{{\x300\unitlength\y150\unitlength \putatxy}%l-eye {\x700\unitlength\y150\unitlength \putatxy}%r-eye }% \def\winkeye{\initialize {100}{150}{250}{75}{250}{75}{400}{150}% {\k0\kmax2\x0pt\y0pt\mfs}%l-winkeye {\x750\unitlength\y150\unitlength\putatxy}%r-eye }% \def\mouth{\initialize {250}{-250}{500}{-350}{500}{-350}{750}{-250}% \k0\x0pt\y0pt\mfs} % \def\sadmouth{\initialize {250}{-350}{500}{-250}{500}{-250}{750}{-350}% \k0\x0pt\y0pt\mfs} % \kmax5 %level \setbox\smileybox=\hbox{\unitlength.01pt \initialize 000{650}{1000}{650}{1000}0% \k0\putatxy\mfs \initialize 000{-650}{1000}{-650}{1000}0% \k0\mfs\y0pt\x\X4\putatxy \kmax3 \initialize {100}{200}{250}{250}{250}{250}{400}{200}% \k0\x0pt\y0pt\mfs%l-brow \initialize {600}{200}{750}{250}{750}{250}{900}{200}% \k0\x0pt\y0pt\mfs%r-brow {\x500\unitlength\y150\unitlength\S{250}}%Nose }% \endinput %end%%%%%%%%%%%%%%%%%%%smileys%!cgl;newcol;nonum % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%toc% \tool\toctool %;numvrb \message{---(mini-)ToC, Sept 95, cgl---} \immediate\openout\toc=contents \let\bh\bluehead \long\def\bluehead#1\par{\immediate \write\toc{#1}\bh#1\par} \let\bsh\bluesubhead \long\def\bluesubhead#1\par{\immediate \write\toc{\quad#1}\bsh#1\par} \let\bssh\bluesubsubhead \long\def\bluesubsubhead#1\par{\immediate \write\toc{\qquad#1}\bssh#1\par} \let\be\blueexample \long\def\blueexample#1\par{\immediate \write\toc{\qquad ex:#1}\be#1\par} \def\pasteuptoc{\newcol \immediate\closeout\toc \beginhead Contents\endhead {\catcode`@=11 \obeylines\endgraf \input contents } \let\makesignature\relax} \endinput %end**%%%%%%%%%%%%%%%%%%%%%%%toc%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%english% \tool\englishtool %;numvrb \message{ ---English , Jan 95, cgl--- } \abstractname{Abstract} \acknowledgementsname{Acknowledgements} \contentsname{Contents} \indexname{Index} \examplename{Example} \keywordsname{Keywords} \referencesname{References} \endinput %end%%%%%%%%%%%%%%%%%%%%english%;nonum % % % %begin%%%%%%%%%%%%%%%%%%%%%%%russian% \tool\russiantool %;numvrb \message{ ---Russian , %Jan 95, not yet available, cgl--- } %\abstractname{Abstract} %\acknowledgementsname{Acknowledgements} %\contentsname{Contents} %\indexname{Index} %\examplename{Example} %\keywordsname{Keywords} %\referencesname{References} %end%%%%%%%%%%%%%%%%%%%%russian%;nonum \endinput %!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%%%xyz% \tool\xyztool %;numvrb \def\xyz#1#2#3{\leavevmode% \message{ ---xyz, jan 95, cgl--- }% \setbox0\vbox{\hbox{/}\kern0pt}% \lower2.65\ht0\hbox{\copy0% \rlap{\qquad#1}}% \kern-.185\ht0\lower1.8\ht0\copy0% \kern-.185\ht0\lower0.95\ht0\copy0% \kern-.11\ht0% \vrule height9ex depth0pt\relax% \raise7ex\rlap{\qquad#3}% \vrule height.1pt depth.1pt width 8ex% \qquad\lower.6ex\hbox{#2}}% \endinput %;nonum %end%%%%%%%%%%%%%%%%%%%%%xyz%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%partlogo% \tool\partlogotool %;numvrb %from TeX book \def\partlogo#1{\goodbreak \bigskip\noindent \vbox{\line{\hrulefill}% \kern-.5\baselineskip \line{\hrulefill{ \phantom{\bf #1}} % \hrulefill}% \kern-.5\baselineskip \line{\hrulefill{ \bf #1} \hrulefill}% \kern-.5\baselineskip \line{\hrulefill}% }\nobreak\smallskip\noindent} \endinput %;nonum %end%%%%%%%%%%%%%%%%%%%%%partlogo%!cgl;newcol % % % %begin%%%%%%%%%%%%%%%%%%%%%%%pascal% \tool\pascaltool \message{ ---pascaltool, Jan, Aug 95, cgl--- } %C.G. van der Laan, Jan, Oct 95.%;numvrb %Processing (first set of macros) %\let\beginpascal\fifol \def\lofif#1\fifol{\fi \the\postpascal\endgroup} \let\endpascal\lofif \def\lf{x}%toggle for last font to insert \/ \def\processw#1{% \ifnum\commentstatus>0 \if p\lf\leavevmode\/\fi#1\def\lf{c}\else \ifx\relax#1\relax{ }%space \else\foundfalse \loc{ #1 }{\the\reservedset}% \iffound{\if p\lf\leavevmode\/\fi \reservedwordsfont#1}\def\lf{r}% \else\if=#1${}={}$\else {\pascalprogramfont#1{}}\def\lf{p}\fi\fi \fi\fi}%end processw;vrblin50 %for the rest of listing use %another escape char;endinput %Typesetting : ;= ; . ^ \def\becomes{:=} \catcode`\:=\active \def:#1{\if=#1${}\becomes{}$\else {\rm\char`\:}#1\fi} \catcode`\;=\active \def;{{\/\rm\char`\;}} \catcode`\.=\active \def.{{\pascalprogramfont \char`\.}} \catcode`\^=\active \def^{\char'\active6} %\def^{{\enspace$\uparrow$}} \catcode`\[=\active \catcode`\]=\active \def[{{\rm \char`\[}} \def]{{\rm\/\char`\]}} \def\leftbrace{(} \catcode`\(=\active \catcode`\*=\active \def(#1{\ifx*#1$\{\,$\global \advance\commentstatus1 \pascalcommentfont \else\leftbrace#1\fi} %Reserved words ;vrblin100 \reservedset{ and array begin case const div do downto else end. end; file for function goto if in label mod nil not of or otherwise packed procedure program record repeat set step string then to type until var while with}% %Handling of >= <= <> > < ;vrblin150 \def\lt{<}\def\gt{>} \catcode`\>=\active \def>#1{\if=#1${}\geq{}$\else ${}\gt{}$#1\fi} \catcode`\<=\active \def<#1{\ifx>#1${}\ne{}$\else \if=#1${}\leq{}$\else ${}\lt{}$#1\fi\fi} %Handling of + - * ;vrblin200 \def\-{-}%Save for hyphen use \def\plus{+}\def\minus{-} \catcode`\+=\active \def+{${}\plus{}$} \def*#1{\if)#1$\,\}$\global \advance\commentstatus-1 \else${}\times{}$#1\fi} %{\catcode`\-=\active \gdef-{${}\minus{}$}} %Later catcode is set for minus %Last part of processing ;vrblin250 \obeyspaces\let =\ \def\fifow#1 {\ifx \wofif#1\wofif\fi\processw{#1}\ \fifow}% \def\processl#1{\fifow#1 \wofif \endgraf}%First space is needed % ;vrblin300 \let\zero0 \catcode`\0=\active\def0{{\rm\zero}} \let\one1 \catcode`\1=\active\def1{{\rm\one}} \let\two2 \catcode`\2=\active\def2{{\rm\two}} \let\three3\catcode`\3=\active\def3{{\rm\three}} \let\four4 \catcode`\4=\active\def4{{\rm\four}} \let\five5 \catcode`\5=\active\def5{{\rm\five}} \let\six6 \catcode`\6=\active\def6{{\rm\six}} \let\seven7\catcode`\7=\active\def7{{\rm\seven}} \let\eight8\catcode`\8=\active\def8{{\rm\eight}} \let\nine9 \catcode`\9=\active\def9{{\rm\nine}} \catcode`\-=\active \def-{${}\minus{}$}% \obeylines\smallskip% \the\prepascal\relax%;nonum \endinput%cgl@rc.service.rug.nl % % % %Contents Pascal % \beginpascal % \lofif % \endpascal % \processw %Typesetting : := ;semicol . ^ % \becomes % : % ; % . % ^ %Reserved words %Handling of >= <= <> > < % \lt % \gt % > % < %Handling of + - * % - % \plus % \minus % \times % + % * % - %Last part of processing % \fifow# % \processl %Keeping track of comments, and %using comment fonts % {, } % [, ] % \commentstatus % \pascalcommentfont % \prepascal % %Use of the above file via %\input pascal.tex %\beginpascal %(*Print length of third side of % triangle given two sides and % enclosed angle*) %program EX4A(input, output); %var a, b, c angle : real; %begin read(a, b, angle); % c:=sqrt(sqr(a)+sqr(b)- % 2*a*b*cos(angle)); % writeln(`The third side is', c) %end. %\endpascal %\beginpascal %(*heap creation*) %l := n div 2 + 1; %while l <> 1 do %begin l := l-1; sift(a, l, n) end; %(*sorting*) %r := n; %while r <> 1 do %begin swap(a[1], a[r]); % r := r-1; sift(a, 1, r) %end; %(*sift arg1 through arg2*) %j:= arg1; %while 2j >= arg2 and % (a[j] < a[2j] or a[j] < a[2j+1]) %do begin mi := 2j + if a[2j] > a[2j+1] % then 0 % else 1; % exchange(a[j], a[mi]); j := mi %end. %\endpascal %\bye %Together with blue.tex and tools.dat %replace %\input pascal.tex %by %\input blue.tex %End pascal.tex % % %History of changes %Jan 95 Designed %end%%%%%%%%%%%%%%%%%%%%pascal%!cgl;newcol % % % \tool\efg phoney tool, for test purpose \endinput%end \efg