doc-src/rail.sty
author blanchet
Wed, 28 Apr 2010 12:46:50 +0200
changeset 36486 c2d7e2dff59e
parent 13044 c049910774cb
permissions -rw-r--r--
support Vampire definitions of constants as "let" constructs in Isar proofs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
     1
% rail.sty - style file to support railroad diagrams
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
     2
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
     3
% 09-Jul-90 L. Rooijakkers
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
     4
% 08-Oct-90 L. Rooijakkers	fixed centering bug when \rail@tmpc<0.
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
     5
% 07-Feb-91 L. Rooijakkers	added \railoptions command, indexing
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
     6
% 08-Feb-91 L. Rooijakkers	minor fixes
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
     7
% 28-Jun-94 K. Barthelmann	turned into LaTeX2e package
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
     8
% 08-Dec-96 K. Barthelmann	replaced \@writefile
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
     9
% 13-Dec-96 K. Barthelmann	cleanup
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
    10
% 22-Feb-98 K. Barthelmann	fixed catcodes of special characters
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
    11
% 18-Apr-98 K. Barthelmann	fixed \par handling
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
    12
% 19-May-98 J. Olsson		Added new macros to support arrow heads.
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
    13
% 26-Jul-98 K. Barthelmann	changed \par to output newlines
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    14
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    15
% This style file needs to be used in conjunction with the 'rail'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    16
% program. Running LaTeX as 'latex file' produces file.rai, which should be
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    17
% processed by Rail with 'rail file'. This produces file.rao, which will
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    18
% be picked up by LaTeX on the next 'latex file' run.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    19
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    20
% LaTeX will warn if there is no file.rao or it's out of date.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    21
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    22
% The macros in this file thus consist of two parts: those that read and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    23
% write the .rai and .rao files, and those that do the actual formatting
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    24
% of the railroad diagrams.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    25
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    26
\NeedsTeXFormat{LaTeX2e}
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
    27
