doc-src/rail.sty
author wenzelm
Mon, 13 Mar 2000 13:21:39 +0100
changeset 8434 5e4bba59bfaa
parent 3097 ae362c99a635
child 8591 9d660fc42916
permissions -rw-r--r--
use HOLogic.Not; export indexify_names;
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
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
     4
% 08-Oct-90 L. Rooijakkers	fixed centering bug when \rail@tmpc<0.
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
     5
% 07-Feb-91 L. Rooijakkers	added \railoptions command, indexing
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
     6
% 08-Feb-91 L. Rooijakkers	minor fixes
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
     7
% 28-Jun-94 K. Barthelmann	turned into LaTeX2e package
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
     8
% 08-Dec-96 K. Barthelmann	replaced \@writefile
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
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
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   104
% \rail@textlf	: \railtextleft
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   105
% \rail@textrt	: \railtextright
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   106
% \rail@textup	: \railtextup
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
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   195
\def\rail@termfont{\ttfamily\upshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   196
\def\rail@nontfont{\rmfamily\upshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   197
\def\rail@annofont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   198
\def\rail@namefont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   199
\def\rail@indexfont{\rmfamily\itshape}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   200
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   201
\newcommand\railtermfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   202
\def\rail@termfont{#1}
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
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   205
\newcommand\railnontermfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   206
\def\rail@nontfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   207
}
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
\newcommand\railannotatefont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   210
\def\rail@annofont{#1}
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
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   213
\newcommand\railnamefont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   214
\def\rail@namefont{#1}
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
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   217
\newcommand\railindexfont[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   218
\def\rail@indexfont{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   219
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   220
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   221
% railroad read/write macros
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
% \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
   224
%                                as \rail@i{NR}{TEXT}. Then the matching
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   225
%                                \rail@o{NR}{FMT} from the .rao file is
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   226
%                                executed (if defined).
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
% \railoptions{OPTIONS} : OPTIONS are written out to the .rai file,
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   229
%                         as \rail@p{OPTIONS}.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   230
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   231
% \railterm{IDENT,IDENT,...} : format IDENT as terminals. writes out
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   232
%                              \rail@t{IDENT} to the .rai file
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
% \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
   235
%                           TEXT.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   236
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   237
% \rail@nr : railroad diagram counter
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
% \ifrail@match : current \rail@i{NR}{TEXT} matches
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   240
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   241
% \rail@first :	actions to be done first. read in .rao file,
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   242
%               open .rai file if \@filesw true, undefine \rail@first.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   243
%               executed from \begin{rail} and \railtoken.
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
% \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
   246
%                     file by \rail, read from the .rao file by
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   247
%                     \rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   248
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   249
% \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
   250
%                  written to the .rai file by \railterm.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   251
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   252
% \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
   253
%                     file by \rail@first.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   254
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   255
% \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
   256
%                    \railoptions
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
% \rail@write{TEXT} : write TEXT to the .rai file
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   259
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   260
% \rail@warn : warn user for mismatching diagrams
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   261
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   262
% \rail@endwarn : either \relax or \rail@warn
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
% \ifrail@all : checked at the end of the document
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   265
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   266
\newcount\rail@nr
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
\newif\ifrail@all
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   269
\rail@alltrue
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
\newif\ifrail@match
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   272
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   273
\def\rail@first{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   274
\makeatletter
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   275
\InputIfFileExists{\jobname.rao}{}{\PackageInfo{rail}{No file \jobname.rao}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   276
\makeatother
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   277
\if@filesw
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   278
\newwrite\tf@rai
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   279
\immediate\openout\tf@rai=\jobname.rai
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   280
\fi
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   281
\global\let\rail@first=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   282
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   283
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   284
\long\def\rail@body#1\end{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   285
\begingroup
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   286
\let\\=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   287
\xdef\rail@i@{#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   288
\rail@write{\string\rail@i{\number\rail@nr}{\rail@i@}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   289
\endgroup
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   290
\end
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   291
}
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
\newenvironment{rail}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   294
\global\advance\rail@nr by 1
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   295
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   296
\rail@body
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   297
}{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   298
\rail@matchtrue
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   299
\@ifundefined{rail@o@\number\rail@nr}{\rail@matchfalse}{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   300
\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
   301
\else
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   302
\rail@matchfalse
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   303
\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   304
\ifrail@match
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   305
\csname rail@o@\number\rail@nr\endcsname
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   306
\else
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   307
\PackageWarning{rail}{Railroad diagram {\number\rail@nr} doesn't match}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   308
\global\let\rail@endwarn=\rail@warn
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   309
\begin{list}{}{\rail@param}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   310
\rail@begin{1}{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   311
\rail@setbox{\bfseries ???}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   312
\rail@oval
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   313
\rail@end
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   314
\end{list}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   315
\fi
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   316
}
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
\newcommand\railoptions[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   319
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   320
\rail@write{\string\rail@p{#1}}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   321
}
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
\newcommand\railterm[1]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   324
\rail@first
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   325
\@for\rail@@:=#1\do{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   326
\rail@write{\string\rail@t{\rail@@}}
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
}
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
\newcommand\railalias[2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   331
\expandafter\def\csname rail@t@#1\endcsname{#2}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   332
}
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
\long\def\rail@i#1#2{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   335
\expandafter\gdef\csname rail@i@#1\endcsname{#2}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   336
}
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
\def\rail@o#1#2{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   339
\expandafter\gdef\csname rail@o@#1\endcsname{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   340
\begin{list}{}{\rail@param}#2\end{list}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   341
}
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
\def\rail@t#1{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   345
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   346
\def\rail@p#1{}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   347
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   348
\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
   349
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   350
\def\rail@warn{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   351
\PackageWarningNoLine{rail}{Railroad diagram(s) may have changed.
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   352
                            Use 'rail' and rerun}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   353
}
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
\let\rail@endwarn=\relax
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   356
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   357
\AtEndDocument{\rail@endwarn}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   358
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   359
% index entry macro
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
% \rail@index{IDENT} : add index entry for IDENT
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   362
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   363
\def\rail@index#1{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   364
\index{\rail@indexfont#1}
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   365
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   366
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   367
% railroad formatting primitives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   368
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   369
% \rail@x : current x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   370
% \rail@y : current y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   371
% \rail@ex : current end x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   372
% \rail@sx : starting x for \rail@cr
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   373
% \rail@rx : rightmost previous x for \rail@cr
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   374
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   375
% \rail@tmpa : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   376
% \rail@tmpb : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   377
% \rail@tmpc : temporary count
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   378
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   379
% \rail@put : put at (\rail@x,\rail@y)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   380
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   381
% \rail@eline : end line by drawing from \rail@ex to \rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   382
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   383
% \rail@sety{LEVEL} : set \rail@y to level LEVEL
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   384
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   385
\newcount\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   386
\newcount\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   387
\newcount\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   388
\newcount\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   389
\newcount\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   390
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   391
\newcount\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   392
\newcount\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   393
\newcount\rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   394
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   395
\def\rail@put{\put(\number\rail@x,\number\rail@y)}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   396
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   397
\def\rail@eline{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   398
\rail@tmpb=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   399
\advance\rail@tmpb by -\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   400
\rail@put{\line(-1,0){\number\rail@tmpb}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   401
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   402
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   403
\def\rail@sety#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   404
\rail@y=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   405
\multiply\rail@y by -\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   406
\advance\rail@y by -\rail@boxht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   407
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   408
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   409
% \rail@begin{HEIGHT}{NAME} : begin a railroad diagram of height HEIGHT
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   410
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   411
% \rail@end : end a railroad diagram
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   412
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   413
% \rail@expand{IDENT} : expand IDENT
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   414
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   415
\def\rail@begin#1#2{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   416
\item[]
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   417
\begin{minipage}[t]{\linewidth}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   418
\ifx\@empty#2\else
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   419
{\rail@namefont \rail@expand{#2}}\\*[\railnamesep]
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   420
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   421
\unitlength=\railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   422
\rail@tmpa=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   423
\multiply\rail@tmpa by \rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   424
\begin{picture}(0,\number\rail@tmpa)(0,-\number\rail@tmpa)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   425
\rail@ex=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   426
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   427
\rail@x=\rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   428
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   429
\rail@sety{0}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   430
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   431
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   432
\def\rail@end{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   433
\advance\rail@x by \rail@extra
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   434
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   435
\end{picture}
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   436
\end{minipage}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   437
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   438
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   439
\def\rail@expand#1{\@ifundefined{rail@t@#1}{#1}{\csname rail@t@#1\endcsname}}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   440
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   441
% \rail@token{TEXT}[ANNOT] : format token TEXT with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   442
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   443
% \rail@ctoken{TEXT}[ANNOT] : format token TEXT centered with annotation
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   444
%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   445
% \rail@nont{TEXT}[ANNOT] : format nonterminal TEXT with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   446
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   447
% \rail@cnont{TEXT}[ANNOT] : format nonterminal TEXT centered with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   448
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   449
% \rail@term{TEXT}[ANNOT] : format terminal TEXT with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   450
%
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   451
% \rail@cterm{TEXT}[ANNOT] : format terminal TEXT centered with annotation
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   452
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   453
% \rail@annote[TEXT] : format TEXT as annotation
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   454
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   455
\def\rail@token#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   456
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   457
{\rail@termfont \rail@expand{#1}}\ifx\@empty#2\else\ {\rail@annofont #2}\fi
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   458
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   459
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   460
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   461
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   462
\def\rail@ctoken#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   463
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   464
{\rail@termfont \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
   465
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   466
\rail@coval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   467
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   468
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   469
\def\rail@nont#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   470
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   471
{\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
   472
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   473
\rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   474
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   475
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   476
\def\rail@cnont#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   477
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   478
{\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
   479
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   480
\rail@cframe
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   481
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   482
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   483
\def\rail@term#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   484
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   485
{\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
   486
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   487
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   488
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   489
3097
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   490
\def\rail@cterm#1[#2]{
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   491
\rail@setbox{%
ae362c99a635 New version of rail.sty for LaTeX 2e
berghofe
parents: 2658
diff changeset
   492
{\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
   493
}
2658
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   494
\rail@coval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   495
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   496
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   497
\def\rail@annote[#1]{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   498
\rail@setbox{\rail@annofont #1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   499
\rail@text
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   500
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   501
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   502
% \rail@box : temporary box for \rail@oval and \rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   503
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   504
% \rail@setbox{TEXT} : set \rail@box to TEXT, set \rail@tmpa to width
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   505
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   506
% \rail@oval : format \rail@box of width \rail@tmpa inside an oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   507
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   508
% \rail@coval : same as \rail@oval, but centered between \rail@x and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   509
%               \rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   510
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   511
% \rail@frame : format \rail@box of width \rail@tmpa inside a frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   512
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   513
% \rail@cframe : same as \rail@frame, but centered between \rail@x and
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   514
%                \rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   515
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   516
% \rail@text : format \rail@box of width \rail@tmpa above the line
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   517
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   518
\newbox\rail@box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   519
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   520
\def\rail@setbox#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   521
\setbox\rail@box\hbox{\strut#1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   522
\rail@tmpa=\wd\rail@box
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   523
\divide\rail@tmpa by \railunit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   524
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   525
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   526
\def\rail@oval{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   527
\advance\rail@x by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   528
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   529
\advance\rail@tmpa by \rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   530
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   531
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   532
\divide\rail@tmpb by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   533
\advance\rail@y by -\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   534
\rail@put{\makebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   535
\advance\rail@y by \rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   536
\advance\rail@x by \rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   537
\rail@put{\oval(\number\rail@tmpa,\number\rail@boxht)}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   538
\advance\rail@x by \rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   539
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   540
\advance\rail@x by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   541
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   542
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   543
\def\rail@coval{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   544
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   545
\advance\rail@tmpb by \rail@ovalsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   546
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   547
\advance\rail@tmpb by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   548
\advance\rail@tmpb by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   549
\rail@tmpc=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   550
\advance\rail@tmpc by -\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   551
\advance\rail@tmpc by -\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   552
\divide\rail@tmpc by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   553
\ifnum\rail@tmpc>0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   554
\advance\rail@x by \rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   555
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   556
\rail@oval
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   557
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   558
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   559
\def\rail@frame{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   560
\advance\rail@x by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   561
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   562
\advance\rail@tmpa by \rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   563
\ifnum\rail@tmpa<\rail@boxht\rail@tmpa=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   564
\advance\rail@y by -\rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   565
\rail@put{\framebox(\number\rail@tmpa,\number\rail@boxht){\box\rail@box}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   566
\advance\rail@y by \rail@boxhht
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   567
\advance\rail@x by \rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   568
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   569
\advance\rail@x by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   570
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   571
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   572
\def\rail@cframe{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   573
\rail@tmpb=\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   574
\advance\rail@tmpb by \rail@framesp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   575
\ifnum\rail@tmpb<\rail@boxht\rail@tmpb=\rail@boxht\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   576
\advance\rail@tmpb by \rail@boxlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   577
\advance\rail@tmpb by \rail@boxrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   578
\rail@tmpc=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   579
\advance\rail@tmpc by -\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   580
\advance\rail@tmpc by -\rail@tmpb
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   581
\divide\rail@tmpc by 2
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   582
\ifnum\rail@tmpc>0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   583
\advance\rail@x by \rail@tmpc
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   584
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   585
\rail@frame
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   586
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   587
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   588
\def\rail@text{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   589
\advance\rail@x by \rail@textlf
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   590
\advance\rail@y by \rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   591
\rail@put{\box\rail@box}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   592
\advance\rail@y by -\rail@textup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   593
\advance\rail@x by \rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   594
\advance\rail@x by \rail@textrt
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   595
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   596
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   597
% alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   598
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   599
% \rail@jx \rail@jy : current join point
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   600
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   601
% \rail@gx \rail@gy \rail@gex \rail@grx : global versions of \rail@x etc,
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   602
%                                         to pass values over group closings
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   603
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   604
% \rail@mx : maximum x so far
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   605
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   606
% \rail@sy : starting \rail@y for alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   607
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   608
% \rail@jput : put at (\rail@jx,\rail@jy)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   609
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   610
% \rail@joval[PART] : put \oval[PART] with adjust
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   611
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   612
\newcount\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   613
\newcount\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   614
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   615
\newcount\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   616
\newcount\rail@gy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   617
\newcount\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   618
\newcount\rail@grx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   619
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   620
\newcount\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   621
\newcount\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   622
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   623
\def\rail@jput{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   624
\put(\number\rail@jx,\number\rail@jy)
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   625
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   626
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   627
\def\rail@joval[#1]{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   628
\advance\rail@jx by \rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   629
\rail@jput{\oval(\number\rail@joinsz,\number\rail@joinsz)[#1]}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   630
\advance\rail@jx by -\rail@joinadj
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   631
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   632
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   633
% \rail@barsplit : incoming split for '|'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   634
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   635
% \rail@plussplit : incoming split for '+'
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   636
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   637
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   638
\def\rail@barsplit{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   639
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   640
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   641
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   642
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   643
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   644
\def\rail@plussplit{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   645
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   646
\advance\rail@jx by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   647
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   648
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   649
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   650
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   651
% \rail@alt{SPLIT} : start alternatives with incoming split SPLIT
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   652
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   653
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   654
\def\rail@alt#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   655
\rail@sy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   656
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   657
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   658
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   659
\rail@mx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   660
\let\rail@list=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   661
\let\rail@comma=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   662
\let\rail@split=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   663
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   664
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   665
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   666
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   667
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   668
% \rail@nextalt{FIX}{Y} : start next alternative at vertical position Y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   669
%                         and fix-up FIX
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   670
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   671
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   672
\def\rail@nextalt#1#2{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   673
\global\rail@gx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   674
\global\rail@gy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   675
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   676
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   677
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   678
#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   679
\ifnum\rail@gx>\rail@mx\rail@mx=\rail@gx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   680
\ifnum\rail@grx>\rail@mx\rail@mx=\rail@grx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   681
\edef\rail@list{\rail@list\rail@comma\number\rail@gex:\number\rail@gy}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   682
\def\rail@comma{,}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   683
\rail@split
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   684
\let\rail@split=\@empty
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   685
\rail@sety{#2}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   686
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   687
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   688
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   689
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   690
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   691
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   692
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   693
\rail@joval[bl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   694
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   695
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   696
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   697
\rail@sx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   698
\rail@rx=0
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   699
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   700
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   701
% \rail@barjoin : outgoing join for first '|' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   702
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   703
% \rail@plusjoin : outgoing join for first '+' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   704
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   705
% \rail@altjoin : join for subsequent alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   706
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   707
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   708
\def\rail@barjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   709
\ifnum\rail@y<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   710
\global\rail@gex=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   711
\else
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   712
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   713
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   714
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   715
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   716
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   717
\ifnum\rail@y<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   718
\rail@altjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   719
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   720
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   721
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   722
\def\rail@plusjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   723
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   724
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   725
\advance\rail@jx by -\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   726
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   727
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   728
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   729
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   730
\def\rail@altjoin{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   731
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   732
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   733
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   734
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   735
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   736
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   737
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   738
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   739
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   740
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   741
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   742
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   743
% \rail@eltsplit EX:Y; : split EX:Y into \rail@ex \rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   744
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   745
% \rail@endalt{JOIN} : end alternatives with outgoing join JOIN
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   746
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   747
\def\rail@eltsplit#1:#2;{\rail@ex=#1\rail@y=#2}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   748
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   749
\def\rail@endalt#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   750
\global\rail@gx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   751
\global\rail@gy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   752
\global\rail@gex=\rail@ex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   753
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   754
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   755
\ifnum\rail@gx>\rail@mx\rail@mx=\rail@gx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   756
\ifnum\rail@grx>\rail@mx\rail@mx=\rail@grx\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   757
\edef\rail@list{\rail@list\rail@comma\number\rail@gex:\number\rail@gy}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   758
\rail@x=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   759
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   760
\rail@jy=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   761
\advance\rail@jx by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   762
\let\rail@join=#1
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   763
\@for\rail@elt:=\rail@list\do{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   764
\expandafter\rail@eltsplit\rail@elt;
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   765
\rail@join
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   766
\let\rail@join=\rail@altjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   767
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   768
\rail@x=\rail@mx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   769
\rail@y=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   770
\rail@ex=\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   771
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   772
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   773
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   774
% \rail@bar : start '|' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   775
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   776
% \rail@nextbar : next '|' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   777
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   778
% \rail@endbar : end '|' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   779
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   780
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   781
\def\rail@bar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   782
\rail@alt\rail@barsplit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   783
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   784
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   785
\def\rail@nextbar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   786
\rail@nextalt\relax
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   787
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   788
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   789
\def\rail@endbar{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   790
\rail@endalt\rail@barjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   791
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   792
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   793
% \rail@plus : start '+' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   794
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   795
% \rail@nextplus: next '+' alternative
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   796
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   797
% \rail@endplus : end '+' alternatives
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   798
%
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   799
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   800
\def\rail@plus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   801
\rail@alt\rail@plussplit
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   802
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   803
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   804
\def\rail@nextplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   805
\rail@nextalt\rail@fixplus
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   806
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   807
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   808
\def\rail@fixplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   809
\ifnum\rail@gy<\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   810
\begingroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   811
\rail@x=\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   812
\rail@y=\rail@gy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   813
\rail@ex=\rail@gex
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   814
\rail@rx=\rail@grx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   815
\ifnum\rail@x<\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   816
\rail@x=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   817
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   818
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   819
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   820
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   821
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   822
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   823
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   824
\rail@tmpa=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   825
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   826
\advance\rail@tmpa by -\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   827
\rail@jput{\line(0,1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   828
\rail@jy=\rail@sy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   829
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   830
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   831
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   832
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   833
\global\rail@gx=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   834
\global\rail@gy=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   835
\global\rail@gex=\rail@gx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   836
\global\rail@grx=\rail@rx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   837
\endgroup
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   838
\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   839
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   840
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   841
\def\rail@endplus{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   842
\rail@endalt\rail@plusjoin
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   843
}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   844
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   845
% \rail@cr{Y} : carriage return to vertical position Y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   846
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   847
\def\rail@cr#1{
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   848
\rail@tmpa=\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   849
\advance\rail@tmpa by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   850
\ifnum\rail@x<\rail@tmpa\rail@x=\rail@tmpa\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   851
\rail@eline
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   852
\rail@jx=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   853
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   854
\advance\rail@x by \rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   855
\ifnum\rail@x>\rail@rx\rail@rx=\rail@x\fi
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   856
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   857
\rail@joval[tr]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   858
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   859
\rail@sety{#1}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   860
\rail@tmpa=\rail@jy
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   861
\advance\rail@tmpa by -\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   862
\advance\rail@tmpa by -\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   863
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   864
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   865
\rail@jy=\rail@y
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   866
\advance\rail@jy by \rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   867
\advance\rail@jy by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   868
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   869
\rail@joval[br]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   870
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   871
\rail@tmpa=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   872
\advance\rail@tmpa by -\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   873
\advance\rail@tmpa by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   874
\rail@jput{\line(-1,0){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   875
\rail@jx=\rail@sx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   876
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   877
\advance\rail@jy by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   878
\rail@joval[tl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   879
\advance\rail@jx by -\rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   880
\rail@tmpa=\rail@boxsp
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   881
\advance\rail@tmpa by -\rail@joinsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   882
\rail@jput{\line(0,-1){\number\rail@tmpa}}
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   883
\advance\rail@jy by -\rail@tmpa
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   884
\advance\rail@jx by \rail@joinhsz
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   885
\rail@joval[bl]
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   886
\rail@x=\rail@jx
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   887
\rail@ex=\rail@x
13ba951a4572 added this file;
wenzelm
parents:
diff changeset
   888
}