doc-src/rail.sty
author wenzelm
Wed, 05 Dec 2001 03:15:32 +0100
changeset 12381 5177845a34f5
parent 8591 9d660fc42916
child 13044 c049910774cb
permissions -rw-r--r--
simplified NetRules;
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
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
     4
% 08-Oct-90 L. Rooijakkers      fixed centering bug when \rail@tmpc<0.
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
     5
% 07-Feb-91 L. Rooijakkers      added \railoptions command, indexing
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
     6
% 08-Feb-91 L. Rooijakkers      minor fixes
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
     7
% 28-Jun-94 K. Barthelmann      turned into LaTeX2e package
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
     8
% 08-Dec-96 K. Barthelmann      replaced \@writefile
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
     9
% 13-Dec-96 K. Barthelmann      cleanup
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    10
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    11
% This style file needs to be used in conjunction with the 'rail'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    12
% program. Running LaTeX as 'latex file' produces file.rai, which should be
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    13
% processed by Rail with 'rail file'. This produces file.rao, which will
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    14
% be picked up by LaTeX on the next 'latex file' run.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    15
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    16
% LaTeX will warn if there is no file.rao or it's out of date.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    17
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    18
% The macros in this file thus consist of two parts: those that read and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    19
% write the .rai and .rao files, and those that do the actual formatting
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    20
% of the railroad diagrams.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    21
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    22
\NeedsTeXFormat{LaTeX2e}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    23
\ProvidesPackage{rail}[1996/12/13]
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    24
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    25
% railroad diagram formatting parameters (user level)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    26
% all of these are copied into their internal versions by \railinit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    27
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    28
% \railunit : \unitlength within railroad diagrams
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    29
% \railextra : extra length at outside of diagram
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    30
% \railboxheight : height of ovals and frames
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    31
% \railboxskip : vertical space between lines
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    32
% \railboxleft : space to the left of a box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    33
% \railboxright : space to the right of a box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    34
% \railovalspace : extra space around contents of oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    35
% \railframespace : extra space around contents of frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    36
% \railtextleft : space to the left of text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    37
% \railtextright : space to the right of text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    38
% \railtextup : space to lift text up
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    39
% \railjoinsize : circle size of join/split arcs
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    40
% \railjoinadjust : space to adjust join
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    41
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    42
% \railnamesep : separator between name and rule body
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    43
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    44
\newlength\railunit
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    45
\newlength\railextra
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    46
\newlength\railboxheight
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    47
\newlength\railboxskip
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    48
\newlength\railboxleft
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    49
\newlength\railboxright
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    50
\newlength\railovalspace
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    51
\newlength\railframespace
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    52
\newlength\railtextleft
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    53
\newlength\railtextright
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    54
\newlength\railtextup
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    55
\newlength\railjoinsize
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    56
\newlength\railjoinadjust
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    57
\newlength\railnamesep
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    58
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    59
% initialize the parameters
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    60
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    61
\setlength\railunit{1sp}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    62
\setlength\railextra{4ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    63
\setlength\railboxleft{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    64
\setlength\railboxright{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    65
\setlength\railovalspace{2ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    66
\setlength\railframespace{2ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    67
\setlength\railtextleft{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    68
\setlength\railtextright{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    69
\setlength\railjoinadjust{0pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    70
\setlength\railnamesep{1ex}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    71
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    72
\DeclareOption{10pt}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    73
  \setlength\railboxheight{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    74
  \setlength\railboxskip{24pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    75
  \setlength\railtextup{5pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    76
  \setlength\railjoinsize{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    77
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    78
\DeclareOption{11pt}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    79
  \setlength\railboxheight{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    80
  \setlength\railboxskip{24pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    81
  \setlength\railtextup{5pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    82
  \setlength\railjoinsize{16pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    83
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    84
\DeclareOption{12pt}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    85
  \setlength\railboxheight{20pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    86
  \setlength\railboxskip{28pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    87
  \setlength\railtextup{6pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    88
  \setlength\railjoinsize{20pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    89
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    90
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    91
\ExecuteOptions{10pt}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
    92
\ProcessOptions
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    93
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    94
% internal versions of the formatting parameters
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    95
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    96
% \rail@extra   : \railextra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    97
% \rail@boxht   : \railboxheight
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    98
% \rail@boxsp   : \railboxskip
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
    99
% \rail@boxlf   : \railboxleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   100
% \rail@boxrt   : \railboxright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   101
% \rail@boxhht  : \railboxheight / 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   102
% \rail@ovalsp  : \railovalspace
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   103
% \rail@framesp : \railframespace
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   104
% \rail@textlf  : \railtextleft
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   105
% \rail@textrt  : \railtextright
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   106
% \rail@textup  : \railtextup
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   107
% \rail@joinsz  : \railjoinsize
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   108
% \rail@joinhsz : \railjoinsize / 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   109
% \rail@joinadj : \railjoinadjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   110
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   111
% \railinit : internalize all of the parameters.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   112
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   113
\newcount\rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   114
\newcount\rail@boxht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   115
\newcount\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   116
\newcount\rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   117
\newcount\rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   118
\newcount\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   119
\newcount\rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   120
\newcount\rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   121
\newcount\rail@textlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   122
\newcount\rail@textrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   123
\newcount\rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   124
\newcount\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   125
\newcount\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   126
\newcount\rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   127
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   128
\newcommand\railinit{
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   129
\rail@extra=\railextra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   130
\divide\rail@extra by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   131
\rail@boxht=\railboxheight
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   132
\divide\rail@boxht by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   133
\rail@boxsp=\railboxskip
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   134
\divide\rail@boxsp by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   135
\rail@boxlf=\railboxleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   136
\divide\rail@boxlf by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   137
\rail@boxrt=\railboxright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   138
\divide\rail@boxrt by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   139
\rail@boxhht=\railboxheight
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   140
\divide\rail@boxhht by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   141
\divide\rail@boxhht by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   142
\rail@ovalsp=\railovalspace
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   143
\divide\rail@ovalsp by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   144
\rail@framesp=\railframespace
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   145
\divide\rail@framesp by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   146
\rail@textlf=\railtextleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   147
\divide\rail@textlf by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   148
\rail@textrt=\railtextright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   149
\divide\rail@textrt by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   150
\rail@textup=\railtextup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   151
\divide\rail@textup by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   152
\rail@joinsz=\railjoinsize
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   153
\divide\rail@joinsz by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   154
\rail@joinhsz=\railjoinsize
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   155
\divide\rail@joinhsz by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   156
\divide\rail@joinhsz by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   157
\rail@joinadj=\railjoinadjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   158
\divide\rail@joinadj by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   159
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   160
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   161
\AtBeginDocument{\railinit}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   162
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   163
% \rail@param : declarations for list environment
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   164
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   165
% \railparam{TEXT} : sets \rail@param to TEXT
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
\def\rail@param{}
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
\newcommand\railparam[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   170
\def\rail@param{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   171
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   172
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   173
% \rail@tokenfont : format setup for \railtoken identifiers
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   174
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   175
% \rail@termfont : format setup for terminals
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   176
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   177
% \rail@nontfont : format setup for nonterminals
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   178
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   179
% \rail@annofont : format setup for annotations
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   180
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   181
% \rail@rulefont : format setup for rule names
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   182
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   183
% \rail@indexfont : format setup for index entry
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   184
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   185
% \railtermfont{TEXT} : set terminal format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   186
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   187
% \railnontermfont{TEXT} : set nonterminal format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   188
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   189
% \railannotatefont{TEXT} : set annotation format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   190
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   191
% \railnamefont{TEXT} : set rule name format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   192
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   193
% \railindexfont{TEXT} : set index entry format setup to TEXT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   194
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   195
\def\rail@tokenfont{\ttfamily\upshape}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   196
\def\rail@termfont{\ttfamily\upshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   197
\def\rail@nontfont{\rmfamily\upshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   198
\def\rail@annofont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   199
\def\rail@namefont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   200
\def\rail@indexfont{\rmfamily\itshape}
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
\newcommand\railtermfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   203
\def\rail@termfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   204
}
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
\newcommand\railnontermfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   207
\def\rail@nontfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   208
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   209
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   210
\newcommand\railannotatefont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   211
\def\rail@annofont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   212
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   213
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   214
\newcommand\railnamefont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   215
\def\rail@namefont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   216
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   217
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   218
\newcommand\railindexfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   219
\def\rail@indexfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   220
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   221
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   222
% railroad read/write macros
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
% \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
   225
%                                as \rail@i{NR}{TEXT}. Then the matching
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   226
%                                \rail@o{NR}{FMT} from the .rao file is
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   227
%                                executed (if defined).
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   228
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   229
% \railoptions{OPTIONS} : OPTIONS are written out to the .rai file,
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   230
%                         as \rail@p{OPTIONS}.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   231
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   232
% \railterm{IDENT,IDENT,...} : format IDENT as terminals. writes out
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   233
%                              \rail@t{IDENT} to the .rai file
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   234
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   235
% \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
   236
%                           TEXT.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   237
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   238
% \rail@nr : railroad diagram counter
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   239
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   240
% \ifrail@match : current \rail@i{NR}{TEXT} matches
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   241
%
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   242
% \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
   243
%               open .rai file if \@filesw true, undefine \rail@first.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   244
%               executed from \begin{rail} and \railtoken.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   245
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   246
% \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
   247
%                     file by \rail, read from the .rao file by
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   248
%                     \rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   249
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   250
% \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
   251
%                  written to the .rai file by \railterm.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   252
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   253
% \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
   254
%                     file by \rail@first.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   255
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   256
% \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
   257
%                    \railoptions
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   258
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   259
% \rail@write{TEXT} : write TEXT to the .rai file
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   260
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   261
% \rail@warn : warn user for mismatching diagrams
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   262
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   263
% \rail@endwarn : either \relax or \rail@warn
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   264
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   265
% \ifrail@all : checked at the end of the document
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   266
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   267
\newcount\rail@nr
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   268
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   269
\newif\ifrail@all
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   270
\rail@alltrue
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   271
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   272
\newif\ifrail@match
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
\def\rail@first{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   275
\makeatletter
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   276
\InputIfFileExists{\jobname.rao}{}{\PackageInfo{rail}{No file \jobname.rao}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   277
\makeatother
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   278
\if@filesw
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   279
\newwrite\tf@rai
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   280
\immediate\openout\tf@rai=\jobname.rai
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   281
\fi
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   282
\global\let\rail@first=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   283
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   284
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   285
\long\def\rail@body#1\end{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   286
\begingroup
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   287
\let\\=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   288
\xdef\rail@i@{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   289
\rail@write{\string\rail@i{\number\rail@nr}{\rail@i@}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   290
\endgroup
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   291
\end
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   292
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   293
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   294
\newenvironment{rail}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   295
\global\advance\rail@nr by 1
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   296
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   297
\rail@body
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
\rail@matchtrue
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   300
\@ifundefined{rail@o@\number\rail@nr}{\rail@matchfalse}{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   301
\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
   302
\else
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   303
\rail@matchfalse
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   304
\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   305
\ifrail@match
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   306
\csname rail@o@\number\rail@nr\endcsname
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   307
\else
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   308
\PackageWarning{rail}{Railroad diagram {\number\rail@nr} doesn't match}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   309
\global\let\rail@endwarn=\rail@warn
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   310
\begin{list}{}{\rail@param}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   311
\rail@begin{1}{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   312
\rail@setbox{\bfseries ???}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   313
\rail@oval
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   314
\rail@end
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   315
\end{list}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   316
\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   317
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   318
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   319
\newcommand\railoptions[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   320
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   321
\rail@write{\string\rail@p{#1}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   322
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   323
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   324
\newcommand\railterm[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   325
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   326
\@for\rail@@:=#1\do{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   327
\rail@write{\string\rail@t{\rail@@}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   328
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   329
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   330
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   331
\newcommand\railalias[2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   332
\expandafter\def\csname rail@t@#1\endcsname{#2}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   333
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   334
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   335
\long\def\rail@i#1#2{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   336
\expandafter\gdef\csname rail@i@#1\endcsname{#2}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   337
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   338
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   339
\def\rail@o#1#2{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   340
\expandafter\gdef\csname rail@o@#1\endcsname{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   341
\begin{list}{}{\rail@param}#2\end{list}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   342
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   343
}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   344
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   345
\def\rail@t#1{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   346
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   347
\def\rail@p#1{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   348
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   349
\def\rail@write#1{\@ifundefined{tf@rai}{}{\immediate\write\tf@rai{#1}}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   350
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   351
\def\rail@warn{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   352
\PackageWarningNoLine{rail}{Railroad diagram(s) may have changed.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   353
                            Use 'rail' and rerun}
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
\let\rail@endwarn=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   357
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   358
\AtEndDocument{\rail@endwarn}
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
% index entry macro
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   361
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   362
% \rail@index{IDENT} : add index entry for IDENT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   363
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   364
\def\rail@index#1{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   365
\index{\rail@indexfont#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   366
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   367
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   368
% railroad formatting primitives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   369
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   370
% \rail@x : current x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   371
% \rail@y : current y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   372
% \rail@ex : current end x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   373
% \rail@sx : starting x for \rail@cr
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   374
% \rail@rx : rightmost previous x for \rail@cr
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   375
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   376
% \rail@tmpa : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   377
% \rail@tmpb : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   378
% \rail@tmpc : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   379
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   380
% \rail@put : put at (\rail@x,\rail@y)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   381
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   382
% \rail@eline : end line by drawing from \rail@ex to \rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   383
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   384
% \rail@sety{LEVEL} : set \rail@y to level LEVEL
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   385
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   386
\newcount\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   387
\newcount\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   388
\newcount\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   389
\newcount\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   390
\newcount\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   391
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   392
\newcount\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   393
\newcount\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   394
\newcount\rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   395
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   396
\def\rail@put{\put(\number\rail@x,\number\rail@y)}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   397
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   398
\def\rail@eline{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   399
\rail@tmpb=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   400
\advance\rail@tmpb by -\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   401
\rail@put{\line(-1,0){\number\rail@tmpb}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   402
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   403
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   404
\def\rail@sety#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   405
\rail@y=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   406
\multiply\rail@y by -\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   407
\advance\rail@y by -\rail@boxht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   408
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   409
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   410
% \rail@begin{HEIGHT}{NAME} : begin a railroad diagram of height HEIGHT
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   411
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   412
% \rail@end : end a railroad diagram
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   413
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   414
% \rail@expand{IDENT} : expand IDENT
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   415
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   416
\def\rail@begin#1#2{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   417
\item[]
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   418
\begin{minipage}[t]{\linewidth}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   419
\ifx\@empty#2\else
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   420
{\rail@namefont \rail@expand{#2}}\\*[\railnamesep]
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   421
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   422
\unitlength=\railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   423
\rail@tmpa=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   424
\multiply\rail@tmpa by \rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   425
\begin{picture}(0,\number\rail@tmpa)(0,-\number\rail@tmpa)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   426
\rail@ex=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   427
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   428
\rail@x=\rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   429
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   430
\rail@sety{0}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   431
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   432
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   433
\def\rail@end{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   434
\advance\rail@x by \rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   435
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   436
\end{picture}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   437
\end{minipage}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   438
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   439
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   440
\def\rail@expand#1{\@ifundefined{rail@t@#1}{#1}{\csname rail@t@#1\endcsname}}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   441
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   442
% \rail@token{TEXT}[ANNOT] : format token TEXT with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   443
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   444
% \rail@ctoken{TEXT}[ANNOT] : format token TEXT centered with annotation
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   445
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   446
% \rail@nont{TEXT}[ANNOT] : format nonterminal TEXT with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   447
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   448
% \rail@cnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   449
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   450
% \rail@term{TEXT}[ANNOT] : format terminal TEXT with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   451
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   452
% \rail@cterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   453
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   454
% \rail@annote[TEXT] : format TEXT as annotation
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   455
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   456
\def\rail@token#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   457
\rail@setbox{%
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   458
{\rail@tokenfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   459
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   460
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   461
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   462
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   463
\def\rail@ctoken#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   464
\rail@setbox{%
8591
9d660fc42916 fixed \rail@tokenfont (ever used?);
wenzelm
parents: 3097
diff changeset
   465
{\rail@tokenfont \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
   466
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   467
\rail@coval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   468
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   469
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   470
\def\rail@nont#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   471
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   472
{\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
   473
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   474
\rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   475
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   476
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   477
\def\rail@cnont#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   478
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   479
{\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
   480
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   481
\rail@cframe
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   482
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   483
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   484
\def\rail@term#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   485
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   486
{\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
   487
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   488
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   489
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   490
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   491
\def\rail@cterm#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   492
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   493
{\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
   494
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   495
\rail@coval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   496
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   497
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   498
\def\rail@annote[#1]{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   499
\rail@setbox{\rail@annofont #1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   500
\rail@text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   501
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   502
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   503
% \rail@box : temporary box for \rail@oval and \rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   504
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   505
% \rail@setbox{TEXT} : set \rail@box to TEXT, set \rail@tmpa to width
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   506
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   507
% \rail@oval : format \rail@box of width \rail@tmpa inside an oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   508
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   509
% \rail@coval : same as \rail@oval, but centered between \rail@x and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   510
%               \rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   511
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   512
% \rail@frame : format \rail@box of width \rail@tmpa inside a frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   513
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   514
% \rail@cframe : same as \rail@frame, but centered between \rail@x and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   515
%                \rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   516
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   517
% \rail@text : format \rail@box of width \rail@tmpa above the line
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   518
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   519
\newbox\rail@box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   520
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   521
\def\rail@setbox#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   522
\setbox\rail@box\hbox{\strut#1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   523
\rail@tmpa=\wd\rail@box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   524
\divide\rail@tmpa by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   525
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   526
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   527
\def\rail@oval{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   528
\advance\rail@x by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   529
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   530
\advance\rail@tmpa by \rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   531
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   532
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   533
\divide\rail@tmpb by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   534
\advance\rail@y by -\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   535
\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   536
\advance\rail@y by \rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   537
\advance\rail@x by \rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   538
\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   539
\advance\rail@x by \rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   540
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   541
\advance\rail@x by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   542
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   543
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   544
\def\rail@coval{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   545
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   546
\advance\rail@tmpb by \rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   547
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   548
\advance\rail@tmpb by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   549
\advance\rail@tmpb by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   550
\rail@tmpc=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   551
\advance\rail@tmpc by -\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   552
\advance\rail@tmpc by -\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   553
\divide\rail@tmpc by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   554
\ifnum\rail@tmpc>0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   555
\advance\rail@x by \rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   556
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   557
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   558
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   559
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   560
\def\rail@frame{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   561
\advance\rail@x by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   562
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   563
\advance\rail@tmpa by \rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   564
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   565
\advance\rail@y by -\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   566
\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   567
\advance\rail@y by \rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   568
\advance\rail@x by \rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   569
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   570
\advance\rail@x by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   571
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   572
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   573
\def\rail@cframe{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   574
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   575
\advance\rail@tmpb by \rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   576
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   577
\advance\rail@tmpb by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   578
\advance\rail@tmpb by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   579
\rail@tmpc=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   580
\advance\rail@tmpc by -\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   581
\advance\rail@tmpc by -\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   582
\divide\rail@tmpc by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   583
\ifnum\rail@tmpc>0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   584
\advance\rail@x by \rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   585
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   586
\rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   587
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   588
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   589
\def\rail@text{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   590
\advance\rail@x by \rail@textlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   591
\advance\rail@y by \rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   592
\rail@put{\box\rail@box}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   593
\advance\rail@y by -\rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   594
\advance\rail@x by \rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   595
\advance\rail@x by \rail@textrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   596
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   597
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   598
% alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   599
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   600
% \rail@jx \rail@jy : current join point
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   601
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   602
% \rail@gx \rail@gy \rail@gex \rail@grx : global versions of \rail@x etc,
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   603
%                                         to pass values over group closings
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   604
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   605
% \rail@mx : maximum x so far
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   606
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   607
% \rail@sy : starting \rail@y for alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   608
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   609
% \rail@jput : put at (\rail@jx,\rail@jy)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   610
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   611
% \rail@joval[PART] : put \oval[PART] with adjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   612
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   613
\newcount\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   614
\newcount\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   615
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   616
\newcount\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   617
\newcount\rail@gy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   618
\newcount\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   619
\newcount\rail@grx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   620
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   621
\newcount\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   622
\newcount\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   623
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   624
\def\rail@jput{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   625
\put(\number\rail@jx,\number\rail@jy)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   626
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   627
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   628
\def\rail@joval[#1]{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   629
\advance\rail@jx by \rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   630
\rail@jput{\oval(\number\rail@joinsz,\number\rail@joinsz)[#1]}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   631
\advance\rail@jx by -\rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   632
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   633
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   634
% \rail@barsplit : incoming split for '|'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   635
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   636
% \rail@plussplit : incoming split for '+'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   637
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   638
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   639
\def\rail@barsplit{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   640
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   641
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   642
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   643
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   644
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   645
\def\rail@plussplit{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   646
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   647
\advance\rail@jx by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   648
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   649
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   650
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   651
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   652
% \rail@alt{SPLIT} : start alternatives with incoming split SPLIT
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   653
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   654
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   655
\def\rail@alt#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   656
\rail@sy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   657
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   658
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   659
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   660
\rail@mx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   661
\let\rail@list=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   662
\let\rail@comma=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   663
\let\rail@split=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   664
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   665
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   666
\rail@rx=0
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@nextalt{FIX}{Y} : start next alternative at vertical position Y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   670
%                         and fix-up FIX
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   671
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   672
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   673
\def\rail@nextalt#1#2{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   674
\global\rail@gx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   675
\global\rail@gy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   676
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   677
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   678
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   679
#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   680
\ifnum\rail@gx>\rail@mx\rail@mx=\rail@gx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   681
\ifnum\rail@grx>\rail@mx\rail@mx=\rail@grx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   682
\edef\rail@list{\rail@list\rail@comma\number\rail@gex:\number\rail@gy}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   683
\def\rail@comma{,}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   684
\rail@split
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   685
\let\rail@split=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   686
\rail@sety{#2}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   687
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   688
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   689
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   690
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   691
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   692
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   693
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   694
\rail@joval[bl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   695
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   696
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   697
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   698
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   699
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   700
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   701
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   702
% \rail@barjoin : outgoing join for first '|' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   703
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   704
% \rail@plusjoin : outgoing join for first '+' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   705
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   706
% \rail@altjoin : join for subsequent alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   707
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   708
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   709
\def\rail@barjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   710
\ifnum\rail@y<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   711
\global\rail@gex=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   712
\else
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   713
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   714
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   715
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   716
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   717
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   718
\ifnum\rail@y<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   719
\rail@altjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   720
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   721
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   722
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   723
\def\rail@plusjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   724
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   725
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   726
\advance\rail@jx by -\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   727
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   728
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   729
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   730
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   731
\def\rail@altjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   732
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   733
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   734
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   735
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   736
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   737
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   738
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   739
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   740
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   741
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   742
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   743
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   744
% \rail@eltsplit EX:Y; : split EX:Y into \rail@ex \rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   745
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   746
% \rail@endalt{JOIN} : end alternatives with outgoing join JOIN
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   747
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   748
\def\rail@eltsplit#1:#2;{\rail@ex=#1\rail@y=#2}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   749
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   750
\def\rail@endalt#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   751
\global\rail@gx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   752
\global\rail@gy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   753
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   754
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   755
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   756
\ifnum\rail@gx>\rail@mx\rail@mx=\rail@gx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   757
\ifnum\rail@grx>\rail@mx\rail@mx=\rail@grx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   758
\edef\rail@list{\rail@list\rail@comma\number\rail@gex:\number\rail@gy}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   759
\rail@x=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   760
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   761
\rail@jy=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   762
\advance\rail@jx by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   763
\let\rail@join=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   764
\@for\rail@elt:=\rail@list\do{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   765
\expandafter\rail@eltsplit\rail@elt;
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   766
\rail@join
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   767
\let\rail@join=\rail@altjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   768
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   769
\rail@x=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   770
\rail@y=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   771
\rail@ex=\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   772
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   773
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   774
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   775
% \rail@bar : start '|' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   776
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   777
% \rail@nextbar : next '|' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   778
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   779
% \rail@endbar : end '|' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   780
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   781
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   782
\def\rail@bar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   783
\rail@alt\rail@barsplit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   784
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   785
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   786
\def\rail@nextbar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   787
\rail@nextalt\relax
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   788
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   789
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   790
\def\rail@endbar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   791
\rail@endalt\rail@barjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   792
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   793
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   794
% \rail@plus : start '+' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   795
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   796
% \rail@nextplus: next '+' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   797
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   798
% \rail@endplus : end '+' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   799
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   800
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   801
\def\rail@plus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   802
\rail@alt\rail@plussplit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   803
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   804
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   805
\def\rail@nextplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   806
\rail@nextalt\rail@fixplus
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   807
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   808
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   809
\def\rail@fixplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   810
\ifnum\rail@gy<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   811
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   812
\rail@x=\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   813
\rail@y=\rail@gy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   814
\rail@ex=\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   815
\rail@rx=\rail@grx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   816
\ifnum\rail@x<\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   817
\rail@x=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   818
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   819
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   820
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   821
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   822
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   823
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   824
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   825
\rail@tmpa=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   826
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   827
\advance\rail@tmpa by -\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   828
\rail@jput{\line(0,1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   829
\rail@jy=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   830
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   831
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   832
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   833
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   834
\global\rail@gx=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   835
\global\rail@gy=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   836
\global\rail@gex=\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   837
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   838
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   839
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   840
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   841
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   842
\def\rail@endplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   843
\rail@endalt\rail@plusjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   844
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   845
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   846
% \rail@cr{Y} : carriage return to vertical position Y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   847
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   848
\def\rail@cr#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   849
\rail@tmpa=\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   850
\advance\rail@tmpa by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   851
\ifnum\rail@x<\rail@tmpa\rail@x=\rail@tmpa\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   852
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   853
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   854
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   855
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   856
\ifnum\rail@x>\rail@rx\rail@rx=\rail@x\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   857
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   858
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   859
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   860
\rail@sety{#1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   861
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   862
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   863
\advance\rail@tmpa by -\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   864
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   865
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   866
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   867
\advance\rail@jy by \rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   868
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   869
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   870
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   871
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   872
\rail@tmpa=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   873
\advance\rail@tmpa by -\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   874
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   875
\rail@jput{\line(-1,0){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   876
\rail@jx=\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   877
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   878
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   879
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   880
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   881
\rail@tmpa=\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   882
\advance\rail@tmpa by -\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   883
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   884
\advance\rail@jy by -\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   885
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   886
\rail@joval[bl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   887
\rail@x=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   888
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   889
}