doc-src/rail.sty
changeset 8591 9d660fc42916
parent 3097 ae362c99a635
child 13044 c049910774cb
equal deleted inserted replaced
8590:89675b444abe 8591:9d660fc42916
     1 % rail.sty - style file to support railroad diagrams
     1 % rail.sty - style file to support railroad diagrams
     2 %
     2 %
     3 % 09-Jul-90 L. Rooijakkers
     3 % 09-Jul-90 L. Rooijakkers
     4 % 08-Oct-90 L. Rooijakkers	fixed centering bug when \rail@tmpc<0.
     4 % 08-Oct-90 L. Rooijakkers      fixed centering bug when \rail@tmpc<0.
     5 % 07-Feb-91 L. Rooijakkers	added \railoptions command, indexing
     5 % 07-Feb-91 L. Rooijakkers      added \railoptions command, indexing
     6 % 08-Feb-91 L. Rooijakkers	minor fixes
     6 % 08-Feb-91 L. Rooijakkers      minor fixes
     7 % 28-Jun-94 K. Barthelmann	turned into LaTeX2e package
     7 % 28-Jun-94 K. Barthelmann      turned into LaTeX2e package
     8 % 08-Dec-96 K. Barthelmann	replaced \@writefile
     8 % 08-Dec-96 K. Barthelmann      replaced \@writefile
     9 % 13-Dec-96 K. Barthelmann	cleanup
     9 % 13-Dec-96 K. Barthelmann      cleanup
    10 %
    10 %
    11 % This style file needs to be used in conjunction with the 'rail'
    11 % This style file needs to be used in conjunction with the 'rail'
    12 % program. Running LaTeX as 'latex file' produces file.rai, which should be
    12 % program. Running LaTeX as 'latex file' produces file.rai, which should be
    13 % processed by Rail with 'rail file'. This produces file.rao, which will
    13 % processed by Rail with 'rail file'. This produces file.rao, which will
    14 % be picked up by LaTeX on the next 'latex file' run.
    14 % be picked up by LaTeX on the next 'latex file' run.
    99 % \rail@boxlf   : \railboxleft
    99 % \rail@boxlf   : \railboxleft
   100 % \rail@boxrt   : \railboxright
   100 % \rail@boxrt   : \railboxright
   101 % \rail@boxhht  : \railboxheight / 2
   101 % \rail@boxhht  : \railboxheight / 2
   102 % \rail@ovalsp  : \railovalspace
   102 % \rail@ovalsp  : \railovalspace
   103 % \rail@framesp : \railframespace
   103 % \rail@framesp : \railframespace
   104 % \rail@textlf	: \railtextleft
   104 % \rail@textlf  : \railtextleft
   105 % \rail@textrt	: \railtextright
   105 % \rail@textrt  : \railtextright
   106 % \rail@textup	: \railtextup
   106 % \rail@textup  : \railtextup
   107 % \rail@joinsz  : \railjoinsize
   107 % \rail@joinsz  : \railjoinsize
   108 % \rail@joinhsz : \railjoinsize / 2
   108 % \rail@joinhsz : \railjoinsize / 2
   109 % \rail@joinadj : \railjoinadjust
   109 % \rail@joinadj : \railjoinadjust
   110 %
   110 %
   111 % \railinit : internalize all of the parameters.
   111 % \railinit : internalize all of the parameters.
   190 %
   190 %
   191 % \railnamefont{TEXT} : set rule name format setup to TEXT
   191 % \railnamefont{TEXT} : set rule name format setup to TEXT
   192 %
   192 %
   193 % \railindexfont{TEXT} : set index entry format setup to TEXT
   193 % \railindexfont{TEXT} : set index entry format setup to TEXT
   194 
   194 
       
   195 \def\rail@tokenfont{\ttfamily\upshape}
   195 \def\rail@termfont{\ttfamily\upshape}
   196 \def\rail@termfont{\ttfamily\upshape}
   196 \def\rail@nontfont{\rmfamily\upshape}
   197 \def\rail@nontfont{\rmfamily\upshape}
   197 \def\rail@annofont{\rmfamily\itshape}
   198 \def\rail@annofont{\rmfamily\itshape}
   198 \def\rail@namefont{\rmfamily\itshape}
   199 \def\rail@namefont{\rmfamily\itshape}
   199 \def\rail@indexfont{\rmfamily\itshape}
   200 \def\rail@indexfont{\rmfamily\itshape}
   236 %
   237 %
   237 % \rail@nr : railroad diagram counter
   238 % \rail@nr : railroad diagram counter
   238 %
   239 %
   239 % \ifrail@match : current \rail@i{NR}{TEXT} matches
   240 % \ifrail@match : current \rail@i{NR}{TEXT} matches
   240 %
   241 %
   241 % \rail@first :	actions to be done first. read in .rao file,
   242 % \rail@first : actions to be done first. read in .rao file,
   242 %               open .rai file if \@filesw true, undefine \rail@first.
   243 %               open .rai file if \@filesw true, undefine \rail@first.
   243 %               executed from \begin{rail} and \railtoken.
   244 %               executed from \begin{rail} and \railtoken.
   244 %
   245 %
   245 % \rail@i{NR}{TEXT} : defines \rail@i@NR as TEXT. written to the .rai
   246 % \rail@i{NR}{TEXT} : defines \rail@i@NR as TEXT. written to the .rai
   246 %                     file by \rail, read from the .rao file by
   247 %                     file by \rail, read from the .rao file by
   452 %
   453 %
   453 % \rail@annote[TEXT] : format TEXT as annotation
   454 % \rail@annote[TEXT] : format TEXT as annotation
   454 
   455 
   455 \def\rail@token#1[#2]{
   456 \def\rail@token#1[#2]{
   456 \rail@setbox{%
   457 \rail@setbox{%
   457 {\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   458 {\rail@tokenfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   458 }
   459 }
   459 \rail@oval
   460 \rail@oval
   460 }
   461 }
   461 
   462 
   462 \def\rail@ctoken#1[#2]{
   463 \def\rail@ctoken#1[#2]{
   463 \rail@setbox{%
   464 \rail@setbox{%
   464 {\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   465 {\rail@tokenfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   465 }
   466 }
   466 \rail@coval
   467 \rail@coval
   467 }
   468 }
   468 
   469 
   469 \def\rail@nont#1[#2]{
   470 \def\rail@nont#1[#2]{