for rail v 1.2
authorpaulson
Fri Mar 08 10:57:53 2002 +0100 (2002-03-08)
changeset 13044c049910774cb
parent 13043 ad1828b479b7
child 13045 1db0bdda1d32
for rail v 1.2
doc-src/rail.sty
     1.1 --- a/doc-src/rail.sty	Thu Mar 07 23:41:30 2002 +0100
     1.2 +++ b/doc-src/rail.sty	Fri Mar 08 10:57:53 2002 +0100
     1.3 @@ -1,12 +1,16 @@
     1.4  % rail.sty - style file to support railroad diagrams
     1.5  %
     1.6  % 09-Jul-90 L. Rooijakkers
     1.7 -% 08-Oct-90 L. Rooijakkers      fixed centering bug when \rail@tmpc<0.
     1.8 -% 07-Feb-91 L. Rooijakkers      added \railoptions command, indexing
     1.9 -% 08-Feb-91 L. Rooijakkers      minor fixes
    1.10 -% 28-Jun-94 K. Barthelmann      turned into LaTeX2e package
    1.11 -% 08-Dec-96 K. Barthelmann      replaced \@writefile
    1.12 -% 13-Dec-96 K. Barthelmann      cleanup
    1.13 +% 08-Oct-90 L. Rooijakkers	fixed centering bug when \rail@tmpc<0.
    1.14 +% 07-Feb-91 L. Rooijakkers	added \railoptions command, indexing
    1.15 +% 08-Feb-91 L. Rooijakkers	minor fixes
    1.16 +% 28-Jun-94 K. Barthelmann	turned into LaTeX2e package
    1.17 +% 08-Dec-96 K. Barthelmann	replaced \@writefile
    1.18 +% 13-Dec-96 K. Barthelmann	cleanup
    1.19 +% 22-Feb-98 K. Barthelmann	fixed catcodes of special characters
    1.20 +% 18-Apr-98 K. Barthelmann	fixed \par handling
    1.21 +% 19-May-98 J. Olsson		Added new macros to support arrow heads.
    1.22 +% 26-Jul-98 K. Barthelmann	changed \par to output newlines
    1.23  %
    1.24  % This style file needs to be used in conjunction with the 'rail'
    1.25  % program. Running LaTeX as 'latex file' produces file.rai, which should be
    1.26 @@ -20,7 +24,7 @@
    1.27  % of the railroad diagrams.
    1.28  
    1.29  \NeedsTeXFormat{LaTeX2e}
    1.30 -\ProvidesPackage{rail}[1996/12/13]
    1.31 +\ProvidesPackage{rail}[1998/05/19]
    1.32  
    1.33  % railroad diagram formatting parameters (user level)
    1.34  % all of these are copied into their internal versions by \railinit
    1.35 @@ -163,15 +167,22 @@
    1.36  % \rail@param : declarations for list environment
    1.37  %
    1.38  % \railparam{TEXT} : sets \rail@param to TEXT
    1.39 -
    1.40 -\def\rail@param{}
    1.41 +%
    1.42 +% \rail@reserved : characters reserved for grammar
    1.43  
    1.44  \newcommand\railparam[1]{
    1.45 -\def\rail@param{#1}
    1.46 +\def\rail@param{
    1.47 +  \setlength\leftmargin{0pt}\setlength\rightmargin{0pt}
    1.48 +  \setlength\labelwidth{0pt}\setlength\labelsep{0pt}
    1.49 +  \setlength\itemindent{0pt}\setlength\listparindent{0pt}
    1.50 +  #1
    1.51  }
    1.52 +}
    1.53 +\railparam{}
    1.54  
    1.55 -% \rail@tokenfont : format setup for \railtoken identifiers
    1.56 -%
    1.57 +\newtoks\rail@reserved
    1.58 +\rail@reserved={:;|*+?[]()'"}
    1.59 +
    1.60  % \rail@termfont : format setup for terminals
    1.61  %
    1.62  % \rail@nontfont : format setup for nonterminals
    1.63 @@ -192,7 +203,6 @@
    1.64  %
    1.65  % \railindexfont{TEXT} : set index entry format setup to TEXT
    1.66  
    1.67 -\def\rail@tokenfont{\ttfamily\upshape}
    1.68  \def\rail@termfont{\ttfamily\upshape}
    1.69  \def\rail@nontfont{\rmfamily\upshape}
    1.70  \def\rail@annofont{\rmfamily\itshape}
    1.71 @@ -235,13 +245,21 @@
    1.72  % \railalias{IDENT}{TEXT} : format IDENT as TEXT. defines \rail@t@IDENT as
    1.73  %                           TEXT.
    1.74  %
    1.75 +% \railtoken{IDENT}{TEXT} : abbreviates \railalias{IDENT}{TEXT}\railterm{IDENT}
    1.76 +%                           (for backward compatibility)
    1.77 +%
    1.78 +% \rail@setcodes : guards special characters
    1.79 +%
    1.80 +% \rail@makeother{CHARACTER} : sets \catcode of CHARACTER to "other"
    1.81 +%                              used inside a loop for \rail@setcodes
    1.82 +%
    1.83  % \rail@nr : railroad diagram counter
    1.84  %
    1.85  % \ifrail@match : current \rail@i{NR}{TEXT} matches
    1.86  %
    1.87  % \rail@first : actions to be done first. read in .rao file,
    1.88  %               open .rai file if \@filesw true, undefine \rail@first.
    1.89 -%               executed from \begin{rail} and \railtoken.
    1.90 +%               executed from \begin{rail}, \railoptions and \railterm.
    1.91  %
    1.92  % \rail@i{NR}{TEXT} : defines \rail@i@NR as TEXT. written to the .rai
    1.93  %                     file by \rail, read from the .rao file by
    1.94 @@ -264,6 +282,18 @@
    1.95  %
    1.96  % \ifrail@all : checked at the end of the document
    1.97  
    1.98 +\def\rail@makeother#1{
    1.99 +  \expandafter\catcode\expandafter`\csname\string #1\endcsname=12
   1.100 +}
   1.101 +
   1.102 +\def\rail@setcodes{
   1.103 +\let\par=\relax
   1.104 +\let\\=\relax
   1.105 +\expandafter\@tfor\expandafter\rail@symbol\expandafter:\expandafter=%
   1.106 +  \the\rail@reserved
   1.107 +\do{\expandafter\rail@makeother\rail@symbol}
   1.108 +}
   1.109 +
   1.110  \newcount\rail@nr
   1.111  
   1.112  \newif\ifrail@all
   1.113 @@ -272,9 +302,12 @@
   1.114  \newif\ifrail@match
   1.115  
   1.116  \def\rail@first{
   1.117 +\begingroup
   1.118  \makeatletter
   1.119 +\rail@setcodes
   1.120  \InputIfFileExists{\jobname.rao}{}{\PackageInfo{rail}{No file \jobname.rao}}
   1.121  \makeatother
   1.122 +\endgroup
   1.123  \if@filesw
   1.124  \newwrite\tf@rai
   1.125  \immediate\openout\tf@rai=\jobname.rai
   1.126 @@ -283,19 +316,23 @@
   1.127  }
   1.128  
   1.129  \long\def\rail@body#1\end{
   1.130 -\begingroup
   1.131 -\let\\=\relax
   1.132 +{
   1.133 +\newlinechar=`^^J
   1.134 +\def\par{\string\par^^J}
   1.135 +\rail@write{\string\rail@i{\number\rail@nr}{#1}}
   1.136 +}
   1.137  \xdef\rail@i@{#1}
   1.138 -\rail@write{\string\rail@i{\number\rail@nr}{\rail@i@}}
   1.139 -\endgroup
   1.140  \end
   1.141  }
   1.142  
   1.143  \newenvironment{rail}{
   1.144  \global\advance\rail@nr by 1
   1.145  \rail@first
   1.146 +\begingroup
   1.147 +\rail@setcodes
   1.148  \rail@body
   1.149  }{
   1.150 +\endgroup
   1.151  \rail@matchtrue
   1.152  \@ifundefined{rail@o@\number\rail@nr}{\rail@matchfalse}{}
   1.153  \expandafter\ifx\csname rail@i@\number\rail@nr\endcsname\rail@i@
   1.154 @@ -332,13 +369,17 @@
   1.155  \expandafter\def\csname rail@t@#1\endcsname{#2}
   1.156  }
   1.157  
   1.158 +\newcommand\railtoken[2]{\railalias{#1}{#2}\railterm{#1}}
   1.159 +
   1.160  \long\def\rail@i#1#2{
   1.161  \expandafter\gdef\csname rail@i@#1\endcsname{#2}
   1.162  }
   1.163  
   1.164  \def\rail@o#1#2{
   1.165  \expandafter\gdef\csname rail@o@#1\endcsname{
   1.166 -\begin{list}{}{\rail@param}#2\end{list}
   1.167 +\begin{list}{}{\rail@param}
   1.168 +#2
   1.169 +\end{list}
   1.170  }
   1.171  }
   1.172  
   1.173 @@ -346,7 +387,7 @@
   1.174  
   1.175  \def\rail@p#1{}
   1.176  
   1.177 -\def\rail@write#1{\@ifundefined{tf@rai}{}{\immediate\write\tf@rai{#1}}}
   1.178 +\long\def\rail@write#1{\@ifundefined{tf@rai}{}{\immediate\write\tf@rai{#1}}}
   1.179  
   1.180  \def\rail@warn{
   1.181  \PackageWarningNoLine{rail}{Railroad diagram(s) may have changed.
   1.182 @@ -378,9 +419,14 @@
   1.183  % \rail@tmpc : temporary count
   1.184  %
   1.185  % \rail@put : put at (\rail@x,\rail@y)
   1.186 +% \rail@vput : put vector at (\rail@x,\rail@y)
   1.187  %
   1.188  % \rail@eline : end line by drawing from \rail@ex to \rail@x
   1.189  %
   1.190 +% \rail@vreline : end line by drawing a vector from \rail@x to \rail@ex
   1.191 +%
   1.192 +% \rail@vleline : end line by drawing a vector from \rail@ex to \rail@x
   1.193 +%
   1.194  % \rail@sety{LEVEL} : set \rail@y to level LEVEL
   1.195  
   1.196  \newcount\rail@x
   1.197 @@ -395,12 +441,26 @@
   1.198  
   1.199  \def\rail@put{\put(\number\rail@x,\number\rail@y)}
   1.200  
   1.201 +\def\rail@vput{\put(\number\rail@ex,\number\rail@y)}
   1.202 +
   1.203  \def\rail@eline{
   1.204  \rail@tmpb=\rail@x
   1.205  \advance\rail@tmpb by -\rail@ex
   1.206  \rail@put{\line(-1,0){\number\rail@tmpb}}
   1.207  }
   1.208  
   1.209 +\def\rail@vreline{
   1.210 +\rail@tmpb=\rail@x
   1.211 +\advance\rail@tmpb by -\rail@ex
   1.212 +\rail@vput{\vector(1,0){\number\rail@tmpb}}
   1.213 +}
   1.214 +
   1.215 +\def\rail@vleline{
   1.216 +\rail@tmpb=\rail@x
   1.217 +\advance\rail@tmpb by -\rail@ex
   1.218 +\rail@put{\vector(-1,0){\number\rail@tmpb}}
   1.219 +}
   1.220 +
   1.221  \def\rail@sety#1{
   1.222  \rail@y=#1
   1.223  \multiply\rail@y by -\rail@boxsp
   1.224 @@ -414,7 +474,7 @@
   1.225  % \rail@expand{IDENT} : expand IDENT
   1.226  
   1.227  \def\rail@begin#1#2{
   1.228 -\item[]
   1.229 +\item
   1.230  \begin{minipage}[t]{\linewidth}
   1.231  \ifx\@empty#2\else
   1.232  {\rail@namefont \rail@expand{#2}}\\*[\railnamesep]
   1.233 @@ -437,36 +497,86 @@
   1.234  \end{minipage}
   1.235  }
   1.236  
   1.237 +\def\rail@vend{
   1.238 +\advance\rail@x by \rail@extra
   1.239 +\rail@vreline
   1.240 +\end{picture}
   1.241 +\end{minipage}
   1.242 +}
   1.243 +
   1.244  \def\rail@expand#1{\@ifundefined{rail@t@#1}{#1}{\csname rail@t@#1\endcsname}}
   1.245  
   1.246  % \rail@token{TEXT}[ANNOT] : format token TEXT with annotation
   1.247 +% \rail@ltoken{TEXT}[ANNOT] : format token TEXT with annotation, arrow left
   1.248 +% \rail@rtoken{TEXT}[ANNOT] : format token TEXT with annotation, arrow right
   1.249  %
   1.250  % \rail@ctoken{TEXT}[ANNOT] : format token TEXT centered with annotation
   1.251 +% \rail@lctoken{TEXT}[ANNOT] : format token TEXT centered with annotation, arrow left
   1.252 +% \rail@rctoken{TEXT}[ANNOT] : format token TEXT centered with annotation, arrow right
   1.253  %
   1.254  % \rail@nont{TEXT}[ANNOT] : format nonterminal TEXT with annotation
   1.255 +% \rail@lnont{TEXT}[ANNOT] : format nonterminal TEXT with annotation, arrow left
   1.256 +% \rail@rnont{TEXT}[ANNOT] : format nonterminal TEXT with annotation. arrow right
   1.257  %
   1.258  % \rail@cnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation
   1.259 +% \rail@lcnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation,
   1.260 +%                             arrow left
   1.261 +% \rail@rcnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation,
   1.262 +%                             arrow right
   1.263  %
   1.264  % \rail@term{TEXT}[ANNOT] : format terminal TEXT with annotation
   1.265 +% \rail@lterm{TEXT}[ANNOT] : format terminal TEXT with annotation, arrow left
   1.266 +% \rail@rterm{TEXT}[ANNOT] : format terminal TEXT with annotation, arrow right
   1.267  %
   1.268  % \rail@cterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation
   1.269 +% \rail@lcterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation, arrow left
   1.270 +% \rail@rcterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation,
   1.271 +%                             arrow right
   1.272  %
   1.273  % \rail@annote[TEXT] : format TEXT as annotation
   1.274  
   1.275  \def\rail@token#1[#2]{
   1.276  \rail@setbox{%
   1.277 -{\rail@tokenfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.278 +{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.279  }
   1.280  \rail@oval
   1.281  }
   1.282  
   1.283 +\def\rail@ltoken#1[#2]{
   1.284 +\rail@setbox{%
   1.285 +{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.286 +}
   1.287 +\rail@vloval
   1.288 +}
   1.289 +
   1.290 +\def\rail@rtoken#1[#2]{
   1.291 +\rail@setbox{%
   1.292 +{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.293 +}
   1.294 +\rail@vroval
   1.295 +}
   1.296 +
   1.297  \def\rail@ctoken#1[#2]{
   1.298  \rail@setbox{%
   1.299 -{\rail@tokenfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.300 +{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.301  }
   1.302  \rail@coval
   1.303  }
   1.304  
   1.305 +\def\rail@lctoken#1[#2]{
   1.306 +\rail@setbox{%
   1.307 +{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.308 +}
   1.309 +\rail@vlcoval
   1.310 +}
   1.311 +
   1.312 +\def\rail@rctoken#1[#2]{
   1.313 +\rail@setbox{%
   1.314 +{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.315 +}
   1.316 +\rail@vrcoval
   1.317 +}
   1.318 +
   1.319  \def\rail@nont#1[#2]{
   1.320  \rail@setbox{%
   1.321  {\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.322 @@ -474,6 +584,20 @@
   1.323  \rail@frame
   1.324  }
   1.325  
   1.326 +\def\rail@lnont#1[#2]{
   1.327 +\rail@setbox{%
   1.328 +{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.329 +}
   1.330 +\rail@vlframe
   1.331 +}
   1.332 +
   1.333 +\def\rail@rnont#1[#2]{
   1.334 +\rail@setbox{%
   1.335 +{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.336 +}
   1.337 +\rail@vrframe
   1.338 +}
   1.339 +
   1.340  \def\rail@cnont#1[#2]{
   1.341  \rail@setbox{%
   1.342  {\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.343 @@ -481,6 +605,20 @@
   1.344  \rail@cframe
   1.345  }
   1.346  
   1.347 +\def\rail@lcnont#1[#2]{
   1.348 +\rail@setbox{%
   1.349 +{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.350 +}
   1.351 +\rail@vlcframe
   1.352 +}
   1.353 +
   1.354 +\def\rail@rcnont#1[#2]{
   1.355 +\rail@setbox{%
   1.356 +{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.357 +}
   1.358 +\rail@vrcframe
   1.359 +}
   1.360 +
   1.361  \def\rail@term#1[#2]{
   1.362  \rail@setbox{%
   1.363  {\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.364 @@ -488,6 +626,20 @@
   1.365  \rail@oval
   1.366  }
   1.367  
   1.368 +\def\rail@lterm#1[#2]{
   1.369 +\rail@setbox{%
   1.370 +{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.371 +}
   1.372 +\rail@vloval
   1.373 +}
   1.374 +
   1.375 +\def\rail@rterm#1[#2]{
   1.376 +\rail@setbox{%
   1.377 +{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.378 +}
   1.379 +\rail@vroval
   1.380 +}
   1.381 +
   1.382  \def\rail@cterm#1[#2]{
   1.383  \rail@setbox{%
   1.384  {\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.385 @@ -495,6 +647,20 @@
   1.386  \rail@coval
   1.387  }
   1.388  
   1.389 +\def\rail@lcterm#1[#2]{
   1.390 +\rail@setbox{%
   1.391 +{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.392 +}
   1.393 +\rail@vlcoval
   1.394 +}
   1.395 +
   1.396 +\def\rail@rcterm#1[#2]{
   1.397 +\rail@setbox{%
   1.398 +{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
   1.399 +}
   1.400 +\rail@vrcoval
   1.401 +}
   1.402 +
   1.403  \def\rail@annote[#1]{
   1.404  \rail@setbox{\rail@annofont #1}
   1.405  \rail@text
   1.406 @@ -505,14 +671,26 @@
   1.407  % \rail@setbox{TEXT} : set \rail@box to TEXT, set \rail@tmpa to width
   1.408  %
   1.409  % \rail@oval : format \rail@box of width \rail@tmpa inside an oval
   1.410 +% \rail@vloval : format \rail@box of width \rail@tmpa inside an oval, vector left
   1.411 +% \rail@vroval : format \rail@box of width \rail@tmpa inside an oval, vector right
   1.412  %
   1.413  % \rail@coval : same as \rail@oval, but centered between \rail@x and
   1.414  %               \rail@mx
   1.415 +% \rail@vlcoval : same as \rail@oval, but centered between \rail@x and
   1.416 +%                 \rail@mx, vector left
   1.417 +% \rail@vrcoval : same as \rail@oval, but centered between \rail@x and
   1.418 +%                 \rail@mx, vector right
   1.419  %
   1.420  % \rail@frame : format \rail@box of width \rail@tmpa inside a frame
   1.421 +% \rail@vlframe : format \rail@box of width \rail@tmpa inside a frame, vector left
   1.422 +% \rail@vrframe : format \rail@box of width \rail@tmpa inside a frame, vector right
   1.423  %
   1.424  % \rail@cframe : same as \rail@frame, but centered between \rail@x and
   1.425  %                \rail@mx
   1.426 +% \rail@vlcframe : same as \rail@frame, but centered between \rail@x and
   1.427 +%                  \rail@mx, vector left
   1.428 +% \rail@vrcframe : same as \rail@frame, but centered between \rail@x and
   1.429 +%                  \rail@mx, vector right
   1.430  %
   1.431  % \rail@text : format \rail@box of width \rail@tmpa above the line
   1.432  
   1.433 @@ -541,6 +719,41 @@
   1.434  \advance\rail@x by \rail@boxrt
   1.435  }
   1.436  
   1.437 +\def\rail@vloval{
   1.438 +\advance\rail@x by \rail@boxlf
   1.439 +\rail@eline
   1.440 +\advance\rail@tmpa by \rail@ovalsp
   1.441 +\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
   1.442 +\rail@tmpb=\rail@tmpa
   1.443 +\divide\rail@tmpb by 2
   1.444 +\advance\rail@y by -\rail@boxhht
   1.445 +\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
   1.446 +\advance\rail@y by \rail@boxhht
   1.447 +\advance\rail@x by \rail@tmpb
   1.448 +\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
   1.449 +\advance\rail@x by \rail@tmpb
   1.450 +\rail@ex=\rail@x
   1.451 +\advance\rail@x by \rail@boxrt
   1.452 +\rail@vleline
   1.453 +}
   1.454 +
   1.455 +\def\rail@vroval{
   1.456 +\advance\rail@x by \rail@boxlf
   1.457 +\rail@vreline
   1.458 +\advance\rail@tmpa by \rail@ovalsp
   1.459 +\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
   1.460 +\rail@tmpb=\rail@tmpa
   1.461 +\divide\rail@tmpb by 2
   1.462 +\advance\rail@y by -\rail@boxhht
   1.463 +\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
   1.464 +\advance\rail@y by \rail@boxhht
   1.465 +\advance\rail@x by \rail@tmpb
   1.466 +\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
   1.467 +\advance\rail@x by \rail@tmpb
   1.468 +\rail@ex=\rail@x
   1.469 +\advance\rail@x by \rail@boxrt
   1.470 +}
   1.471 +
   1.472  \def\rail@coval{
   1.473  \rail@tmpb=\rail@tmpa
   1.474  \advance\rail@tmpb by \rail@ovalsp
   1.475 @@ -557,6 +770,38 @@
   1.476  \rail@oval
   1.477  }
   1.478  
   1.479 +\def\rail@vlcoval{
   1.480 +\rail@tmpb=\rail@tmpa
   1.481 +\advance\rail@tmpb by \rail@ovalsp
   1.482 +\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
   1.483 +\advance\rail@tmpb by \rail@boxlf
   1.484 +\advance\rail@tmpb by \rail@boxrt
   1.485 +\rail@tmpc=\rail@mx
   1.486 +\advance\rail@tmpc by -\rail@x
   1.487 +\advance\rail@tmpc by -\rail@tmpb
   1.488 +\divide\rail@tmpc by 2
   1.489 +\ifnum\rail@tmpc>0
   1.490 +\advance\rail@x by \rail@tmpc
   1.491 +\fi
   1.492 +\rail@vloval
   1.493 +}
   1.494 +
   1.495 +\def\rail@vrcoval{
   1.496 +\rail@tmpb=\rail@tmpa
   1.497 +\advance\rail@tmpb by \rail@ovalsp
   1.498 +\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
   1.499 +\advance\rail@tmpb by \rail@boxlf
   1.500 +\advance\rail@tmpb by \rail@boxrt
   1.501 +\rail@tmpc=\rail@mx
   1.502 +\advance\rail@tmpc by -\rail@x
   1.503 +\advance\rail@tmpc by -\rail@tmpb
   1.504 +\divide\rail@tmpc by 2
   1.505 +\ifnum\rail@tmpc>0
   1.506 +\advance\rail@x by \rail@tmpc
   1.507 +\fi
   1.508 +\rail@vroval
   1.509 +}
   1.510 +
   1.511  \def\rail@frame{
   1.512  \advance\rail@x by \rail@boxlf
   1.513  \rail@eline
   1.514 @@ -570,6 +815,33 @@
   1.515  \advance\rail@x by \rail@boxrt
   1.516  }
   1.517  
   1.518 +\def\rail@vlframe{
   1.519 +\advance\rail@x by \rail@boxlf
   1.520 +\rail@eline
   1.521 +\advance\rail@tmpa by \rail@framesp
   1.522 +\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
   1.523 +\advance\rail@y by -\rail@boxhht
   1.524 +\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
   1.525 +\advance\rail@y by \rail@boxhht
   1.526 +\advance\rail@x by \rail@tmpa
   1.527 +\rail@ex=\rail@x
   1.528 +\advance\rail@x by \rail@boxrt
   1.529 +\rail@vleline
   1.530 +}
   1.531 +
   1.532 +\def\rail@vrframe{
   1.533 +\advance\rail@x by \rail@boxlf
   1.534 +\rail@vreline
   1.535 +\advance\rail@tmpa by \rail@framesp
   1.536 +\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
   1.537 +\advance\rail@y by -\rail@boxhht
   1.538 +\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
   1.539 +\advance\rail@y by \rail@boxhht
   1.540 +\advance\rail@x by \rail@tmpa
   1.541 +\rail@ex=\rail@x
   1.542 +\advance\rail@x by \rail@boxrt
   1.543 +}
   1.544 +
   1.545  \def\rail@cframe{
   1.546  \rail@tmpb=\rail@tmpa
   1.547  \advance\rail@tmpb by \rail@framesp
   1.548 @@ -586,6 +858,38 @@
   1.549  \rail@frame
   1.550  }
   1.551  
   1.552 +\def\rail@vlcframe{
   1.553 +\rail@tmpb=\rail@tmpa
   1.554 +\advance\rail@tmpb by \rail@framesp
   1.555 +\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
   1.556 +\advance\rail@tmpb by \rail@boxlf
   1.557 +\advance\rail@tmpb by \rail@boxrt
   1.558 +\rail@tmpc=\rail@mx
   1.559 +\advance\rail@tmpc by -\rail@x
   1.560 +\advance\rail@tmpc by -\rail@tmpb
   1.561 +\divide\rail@tmpc by 2
   1.562 +\ifnum\rail@tmpc>0
   1.563 +\advance\rail@x by \rail@tmpc
   1.564 +\fi
   1.565 +\rail@vlframe
   1.566 +}
   1.567 +
   1.568 +\def\rail@vrcframe{
   1.569 +\rail@tmpb=\rail@tmpa
   1.570 +\advance\rail@tmpb by \rail@framesp
   1.571 +\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
   1.572 +\advance\rail@tmpb by \rail@boxlf
   1.573 +\advance\rail@tmpb by \rail@boxrt
   1.574 +\rail@tmpc=\rail@mx
   1.575 +\advance\rail@tmpc by -\rail@x
   1.576 +\advance\rail@tmpc by -\rail@tmpb
   1.577 +\divide\rail@tmpc by 2
   1.578 +\ifnum\rail@tmpc>0
   1.579 +\advance\rail@x by \rail@tmpc
   1.580 +\fi
   1.581 +\rail@vrframe
   1.582 +}
   1.583 +
   1.584  \def\rail@text{
   1.585  \advance\rail@x by \rail@textlf
   1.586  \advance\rail@y by \rail@textup