summaryrefslogtreecommitdiff
path: root/macros/text1/cms_help_files/halign.helpmark
blob: f3f45f42eaec4cd6dcd837678893dc61f57c77ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
+-----------------------------------------------------------------------------+
|                                   halign                                    |
+-----------------------------------------------------------------------------+
 
\halign{ preamble\cr
         tabular text\cr}
 
Abbreviation:  ã|noneã%
 
Parameters:    ã|preamble, tabular text, submarkupã%
 
Submarkup:     ã|\lft, \ctr, \rt, \cr, \noalign, \tabskip,
\omit, \multispan, \phantom, && (column repeat)ã%
 
    ã|Description:ã%
The \halign markup is  a way of making tables without  tabbing.  A preamble,
or sample line,  is included immediately after \halign  to act as a template
for the text in each column.  Each successive column in a row begins with an
ampersand (&).   Column descriptions may contain horizontal spaces, indents,
quads,  and horizontal fills.    Each column  description must have  a pound
 
sign (hash mark, #) which acts  as a reference variable, so that text can be
substituted.
    The halign is  read in its entirety.   Every column is  treated as a box
whose width is equal to the largest entry.
    Besides  horizontal  mode  markup  such  as \indent,   you can  use  the
following submarkup in the \halign.
 
\lft  in the preamble will left justify each entry in a column.
 
\ctr  in the preamble will center each entry in a column.
 
\rt  in the preamble will right justify each entry in a column.
 
\cr  marks the end of the preamble, and the end of each row.
 
\noalign  is used outside of  the preamble.  It allows you to enter vertical
mode text  into a  table.   You must  not end a  \noalign with  a \cr.   For
example, if  you wanted to  skip a blank  line between two  row entries, you
would use \noalign{\vs{\bl}}:
 
 
1000&32\cr
\noalign{\vs{\bl}}
2000&43\cr
 
\tabskip    puts an  equal  amount  of  space (glue)  between  columns.    A
specification of
 
\tabskip 20pt plus 15pt minus 10pt
 
indicates that the each column is set 20 points apart.  If after the initial
try it is determined that the  table is still narrower than the width of the
page, up to  an additional 15 points of space is  put between columns to try
and get the  table to spread across  the entire page.   If after the initial
try of  20 points  between each column  it is  determined that the  table is
too wide to  fit on the page,  up to 10 points is  subtracted from the space
between each column to try and get the table to fit on the page.
 
\omit   can be  used to  disable to  preamble specification for  that column
and row.   \omit only works  for one column of  one row.   For example, if a
preamble
 
\halign{\lft{#}&\rt{#}\cr
 
was specified, then to center a header over a column, you could enter
 
\omit\ctr{Header 1}&\omit\ctr{Header 2}\cr
1000&2000\cr
 
\multispan  is used to permit  spanning of several columns.  For example, if
you had a preamble of
 
\halign{\rt{#}&\rt{#}&\rt{#}\cr
 
and you  wanted to  center a title  over the  second and third  columns, you
would enter:
 
first column&\multispan2\ctr{Spanned title}\cr
 
\phantom  is used in decimal alignment.  For example,
 
00.1234&12.231\cr
72.8\phantom{000}&1.2\phantom{00}\cr
 
would print the partial table:
+-----------------------------------------------------------------------------+
|                                                                             |
| 00.1234  12.231                                                             |
| 72.8     1.2                                                                |
|                                                                             |
+-----------------------------------------------------------------------------+
&& is used to indicate that  the following column preamble is to be repeated
for each of the remaining of  columns.  For example, if you wanted the first
column centered, the second column left justified, and the next five columns
right justified, you could enter
 
\halign{\ctr{#}&\lft{#}&\rt{#}&\rt{#}&
      \rt{#}&\rt{#}&\rt{#}\cr
 
Using the column repeat indicator (&&) you can simplify this to
 
\halign{\ctr{#}&\lft{#}&&\rt{#}\cr
 
This specification  then says  that columns  3, 4,  etc.   all use  the same
preamble, "\rt{#}".
 
    ã|Example:ã%
This example illustrates \omit, \qquad and \tabskip.
 
\tabskip .5in plus .4in minus .3in
\halign{\rt{#}&\qquad\lft{#}\cr
\omit\ctr{Case}&\omit\qquad\ctr{Blast}\cr
\noalign{\vs{2pt}\hrule\vs{2pt}}
5000 MT&500\cr
10000 MT&845--1050\cr }
 
+-----------------------------------------------------------------------------+
|                                                                             |
|                                                                             |
| ..........5000.MT.......500............                                     |
|          10000 MT       845--1050                                           |
|                                                                             |
+-----------------------------------------------------------------------------+
 
    ã|Example:ã%
 
This      example      makes      use     of      \multispan,       \indent,
\horizontalspace, \noalign and column repeat (&&).
 
\tabletitle{Surface Land Temperature (degrees C)\lbr
Changes after Exchanges}
\vs{10pt}
\halign{\indent\lft{#}&\hs{2em}\rt{#}
       &&\hs{1em}\rt{#}\cr
Case&\multispan4\ctr{Post Detonations (Days)}\cr
Megatonnage&20&100&200&300\cr
\noalign{\vs{10pt}}
1000&-22&8&7&13\cr
3000&9&6&8&10\cr
5000&-7&-26&-20&-11\cr
10000&-24&-45&-26&-9\cr}
 
+-----------------------------------------------------------------------------+
|                                                                             |
|                                   Table 1                                   |
|                    Surface Land Temperature (degrees C)                     |
|                           Changes after Exchanges                           |
|                                                                             |
|                                                                             |
|  Case       Post Detonations (Days)                                         |
|  Megatonnage   20  100 200      300                                         |
|                                                                             |
|  1000         -22    8   7       13                                         |
|  3000           9    6   8       10                                         |
|  5000          -7  -26 -20      -11                                         |
|  10000        -24  -45 -26       -9                                         |
|                                                                             |
+-----------------------------------------------------------------------------+
 
    ã|Notes:ã%
\halign  takes  less computer  time  than  \settabs because  it  is  a basic
TEX command.  The advantages to \halign over \settabs are:
 
   * maximum column  widths are  calculated automatically;  you must measure
     the longest entry with \settabs.
   * templates are more versatile  than \settabs; repeatable information can
     be included in the preamble.
   * greater flexibility.
    Refer to  The TEXbook for  more about \halign,  \cr, \noalign, \tabskip,
\phantom, \omit, \multispan, or && (column repeat).
    You  can use  \autofootnote, \autoendnote,  and  \footnote inside  of an
\halign, so long as they are not also inside an \hbox or \vbox.
    Refer to the description of \leader for an example of using \halign with
dot leadering.
    See \strut for row alignment.
    Do not put a \cr on the same line as \noalign.