\ProvidesPackage{rail}[1998/05/19]
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    28
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    29
% railroad diagram formatting parameters (user level)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    30
% all of these are copied into their internal versions by \railinit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    31
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    32
% \railunit : \unitlength within railroad diagrams
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    33
% \railextra : extra length at outside of diagram
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    34
% \railboxheight : height of ovals and frames
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    35
% \railboxskip : vertical space between lines
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    36
% \railboxleft : space to the left of a box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    37
% \railboxright : space to the right of a box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    38
% \railovalspace : extra space around contents of oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    39
% \railframespace : extra space around contents of frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    40
% \railtextleft : space to the left of text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    41
% \railtextright : space to the right of text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    42
% \railtextup : space to lift text up
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    43
% \railjoinsize : circle size of join/split arcs
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    44
% \railjoinadjust : space to adjust join
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    45
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    46
% \railnamesep : separator between name and rule body
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    47
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    48
\newlength\railunit
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    49
\newlength\railextra
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    50
\newlength\railboxheight
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    51
\newlength\railboxskip
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    52
\newlength\railboxleft
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    53
\newlength\railboxright
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    54
\newlength\railovalspace
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    55
\newlength\railframespace
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    56
\newlength\railtextleft
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    57
\newlength\railtextright
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    58
\newlength\railtextup
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    59
\newlength\railjoinsize
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    60
\newlength\railjoinadjust
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    61
\newlength\railnamesep
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    62
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    63
% initialize the parameters
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    64
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    65
\setlength\railunit{1sp}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    66
\setlength\railextra{4ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    67
\setlength\railboxleft{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    68
\setlength\railboxright{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    69
\setlength\railovalspace{2ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    70
\setlength\railframespace{2ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    71
\setlength\railtextleft{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    72
\setlength\railtextright{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    73
\setlength\railjoinadjust{0pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    74
\setlength\railnamesep{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    75
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    76
\DeclareOption{10pt}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    77
  \setlength\railboxheight{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    78
  \setlength\railboxskip{24pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    79
  \setlength\railtextup{5pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    80
  \setlength\railjoinsize{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    81
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    82
\DeclareOption{11pt}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    83
  \setlength\railboxheight{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    84
  \setlength\railboxskip{24pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    85
  \setlength\railtextup{5pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    86
  \setlength\railjoinsize{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    87
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    88
\DeclareOption{12pt}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    89
  \setlength\railboxheight{20pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    90
  \setlength\railboxskip{28pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    91
  \setlength\railtextup{6pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    92
  \setlength\railjoinsize{20pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    93
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    94
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    95
\ExecuteOptions{10pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    96
\ProcessOptions
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    97
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    98
% internal versions of the formatting parameters
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    99
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   100
% \rail@extra   : \railextra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   101
% \rail@boxht   : \railboxheight
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   102
% \rail@boxsp   : \railboxskip
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   103
% \rail@boxlf   : \railboxleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   104
% \rail@boxrt   : \railboxright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   105
% \rail@boxhht  : \railboxheight / 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   106
% \rail@ovalsp  : \railovalspace
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   107
% \rail@framesp : \railframespace
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   108
% \rail@textlf  : \railtextleft
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   109
% \rail@textrt  : \railtextright
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   110
% \rail@textup  : \railtextup
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   111
% \rail@joinsz  : \railjoinsize
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   112
% \rail@joinhsz : \railjoinsize / 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   113
% \rail@joinadj : \railjoinadjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   114
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   115
% \railinit : internalize all of the parameters.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   116
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   117
\newcount\rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   118
\newcount\rail@boxht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   119
\newcount\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   120
\newcount\rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   121
\newcount\rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   122
\newcount\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   123
\newcount\rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   124
\newcount\rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   125
\newcount\rail@textlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   126
\newcount\rail@textrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   127
\newcount\rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   128
\newcount\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   129
\newcount\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   130
\newcount\rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   131
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   132
\newcommand\railinit{
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   133
\rail@extra=\railextra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   134
\divide\rail@extra by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   135
\rail@boxht=\railboxheight
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   136
\divide\rail@boxht by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   137
\rail@boxsp=\railboxskip
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   138
\divide\rail@boxsp by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   139
\rail@boxlf=\railboxleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   140
\divide\rail@boxlf by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   141
\rail@boxrt=\railboxright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   142
\divide\rail@boxrt by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   143
\rail@boxhht=\railboxheight
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   144
\divide\rail@boxhht by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   145
\divide\rail@boxhht by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   146
\rail@ovalsp=\railovalspace
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   147
\divide\rail@ovalsp by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   148
\rail@framesp=\railframespace
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   149
\divide\rail@framesp by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   150
\rail@textlf=\railtextleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   151
\divide\rail@textlf by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   152
\rail@textrt=\railtextright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   153
\divide\rail@textrt by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   154
\rail@textup=\railtextup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   155
\divide\rail@textup by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   156
\rail@joinsz=\railjoinsize
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   157
\divide\rail@joinsz by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   158
\rail@joinhsz=\railjoinsize
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   159
\divide\rail@joinhsz by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   160
\divide\rail@joinhsz by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   161
\rail@joinadj=\railjoinadjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   162
\divide\rail@joinadj by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   163
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   164
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   165
\AtBeginDocument{\railinit}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   166
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   167
% \rail@param : declarations for list environment
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   168
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   169
% \railparam{TEXT} : sets \rail@param to TEXT
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   170
%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   171
% \rail@reserved : characters reserved for grammar
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   172
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   173
\newcommand\railparam[1]{
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   174
\def\rail@param{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   175
  \setlength\leftmargin{0pt}\setlength\rightmargin{0pt}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   176
  \setlength\labelwidth{0pt}\setlength\labelsep{0pt}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   177
  \setlength\itemindent{0pt}\setlength\listparindent{0pt}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   178
  #1
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   179
}
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   180
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   181
\railparam{}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   182
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   183
\newtoks\rail@reserved
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   184
\rail@reserved={:;|*+?[]()'"}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   185
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   186
% \rail@termfont : format setup for terminals
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   187
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   188
% \rail@nontfont : format setup for nonterminals
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   189
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   190
% \rail@annofont : format setup for annotations
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   191
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   192
% \rail@rulefont : format setup for rule names
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   193
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   194
% \rail@indexfont : format setup for index entry
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   195
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   196
% \railtermfont{TEXT} : set terminal format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   197
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   198
% \railnontermfont{TEXT} : set nonterminal format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   199
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   200
% \railannotatefont{TEXT} : set annotation format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   201
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   202
% \railnamefont{TEXT} : set rule name format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   203
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   204
% \railindexfont{TEXT} : set index entry format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   205
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   206
\def\rail@termfont{\ttfamily\upshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   207
\def\rail@nontfont{\rmfamily\upshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   208
\def\rail@annofont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   209
\def\rail@namefont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   210
\def\rail@indexfont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   211
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   212
\newcommand\railtermfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   213
\def\rail@termfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   214
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   215
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   216
\newcommand\railnontermfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   217
\def\rail@nontfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   218
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   219
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   220
\newcommand\railannotatefont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   221
\def\rail@annofont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   222
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   223
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   224
\newcommand\railnamefont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   225
\def\rail@namefont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   226
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   227
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   228
\newcommand\railindexfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   229
\def\rail@indexfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   230
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   231
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   232
% railroad read/write macros
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   233
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   234
% \begin{rail} TEXT \end{rail} : TEXT is written out to the .rai file,
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   235
%                                as \rail@i{NR}{TEXT}. Then the matching
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   236
%                                \rail@o{NR}{FMT} from the .rao file is
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   237
%                                executed (if defined).
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   238
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   239
% \railoptions{OPTIONS} : OPTIONS are written out to the .rai file,
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   240
%                         as \rail@p{OPTIONS}.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   241
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   242
% \railterm{IDENT,IDENT,...} : format IDENT as terminals. writes out
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   243
%                              \rail@t{IDENT} to the .rai file
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   244
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   245
% \railalias{IDENT}{TEXT} : format IDENT as TEXT. defines \rail@t@IDENT as
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   246
%                           TEXT.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   247
%
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   248
% \railtoken{IDENT}{TEXT} : abbreviates \railalias{IDENT}{TEXT}\railterm{IDENT}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   249
%                           (for backward compatibility)
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   250
%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   251
% \rail@setcodes : guards special characters
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   252
%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   253
% \rail@makeother{CHARACTER} : sets \catcode of CHARACTER to "other"
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   254
%                              used inside a loop for \rail@setcodes
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   255
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   256
% \rail@nr : railroad diagram counter
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   257
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   258
% \ifrail@match : current \rail@i{NR}{TEXT} matches
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   259
%
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   260
% \rail@first : actions to be done first. read in .rao file,
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   261
%               open .rai file if \@filesw true, undefine \rail@first.
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   262
%               executed from \begin{rail}, \railoptions and \railterm.
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   263
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   264
% \rail@i{NR}{TEXT} : defines \rail@i@NR as TEXT. written to the .rai
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   265
%                     file by \rail, read from the .rao file by
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   266
%                     \rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   267
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   268
% \rail@t{IDENT} : tells Rail that IDENT is to be custom formatted,
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   269
%                  written to the .rai file by \railterm.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   270
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   271
% \rail@o{NR}{TEXT} : defines \rail@o@NR as TEXT, read from the .rao
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   272
%                     file by \rail@first.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   273
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   274
% \rail@p{OPTIONS} : pass options to rail, written to the .rai file by
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   275
%                    \railoptions
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   276
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   277
% \rail@write{TEXT} : write TEXT to the .rai file
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   278
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   279
% \rail@warn : warn user for mismatching diagrams
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   280
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   281
% \rail@endwarn : either \relax or \rail@warn
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   282
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   283
% \ifrail@all : checked at the end of the document
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   284
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   285
\def\rail@makeother#1{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   286
  \expandafter\catcode\expandafter`\csname\string #1\endcsname=12
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   287
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   288
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   289
\def\rail@setcodes{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   290
\let\par=\relax
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   291
\let\\=\relax
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   292
\expandafter\@tfor\expandafter\rail@symbol\expandafter:\expandafter=%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   293
  \the\rail@reserved
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   294
\do{\expandafter\rail@makeother\rail@symbol}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   295
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   296
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   297
\newcount\rail@nr
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   298
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   299
\newif\ifrail@all
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   300
\rail@alltrue
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   301
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   302
\newif\ifrail@match
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   303
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   304
\def\rail@first{
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   305
\begingroup
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   306
\makeatletter
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   307
\rail@setcodes
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   308
\InputIfFileExists{\jobname.rao}{}{\PackageInfo{rail}{No file \jobname.rao}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   309
\makeatother
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   310
\endgroup
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   311
\if@filesw
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   312
\newwrite\tf@rai
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   313
\immediate\openout\tf@rai=\jobname.rai
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   314
\fi
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   315
\global\let\rail@first=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   316
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   317
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   318
\long\def\rail@body#1\end{
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   319
{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   320
\newlinechar=`^^J
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   321
\def\par{\string\par^^J}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   322
\rail@write{\string\rail@i{\number\rail@nr}{#1}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   323
}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   324
\xdef\rail@i@{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   325
\end
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   326
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   327
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   328
\newenvironment{rail}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   329
\global\advance\rail@nr by 1
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   330
\rail@first
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   331
\begingroup
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   332
\rail@setcodes
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   333
\rail@body
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   334
}{
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   335
\endgroup
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   336
\rail@matchtrue
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   337
\@ifundefined{rail@o@\number\rail@nr}{\rail@matchfalse}{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   338
\expandafter\ifx\csname rail@i@\number\rail@nr\endcsname\rail@i@
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   339
\else
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   340
\rail@matchfalse
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   341
\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   342
\ifrail@match
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   343
\csname rail@o@\number\rail@nr\endcsname
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   344
\else
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   345
\PackageWarning{rail}{Railroad diagram {\number\rail@nr} doesn't match}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   346
\global\let\rail@endwarn=\rail@warn
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   347
\begin{list}{}{\rail@param}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   348
\rail@begin{1}{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   349
\rail@setbox{\bfseries ???}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   350
\rail@oval
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   351
\rail@end
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   352
\end{list}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   353
\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   354
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   355
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   356
\newcommand\railoptions[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   357
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   358
\rail@write{\string\rail@p{#1}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   359
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   360
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   361
\newcommand\railterm[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   362
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   363
\@for\rail@@:=#1\do{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   364
\rail@write{\string\rail@t{\rail@@}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   365
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   366
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   367
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   368
\newcommand\railalias[2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   369
\expandafter\def\csname rail@t@#1\endcsname{#2}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   370
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   371
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   372
\newcommand\railtoken[2]{\railalias{#1}{#2}\railterm{#1}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   373
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   374
\long\def\rail@i#1#2{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   375
\expandafter\gdef\csname rail@i@#1\endcsname{#2}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   376
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   377
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   378
\def\rail@o#1#2{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   379
\expandafter\gdef\csname rail@o@#1\endcsname{
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   380
\begin{list}{}{\rail@param}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   381
#2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   382
\end{list}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   383
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   384
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   385
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   386
\def\rail@t#1{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   387
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   388
\def\rail@p#1{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   389
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   390
\long\def\rail@write#1{\@ifundefined{tf@rai}{}{\immediate\write\tf@rai{#1}}}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   391
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   392
\def\rail@warn{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   393
\PackageWarningNoLine{rail}{Railroad diagram(s) may have changed.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   394
                            Use 'rail' and rerun}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   395
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   396
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   397
\let\rail@endwarn=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   398
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   399
\AtEndDocument{\rail@endwarn}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   400
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   401
% index entry macro
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   402
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   403
% \rail@index{IDENT} : add index entry for IDENT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   404
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   405
\def\rail@index#1{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   406
\index{\rail@indexfont#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   407
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   408
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   409
% railroad formatting primitives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   410
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   411
% \rail@x : current x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   412
% \rail@y : current y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   413
% \rail@ex : current end x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   414
% \rail@sx : starting x for \rail@cr
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   415
% \rail@rx : rightmost previous x for \rail@cr
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   416
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   417
% \rail@tmpa : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   418
% \rail@tmpb : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   419
% \rail@tmpc : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   420
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   421
% \rail@put : put at (\rail@x,\rail@y)
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   422
% \rail@vput : put vector at (\rail@x,\rail@y)
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   423
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   424
% \rail@eline : end line by drawing from \rail@ex to \rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   425
%
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   426
% \rail@vreline : end line by drawing a vector from \rail@x to \rail@ex
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   427
%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   428
% \rail@vleline : end line by drawing a vector from \rail@ex to \rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   429
%
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   430
% \rail@sety{LEVEL} : set \rail@y to level LEVEL
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   431
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   432
\newcount\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   433
\newcount\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   434
\newcount\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   435
\newcount\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   436
\newcount\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   437
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   438
\newcount\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   439
\newcount\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   440
\newcount\rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   441
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   442
\def\rail@put{\put(\number\rail@x,\number\rail@y)}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   443
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   444
\def\rail@vput{\put(\number\rail@ex,\number\rail@y)}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   445
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   446
\def\rail@eline{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   447
\rail@tmpb=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   448
\advance\rail@tmpb by -\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   449
\rail@put{\line(-1,0){\number\rail@tmpb}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   450
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   451
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   452
\def\rail@vreline{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   453
\rail@tmpb=\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   454
\advance\rail@tmpb by -\rail@ex
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   455
\rail@vput{\vector(1,0){\number\rail@tmpb}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   456
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   457
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   458
\def\rail@vleline{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   459
\rail@tmpb=\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   460
\advance\rail@tmpb by -\rail@ex
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   461
\rail@put{\vector(-1,0){\number\rail@tmpb}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   462
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   463
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   464
\def\rail@sety#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   465
\rail@y=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   466
\multiply\rail@y by -\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   467
\advance\rail@y by -\rail@boxht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   468
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   469
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   470
% \rail@begin{HEIGHT}{NAME} : begin a railroad diagram of height HEIGHT
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   471
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   472
% \rail@end : end a railroad diagram
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   473
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   474
% \rail@expand{IDENT} : expand IDENT
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   475
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   476
\def\rail@begin#1#2{
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   477
\item
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   478
\begin{minipage}[t]{\linewidth}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   479
\ifx\@empty#2\else
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   480
{\rail@namefont \rail@expand{#2}}\\*[\railnamesep]
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   481
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   482
\unitlength=\railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   483
\rail@tmpa=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   484
\multiply\rail@tmpa by \rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   485
\begin{picture}(0,\number\rail@tmpa)(0,-\number\rail@tmpa)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   486
\rail@ex=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   487
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   488
\rail@x=\rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   489
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   490
\rail@sety{0}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   491
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   492
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   493
\def\rail@end{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   494
\advance\rail@x by \rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   495
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   496
\end{picture}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   497
\end{minipage}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   498
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   499
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   500
\def\rail@vend{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   501
\advance\rail@x by \rail@extra
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   502
\rail@vreline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   503
\end{picture}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   504
\end{minipage}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   505
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   506
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   507
\def\rail@expand#1{\@ifundefined{rail@t@#1}{#1}{\csname rail@t@#1\endcsname}}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   508
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   509
% \rail@token{TEXT}[ANNOT] : format token TEXT with annotation
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   510
% \rail@ltoken{TEXT}[ANNOT] : format token TEXT with annotation, arrow left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   511
% \rail@rtoken{TEXT}[ANNOT] : format token TEXT with annotation, arrow right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   512
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   513
% \rail@ctoken{TEXT}[ANNOT] : format token TEXT centered with annotation
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   514
% \rail@lctoken{TEXT}[ANNOT] : format token TEXT centered with annotation, arrow left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   515
% \rail@rctoken{TEXT}[ANNOT] : format token TEXT centered with annotation, arrow right
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   516
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   517
% \rail@nont{TEXT}[ANNOT] : format nonterminal TEXT with annotation
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   518
% \rail@lnont{TEXT}[ANNOT] : format nonterminal TEXT with annotation, arrow left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   519
% \rail@rnont{TEXT}[ANNOT] : format nonterminal TEXT with annotation. arrow right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   520
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   521
% \rail@cnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   522
% \rail@lcnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation,
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   523
%                             arrow left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   524
% \rail@rcnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation,
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   525
%                             arrow right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   526
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   527
% \rail@term{TEXT}[ANNOT] : format terminal TEXT with annotation
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   528
% \rail@lterm{TEXT}[ANNOT] : format terminal TEXT with annotation, arrow left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   529
% \rail@rterm{TEXT}[ANNOT] : format terminal TEXT with annotation, arrow right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   530
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   531
% \rail@cterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   532
% \rail@lcterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation, arrow left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   533
% \rail@rcterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation,
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   534
%                             arrow right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   535
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   536
% \rail@annote[TEXT] : format TEXT as annotation
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   537
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   538
\def\rail@token#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   539
\rail@setbox{%
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   540
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   541
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   542
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   543
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   544
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   545
\def\rail@ltoken#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   546
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   547
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   548
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   549
\rail@vloval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   550
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   551
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   552
\def\rail@rtoken#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   553
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   554
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   555
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   556
\rail@vroval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   557
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   558
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   559
\def\rail@ctoken#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   560
\rail@setbox{%
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   561
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   562
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   563
\rail@coval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   564
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   565
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   566
\def\rail@lctoken#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   567
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   568
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   569
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   570
\rail@vlcoval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   571
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   572
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   573
\def\rail@rctoken#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   574
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   575
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   576
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   577
\rail@vrcoval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   578
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   579
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   580
\def\rail@nont#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   581
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   582
{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   583
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   584
\rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   585
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   586
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   587
\def\rail@lnont#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   588
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   589
{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   590
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   591
\rail@vlframe
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   592
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   593
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   594
\def\rail@rnont#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   595
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   596
{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   597
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   598
\rail@vrframe
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   599
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   600
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   601
\def\rail@cnont#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   602
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   603
{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   604
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   605
\rail@cframe
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   606
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   607
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   608
\def\rail@lcnont#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   609
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   610
{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   611
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   612
\rail@vlcframe
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   613
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   614
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   615
\def\rail@rcnont#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   616
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   617
{\rail@nontfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   618
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   619
\rail@vrcframe
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   620
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   621
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   622
\def\rail@term#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   623
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   624
{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   625
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   626
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   627
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   628
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   629
\def\rail@lterm#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   630
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   631
{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   632
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   633
\rail@vloval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   634
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   635
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   636
\def\rail@rterm#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   637
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   638
{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   639
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   640
\rail@vroval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   641
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   642
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   643
\def\rail@cterm#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   644
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   645
{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   646
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   647
\rail@coval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   648
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   649
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   650
\def\rail@lcterm#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   651
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   652
{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   653
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   654
\rail@vlcoval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   655
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   656
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   657
\def\rail@rcterm#1[#2]{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   658
\rail@setbox{%
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   659
{\rail@termfont #1}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   660
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   661
\rail@vrcoval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   662
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   663
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   664
\def\rail@annote[#1]{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   665
\rail@setbox{\rail@annofont #1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   666
\rail@text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   667
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   668
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   669
% \rail@box : temporary box for \rail@oval and \rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   670
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   671
% \rail@setbox{TEXT} : set \rail@box to TEXT, set \rail@tmpa to width
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   672
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   673
% \rail@oval : format \rail@box of width \rail@tmpa inside an oval
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   674
% \rail@vloval : format \rail@box of width \rail@tmpa inside an oval, vector left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   675
% \rail@vroval : format \rail@box of width \rail@tmpa inside an oval, vector right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   676
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   677
% \rail@coval : same as \rail@oval, but centered between \rail@x and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   678
%               \rail@mx
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   679
% \rail@vlcoval : same as \rail@oval, but centered between \rail@x and
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   680
%                 \rail@mx, vector left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   681
% \rail@vrcoval : same as \rail@oval, but centered between \rail@x and
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   682
%                 \rail@mx, vector right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   683
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   684
% \rail@frame : format \rail@box of width \rail@tmpa inside a frame
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   685
% \rail@vlframe : format \rail@box of width \rail@tmpa inside a frame, vector left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   686
% \rail@vrframe : format \rail@box of width \rail@tmpa inside a frame, vector right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   687
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   688
% \rail@cframe : same as \rail@frame, but centered between \rail@x and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   689
%                \rail@mx
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   690
% \rail@vlcframe : same as \rail@frame, but centered between \rail@x and
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   691
%                  \rail@mx, vector left
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   692
% \rail@vrcframe : same as \rail@frame, but centered between \rail@x and
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   693
%                  \rail@mx, vector right
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   694
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   695
% \rail@text : format \rail@box of width \rail@tmpa above the line
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   696
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   697
\newbox\rail@box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   698
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   699
\def\rail@setbox#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   700
\setbox\rail@box\hbox{\strut#1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   701
\rail@tmpa=\wd\rail@box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   702
\divide\rail@tmpa by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   703
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   704
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   705
\def\rail@oval{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   706
\advance\rail@x by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   707
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   708
\advance\rail@tmpa by \rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   709
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   710
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   711
\divide\rail@tmpb by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   712
\advance\rail@y by -\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   713
\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   714
\advance\rail@y by \rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   715
\advance\rail@x by \rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   716
\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   717
\advance\rail@x by \rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   718
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   719
\advance\rail@x by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   720
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   721
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   722
\def\rail@vloval{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   723
\advance\rail@x by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   724
\rail@eline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   725
\advance\rail@tmpa by \rail@ovalsp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   726
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   727
\rail@tmpb=\rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   728
\divide\rail@tmpb by 2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   729
\advance\rail@y by -\rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   730
\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   731
\advance\rail@y by \rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   732
\advance\rail@x by \rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   733
\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   734
\advance\rail@x by \rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   735
\rail@ex=\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   736
\advance\rail@x by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   737
\rail@vleline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   738
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   739
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   740
\def\rail@vroval{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   741
\advance\rail@x by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   742
\rail@vreline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   743
\advance\rail@tmpa by \rail@ovalsp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   744
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   745
\rail@tmpb=\rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   746
\divide\rail@tmpb by 2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   747
\advance\rail@y by -\rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   748
\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   749
\advance\rail@y by \rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   750
\advance\rail@x by \rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   751
\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   752
\advance\rail@x by \rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   753
\rail@ex=\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   754
\advance\rail@x by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   755
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   756
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   757
\def\rail@coval{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   758
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   759
\advance\rail@tmpb by \rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   760
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   761
\advance\rail@tmpb by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   762
\advance\rail@tmpb by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   763
\rail@tmpc=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   764
\advance\rail@tmpc by -\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   765
\advance\rail@tmpc by -\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   766
\divide\rail@tmpc by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   767
\ifnum\rail@tmpc>0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   768
\advance\rail@x by \rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   769
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   770
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   771
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   772
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   773
\def\rail@vlcoval{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   774
\rail@tmpb=\rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   775
\advance\rail@tmpb by \rail@ovalsp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   776
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   777
\advance\rail@tmpb by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   778
\advance\rail@tmpb by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   779
\rail@tmpc=\rail@mx
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   780
\advance\rail@tmpc by -\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   781
\advance\rail@tmpc by -\rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   782
\divide\rail@tmpc by 2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   783
\ifnum\rail@tmpc>0
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   784
\advance\rail@x by \rail@tmpc
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   785
\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   786
\rail@vloval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   787
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   788
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   789
\def\rail@vrcoval{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   790
\rail@tmpb=\rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   791
\advance\rail@tmpb by \rail@ovalsp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   792
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   793
\advance\rail@tmpb by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   794
\advance\rail@tmpb by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   795
\rail@tmpc=\rail@mx
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   796
\advance\rail@tmpc by -\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   797
\advance\rail@tmpc by -\rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   798
\divide\rail@tmpc by 2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   799
\ifnum\rail@tmpc>0
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   800
\advance\rail@x by \rail@tmpc
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   801
\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   802
\rail@vroval
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   803
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   804
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   805
\def\rail@frame{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   806
\advance\rail@x by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   807
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   808
\advance\rail@tmpa by \rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   809
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   810
\advance\rail@y by -\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   811
\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   812
\advance\rail@y by \rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   813
\advance\rail@x by \rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   814
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   815
\advance\rail@x by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   816
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   817
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   818
\def\rail@vlframe{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   819
\advance\rail@x by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   820
\rail@eline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   821
\advance\rail@tmpa by \rail@framesp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   822
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   823
\advance\rail@y by -\rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   824
\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   825
\advance\rail@y by \rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   826
\advance\rail@x by \rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   827
\rail@ex=\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   828
\advance\rail@x by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   829
\rail@vleline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   830
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   831
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   832
\def\rail@vrframe{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   833
\advance\rail@x by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   834
\rail@vreline
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   835
\advance\rail@tmpa by \rail@framesp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   836
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   837
\advance\rail@y by -\rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   838
\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   839
\advance\rail@y by \rail@boxhht
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   840
\advance\rail@x by \rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   841
\rail@ex=\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   842
\advance\rail@x by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   843
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   844
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   845
\def\rail@cframe{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   846
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   847
\advance\rail@tmpb by \rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   848
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   849
\advance\rail@tmpb by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   850
\advance\rail@tmpb by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   851
\rail@tmpc=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   852
\advance\rail@tmpc by -\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   853
\advance\rail@tmpc by -\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   854
\divide\rail@tmpc by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   855
\ifnum\rail@tmpc>0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   856
\advance\rail@x by \rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   857
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   858
\rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   859
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   860
13044
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   861
\def\rail@vlcframe{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   862
\rail@tmpb=\rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   863
\advance\rail@tmpb by \rail@framesp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   864
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   865
\advance\rail@tmpb by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   866
\advance\rail@tmpb by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   867
\rail@tmpc=\rail@mx
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   868
\advance\rail@tmpc by -\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   869
\advance\rail@tmpc by -\rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   870
\divide\rail@tmpc by 2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   871
\ifnum\rail@tmpc>0
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   872
\advance\rail@x by \rail@tmpc
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   873
\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   874
\rail@vlframe
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   875
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   876
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   877
\def\rail@vrcframe{
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   878
\rail@tmpb=\rail@tmpa
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   879
\advance\rail@tmpb by \rail@framesp
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   880
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   881
\advance\rail@tmpb by \rail@boxlf
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   882
\advance\rail@tmpb by \rail@boxrt
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   883
\rail@tmpc=\rail@mx
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   884
\advance\rail@tmpc by -\rail@x
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   885
\advance\rail@tmpc by -\rail@tmpb
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   886
\divide\rail@tmpc by 2
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   887
\ifnum\rail@tmpc>0
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   888
\advance\rail@x by \rail@tmpc
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   889
\fi
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   890
\rail@vrframe
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   891
}
c049910774cb for rail v 1.2
paulson
parents: 8591
diff changeset
   892
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   893
\def\rail@text{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   894
\advance\rail@x by \rail@textlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   895
\advance\rail@y by \rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   896
\rail@put{\box\rail@box}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   897
\advance\rail@y by -\rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   898
\advance\rail@x by \rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   899
\advance\rail@x by \rail@textrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   900
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   901
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   902
% alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   903
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   904
% \rail@jx \rail@jy : current join point
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   905
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   906
% \rail@gx \rail@gy \rail@gex \rail@grx : global versions of \rail@x etc,
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   907
%                                         to pass values over group closings
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   908
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   909
% \rail@mx : maximum x so far
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   910
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   911
% \rail@sy : starting \rail@y for alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   912
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   913
% \rail@jput : put at (\rail@jx,\rail@jy)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   914
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   915
% \rail@joval[PART] : put \oval[PART] with adjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   916
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   917
\newcount\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   918
\newcount\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   919
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   920
\newcount\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   921
\newcount\rail@gy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   922
\newcount\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   923
\newcount\rail@grx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   924
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   925
\newcount\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   926
\newcount\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   927
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   928
\def\rail@jput{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   929
\put(\number\rail@jx,\number\rail@jy)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   930
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   931
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   932
\def\rail@joval[#1]{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   933
\advance\rail@jx by \rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   934
\rail@jput{\oval(\number\rail@joinsz,\number\rail@joinsz)[#1]}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   935
\advance\rail@jx by -\rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   936
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   937
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   938
% \rail@barsplit : incoming split for '|'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   939
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   940
% \rail@plussplit : incoming split for '+'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   941
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   942
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   943
\def\rail@barsplit{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   944
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   945
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   946
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   947
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   948
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   949
\def\rail@plussplit{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   950
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   951
\advance\rail@jx by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   952
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   953
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   954
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   955
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   956
% \rail@alt{SPLIT} : start alternatives with incoming split SPLIT
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   957
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   958
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   959
\def\rail@alt#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   960
\rail@sy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   961
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   962
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   963
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   964
\rail@mx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   965
\let\rail@list=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   966
\let\rail@comma=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   967
\let\rail@split=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   968
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   969
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   970
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   971
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   972
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   973
% \rail@nextalt{FIX}{Y} : start next alternative at vertical position Y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   974
%                         and fix-up FIX
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   975
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   976
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   977
\def\rail@nextalt#1#2{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   978
\global\rail@gx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   979
\global\rail@gy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   980
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   981
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   982
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   983
#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   984
\ifnum\rail@gx>\rail@mx\rail@mx=\rail@gx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   985
\ifnum\rail@grx>\rail@mx\rail@mx=\rail@grx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   986
\edef\rail@list{\rail@list\rail@comma\number\rail@gex:\number\rail@gy}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   987
\def\rail@comma{,}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   988
\rail@split
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   989
\let\rail@split=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   990
\rail@sety{#2}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   991
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   992
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   993
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   994
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   995
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   996
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   997
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   998
\rail@joval[bl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   999
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1000
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1001
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1002
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1003
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1004
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1005
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1006
% \rail@barjoin : outgoing join for first '|' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1007
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1008
% \rail@plusjoin : outgoing join for first '+' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1009
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1010
% \rail@altjoin : join for subsequent alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1011
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1012
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1013
\def\rail@barjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1014
\ifnum\rail@y<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1015
\global\rail@gex=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1016
\else
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1017
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1018
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1019
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1020
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1021
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1022
\ifnum\rail@y<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1023
\rail@altjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1024
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1025
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1026
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1027
\def\rail@plusjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1028
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1029
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1030
\advance\rail@jx by -\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1031
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1032
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1033
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1034
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1035
\def\rail@altjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1036
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1037
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1038
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1039
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1040
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1041
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1042
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1043
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1044
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1045
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1046
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1047
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1048
% \rail@eltsplit EX:Y; : split EX:Y into \rail@ex \rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1049
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1050
% \rail@endalt{JOIN} : end alternatives with outgoing join JOIN
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1051
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1052
\def\rail@eltsplit#1:#2;{\rail@ex=#1\rail@y=#2}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1053
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1054
\def\rail@endalt#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1055
\global\rail@gx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1056
\global\rail@gy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1057
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1058
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1059
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1060
\ifnum\rail@gx>\rail@mx\rail@mx=\rail@gx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1061
\ifnum\rail@grx>\rail@mx\rail@mx=\rail@grx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1062
\edef\rail@list{\rail@list\rail@comma\number\rail@gex:\number\rail@gy}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1063
\rail@x=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1064
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1065
\rail@jy=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1066
\advance\rail@jx by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1067
\let\rail@join=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1068
\@for\rail@elt:=\rail@list\do{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1069
\expandafter\rail@eltsplit\rail@elt;
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1070
\rail@join
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1071
\let\rail@join=\rail@altjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1072
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1073
\rail@x=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1074
\rail@y=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1075
\rail@ex=\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1076
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1077
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1078
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1079
% \rail@bar : start '|' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1080
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1081
% \rail@nextbar : next '|' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1082
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1083
% \rail@endbar : end '|' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1084
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1085
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1086
\def\rail@bar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1087
\rail@alt\rail@barsplit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1088
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1089
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1090
\def\rail@nextbar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1091
\rail@nextalt\relax
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1092
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1093
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1094
\def\rail@endbar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1095
\rail@endalt\rail@barjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1096
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1097
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1098
% \rail@plus : start '+' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1099
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1100
% \rail@nextplus: next '+' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1101
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1102
% \rail@endplus : end '+' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1103
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1104
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1105
\def\rail@plus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1106
\rail@alt\rail@plussplit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1107
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1108
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1109
\def\rail@nextplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1110
\rail@nextalt\rail@fixplus
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1111
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1112
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1113
\def\rail@fixplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1114
\ifnum\rail@gy<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1115
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1116
\rail@x=\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1117
\rail@y=\rail@gy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1118
\rail@ex=\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1119
\rail@rx=\rail@grx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1120
\ifnum\rail@x<\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1121
\rail@x=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1122
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1123
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1124
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1125
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1126
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1127
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1128
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1129
\rail@tmpa=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1130
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1131
\advance\rail@tmpa by -\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1132
\rail@jput{\line(0,1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1133
\rail@jy=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1134
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1135
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1136
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1137
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1138
\global\rail@gx=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1139
\global\rail@gy=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1140
\global\rail@gex=\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1141
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1142
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1143
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1144
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1145
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1146
\def\rail@endplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1147
\rail@endalt\rail@plusjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1148
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1149
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1150
% \rail@cr{Y} : carriage return to vertical position Y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1151
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1152
\def\rail@cr#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1153
\rail@tmpa=\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1154
\advance\rail@tmpa by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1155
\ifnum\rail@x<\rail@tmpa\rail@x=\rail@tmpa\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1156
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1157
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1158
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1159
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1160
\ifnum\rail@x>\rail@rx\rail@rx=\rail@x\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1161
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1162
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1163
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1164
\rail@sety{#1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1165
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1166
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1167
\advance\rail@tmpa by -\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1168
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1169
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1170
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1171
\advance\rail@jy by \rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1172
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1173
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1174
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1175
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1176
\rail@tmpa=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1177
\advance\rail@tmpa by -\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1178
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1179
\rail@jput{\line(-1,0){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1180
\rail@jx=\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1181
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1182
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1183
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1184
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1185
\rail@tmpa=\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1186
\advance\rail@tmpa by -\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1187
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1188
\advance\rail@jy by -\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1189
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1190
\rail@joval[bl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1191
\rail@x=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1192
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
  1193
}