[latexrefman-commits] r385 - in /trunk: ChangeLog latex2e.texi
jhefferon at domain.hid
jhefferon at domain.hid
Tue Jul 28 02:59:05 CEST 2015
Author: jhefferon
Date: Tue Jul 28 02:59:04 2015
New Revision: 385
URL: http://svn.gna.org/viewcvs/latexrefman?rev=385&view=rev
Log:
expand tabular and multicolumn
Modified:
trunk/ChangeLog
trunk/latex2e.texi
Modified: trunk/ChangeLog
URL: http://svn.gna.org/viewcvs/latexrefman/trunk/ChangeLog?rev=385&r1=384&r2=385&view=diff
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Tue Jul 28 02:59:04 2015
@@ -1,3 +1,8 @@
+2015-07-22 Jim Hefferon <jhefferon at domain.hid>
+
+ * latex2e.texi (tabular, multicolumn): Add more content,
+ and examples.
+
2015-07-22 Jim Hefferon <jhefferon at domain.hid>
* latex2e.texi (Page layout parameters): Add marginal notes
Modified: trunk/latex2e.texi
URL: http://svn.gna.org/viewcvs/latexrefman/trunk/latex2e.texi?rev=385&r1=384&r2=385&view=diff
==============================================================================
--- trunk/latex2e.texi (original)
+++ trunk/latex2e.texi Tue Jul 28 02:59:04 2015
@@ -3185,8 +3185,8 @@
@example
\begin at domain.hid@}
-column 1 entry & column 2 entry ... & column n entry \\
-...
+column 1 entry &column 2 entry ... &column n entry \\
+ ...
\end at domain.hid@}
@end example
@@ -3195,43 +3195,60 @@
@example
\begin at domain.hid@}
-column 1 entry & column 2 entry ... & column n entry \\
-...
+column 1 entry &column 2 entry ... &column n entry \\
+ ...
\end at domain.hid*@}
@end example
-These environments produce a box consisting of a sequence of rows of
-items, aligned vertically in columns.
-
+These environments produce a table, a box consisting of a sequence of
+horozontal rows. Each row consists of items that are aligned vertically
+in columns. This illustrates many of the features.
+
+ at example
+\begin at domain.hid@}
+ \textit at domain.hid name@} &\textit at domain.hid home runs@} \\
+ \hline
+ Hank Aaron &755 \\
+ Babe Ruth &714
+\end at domain.hid@}
+ at end example
+
+The vertical format of two left-aligned columns, with a vertical bar
+between them, comes from @code{tabular}'s argument @code{@{l|l@}}.
+ at findex &
+Columns are separated with an ampersand @code{&}. A horizontal rule
+between two rows is created with @code{\hline}.
@findex \\ @r{for @code{tabular}}
- at domain.hid{\\} must be used to specify the end of each row of the table,
-except for the last, where it is optional---unless an @code{\hline}
-command (to put a rule below the table) follows.
-
-The mandatory and optional arguments consist of:
+The end of each row is marked with a double backslash at domain.hid{\\}.
+This @code{\\} is optional after the last row unless an @code{\hline}
+command follows, to put a rule below the table.
+
+The required and optional arguments to @code{tabular} consist of:
@table @code
@item width
-Specifies the width of the @code{tabular*} environment. There must be
-rubber space between columns that can stretch to fill out the specified
-width.
+Required for @code{tabular*}, not allowed for @code{tabular}. Specifies
+the width of the @code{tabular*} environment. The space between columns
+should be rubber, as with @code{@@@{\extracolsep at domain.hid@}@}}, to allow
+the table to stretch or shrink to make the specified width, or else you
+are likely to get the @code{Underfull \hbox (badness 10000) in alignment
+..} warning.
@item pos
-Specifies the vertical position; default is alignment on the centre of
-the environment.
-
- at domain.hid @code
- at domain.hid t
-align on top row
-
- at domain.hid b
-align on bottom row
- at domain.hid table
+Optional. Specifies the table's vertical position. The default is to
+align the table so its vertical center matches the baseline of the
+surrounding text. There are two other possible alignments: @code{t}
+aligns the table so its top row matches the baseline of the surrounding
+text, and @code{b} aligns on the bottom row.
+
+This only has an effect if there is other text. In the common case of a
+ at code{tabular} alone in a @code{center} environment this option makes
+no difference.
@item cols
-Specifies the column formatting. It consists of a sequence of the
-following specifiers, corresponding to the sequence of columns and
-intercolumn material.
+Required. Specifies the formatting of columns. It consists of a
+sequence of the following specifiers, corresponding to the types of
+column and intercolumn material.
@table @code
@item l
@@ -3246,46 +3263,88 @@
@item |
A vertical line the full height and depth of the environment.
- at domain.hid @@@{@var{text}@}
-This inserts @var{text} in every row. An @@-expression suppresses the
-intercolumn space normally inserted between columns; any desired space
-before the adjacent item must be included in @var{text}.
+ at item @@@{@var{text or space}@}
+This inserts @var{text or space} at this location in every row. The
+ at var{text or space} material is typeset in LR mode. This text is
+fragile (@pxref{\protect}).
+
+This specifier is optional: unless you put in your own @@-expression
+then @LaTeX{}'s book, article, and report classes will put on either
+side of each column a space of length @code{\tabcolsep}, which by
+default is @samp{6pt}. That is, by default adjacent columns are
+separated by 12pt (so @code{\tabcolsep} is misleadingly-named since it
+is not the separation between tabular columns). Also by default a space
+of 6pt comes before the first column as well as after the final column,
+unless you put a @code{@@@{..@}} or @code{|} there.
+
+If you override the default and use an @@-expression then you must
+insert any desired space yourself, as in @code{@@@{\hspace at domain.hid@}@}}.
+
+An empty expression @code{@@@{@}} will eliminate the space, including
+the space at the start or end, as in the example below where the tabular
+lines need to lie on the left margin.
+
+ at example
+\begin at domain.hid@}
+ \begin at domain.hid@}
+ ..
+ \end at domain.hid@}
+\end at domain.hid@}
+ at end example
+
+This example shows text, a decimal point, between the columns, arranged
+so the numbers in the table are aligned on that decimal point.
+
+ at example
+\begin at domain.hid@}
+ $3$ &$14$ \\
+ $9$ &$80665$
+\end at domain.hid@}
+ at end example
+
+ at findex \extracolsep
+An @code{\extracolsep at domain.hid}@}} command in an @@-expression causes an
+extra space of width @var{wd} to appear to the left of all subsequent
+columns, until countermanded by another @code{\extracolsep} command.
+Unlike ordinary intercolumn space, this extra space is not suppressed by
+an @@-expression. An @code{\extracolsep} command can be used only in an
+@@-expression in the @code{cols} argument. Below, @LaTeX{} inserts the
+right amount of intercolumn space to make the entire table 4 inches
+wide.
+
+ at example
+\begin at domain.hid@}
+ \begin at domain.hid@@@{\ \ldots\extracolsep at domain.hid@}
+ Seven times down, eight times up
+ &such is life!
+ \end at domain.hid*@}
+\end at domain.hid@}
+ at end example
To insert commands that are automatically executed before a given
-column, you have to load the @code{array} package and use the
- at domain.hid{>@{...@}} specifier.
+column, load the @code{array} package and use the @code{>@{...@}}
+specifier.
@c xx should fully explain array, tabularx, and all other base packages...
- at domain.hid \extracolsep
-An @code{\extracolsep at domain.hid@}} command in an @@-expression causes an
-extra space of width @code{wd} to appear to the left of all subsequent
-columns, until countermanded by another @code{\extracolsep} command.
-Unlike ordinary intercolumn space, this extra space is not suppressed
-by an @@-expression. An @code{\extracolsep} command can be used only
-in an @@-expression in the @code{cols} argument.
-
@item p at domain.hid}@}
-Produces a column with each item typeset in a parbox of width
- at domain.hid}, as if it were the argument of a
- at domain.hid}@}} command. However, a @code{\\} may not
-appear in the item, except in the following situations:
-
- at domain.hid
- at domain.hid
-inside an environment like @code{minipage}, @code{array}, or @code{tabular}.
- at domain.hid
-inside an explicit @code{\parbox}.
- at domain.hid
-in the scope of a @code{\centering}, @code{\raggedright}, or @code{\raggedleft}
-declaration. The latter declarations must appear inside braces or an
-environment when used in a @code{p}-column element.
- at domain.hid enumerate
+Each item in the column is typeset in a parbox of width @var{wd}.
+
+Note that a line break double backslash @code{\\} may not appear in the
+item, except inside an environment like @code{minipage}, @code{array},
+or @code{tabular}, or inside an explicit @code{\parbox}, or in the scope
+of a @code{\centering}, @code{\raggedright}, or @code{\raggedleft}
+declaration (when used in a @code{p}-column element these declarations
+must appear inside braces, as with @code{@{\centering .. \\
+..@}}). Otherwise @LaTeX{} will misinterpret the double backslash as
+ending the row.
@item *@{@var{num}@}@{@var{cols}@}
Equivalent to @var{num} copies of @var{cols}, where @var{num} is a
-positive integer and @var{cols} is any list of column-specifiers,
-which may contain another @code{*-expression}.
-
+positive integer and @var{cols} is a list of specifiers. Thus
+ at code{\begin at domain.hid@}|@}} is equivalent to
+ at code{\begin at domain.hid|@}}. Note that @var{cols} may
+contain another @code{*-expression}.
+
@end table
@end table
@@ -3294,31 +3353,35 @@
@ftable @code
@item \arrayrulewidth
-Thickness of the rule created by @code{|}, @code{\hline}, and
- at domain.hid} in the @code{tabular} and @code{array} environments; the
-default is @samp{.4pt}.
+A length that is the thickness of the rule created by @code{|},
+ at code{\hline}, and @code{\vline} in the @code{tabular} and @code{array}
+environments. The default is @samp{.4pt}. Change it as in
+ at code{\setlength at domain.hid@}}.
@item \arraystretch
-Scaling of spacing between rows in the @code{tabular} and @code{array}
-environments; default is @samp{1}, for no scaling.
+A factor by which the spacing between rows in the @code{tabular} and
+ at code{array} environments is multiplied. The default is @samp{1}, for
+no scaling. Change it as @code{\renewcommand at domain.hid@}}.
@item \doublerulesep
-Horizontal distance between the vertical rules produced by @code{||}
-in the @code{tabular} and @code{array} environments; default is @samp{2pt}.
+A length that is the distance between the vertical rules produced by the
+ at code{||} specifier. The default is @samp{2pt}.
@item \tabcolsep
-Half the width of the space between columns; default is @samp{6pt}.
+A length that is half of the space between columns. The default is
+ at samp{6pt}. Change it with @code{\setlength}.
@end ftable
-The following commands can be used inside a @code{tabular}
-environment:
+The following commands can be used inside the body of a @code{tabular}
+environment, the first two inside an entry and the second two between
+lines:
@menu
* \multicolumn:: Make an item spanning several columns.
+* \vline:: Draw a vertical line.
* \cline:: Draw a horizontal line spanning some columns.
* \hline:: Draw a horizontal line spanning all columns.
-* \vline:: Draw a vertical line.
@end menu
@@ -3333,24 +3396,52 @@
\multicolumn at domain.hid}@}
@end example
-The @code{\multicolumn} command makes an entry that spans several
-columns. The first mandatory argument, @var{cols}, specifies the
-number of columns to span. The second mandatory argument, @var{pos},
-specifies the formatting of the entry; @code{c} for centered, @code{l}
-for flushleft, @code{r} for flushright. The third mandatory argument,
- at domain.hid}, specifies what text to put in the entry.
-
-Here's an example showing two columns separated by an en-dash;
- at domain.hid} is used for the heading:
-
- at domain.hid
-\begin at domain.hid@}
-\multicolumn at domain.hid Unicode at domain.hid
- 0x80&0x7FF \cr
- 0x800&0xFFFF \cr
-0x10000&0x1FFFF \cr
+Make an entry that spans several columns. The first argument @var{cols}
+specifies the number of columns to span. The second argument @var{pos}
+specifies the formatting of the entry, with @code{c} for centered,
+ at code{l} for flushleft, or @code{r} for flushright. The third argument
+ at var{text} specifies the contents of that entry.
+
+The @var{pos} argument can also contain vertical bars @code{|}
+indicating the placement of vertical rules. Thus if @var{pos} is
+ at code{|c|} then a vertical rule will come at the start and end of the
+entry, which will be centered.
+
+The number of spanned columns @var{cols} can be 1. This is useful to
+override for one row the specification given in the @code{tabular}
+definition, including the placement of vertical rules.
+
+In the example below, in the @code{tabular} definition the first column
+is specified as right-justified but in the first row the entry is
+centered with @code{\multicolumn at domain.hid@}@}}. Also in
+the first row, the second and third columns are spanned by a single
+entry with @code{\multicolumn at domain.hid@}@}}. Because
+the second and third column are arranged to center on the page range
+en-dash at domain.hid} this organizes the information into a single
+unit. In addition, although the @code{tabular} specification puts a
+vertical rule between the columns, because there is no vertical bar in
+the @var{pos} of either @code{\multicolumn} command, no rule appears in
+the first row.
+
+ at example
+\begin at domain.hid@}
+ \multicolumn at domain.hid@}@}
+ &\multicolumn at domain.hid@}@} \\ \hline
+ Dawkins &31 &58 \\
+ Watts &9 &28
\end at domain.hid@}
@end example
+
+
+ at node \vline
+ at subsection @code{\vline}
+
+ at findex \vline
+
+The @code{\vline} command will draw a vertical line extending the full
+height and depth of its row. An @code{\hfill} command can be used to
+move the line to the edge of the column. It can also be used in an
+@@-expression.
@node \cline
@@ -3378,17 +3469,6 @@
enclosing @code{tabular} or @code{array} environment. It's most
commonly used to draw a line at the top, bottom, and between the rows
of a table.
-
-
- at domain.hid \vline
- at domain.hid @code{\vline}
-
- at domain.hid \vline
-
-The @code{\vline} command will draw a vertical line extending the full
-height and depth of its row. An @code{\hfill} command can be used to
-move the line to the edge of the column. It can also be used in an
- at domain.hid.
@node thebibliography
More information about the latexrefman-commits
mailing list