\vline
¶Draw a vertical line in a tabular
or array
environment
extending the full height and depth of an entry’s row. Can also be
used in an @-expression, although its synonym vertical
bar |
is more common. This command is rarely used in the
body of a table; typically a table’s vertical lines are specified in
tabular
’s cols argument and overridden as needed with
\multicolumn
(see tabular
).
The example below illustrates some pitfalls. In the first row’s second
entry the \hfill
moves the \vline
to the left edge of the
cell. But that is different than putting it halfway between the two
columns, so between the first and second columns there are two vertical
rules, with the one from the {c|cc}
specifier coming before the
one produced by the \vline\hfill
. In contrast, the first row’s
third entry shows the usual way to put a vertical bar between two
columns. In the second row, the ghi
is the widest entry in its
column so in the \vline\hfill
the \hfill
has no effect and
the vertical line in that entry appears immediately next to the
g
, with no whitespace.
\begin{tabular}{c|cc} x &\vline\hfill y &\multicolumn{1}{|r}{z} \\ % row 1 abc &def &\vline\hfill ghi % row 2 \end{tabular}