[GUFSC] Tabela Latex
Altamir Dias
altamir em emc.ufsc.br
Quarta Novembro 17 12:41:43 BRST 2004
Da uma olhada neste site:
http://www.astro.ku.dk/help/LaTeX/ltx-67.html
Abaixo tem uma descrição da ferramenta tabular para construção de
tabelas, com alguns exemplos no final
tabular
\begin{tabular}[pos]{cols}
column 1 entry & column 2 entry ... & column n entry \\
...
...
\end{tabular}
or
\begin{tabular*}{width}[pos]{cols}
column 1 entry & column 2 entry ... & column n entry \\
...
...
\end{tabular*}
Note that the *-form takes an additional width mandatory argument which
specifies the width of the tabular environment; in the regular form the
width is determined by LaTeX from the contents of the tabular environment.
These environments produce a box consisting of a sequence of rows of
items, aligned vertically in columns. The mandatory and optional
arguments consist of:
* cols Specifies the column formatting. It consists of a sequence
of the following specifiers, at least one for each of the columns.
o l - A column of left-aligned items.
o r - A column of right-aligned items.
o c - A column of centered items.
o p{wd} - Produces a column which can be multiple lines, with
each item typeset in a parbox of width wd. It works as if each item were
the argument of a \parbox[t]{wd} command. However, a \\ may not appear
in the item, except in the following situations: (i) inside an
environment like minipage, array, or tabular, (ii) inside an explicit
\parbox, or (iii) in the scope of a \centering, \raggedleft, or
\raggedright declaration. The latter declarations must appear inside
braces or an environment when used in a p-column element.
o | - A vertical line the full height and depth of the
environment.
o @{text} - This inserts text in every row. An @-expression
suppresses the intercolumn space normally inserted between columns; any
desired space between the inserted text and the adjacent items must be
included in text. To force the spacing between two columns to be wdth,
use an @{\hspace{wdth}} between the column specifiers. An
\extracolsep{wd} command in an @-expression causes an extra space of
width wd to appear to the left of all subsequent columns, until
countermanded by another \extracolsep command. Unlike ordinary
intercolumn space, this extra space is not suppressed by an
@-expression. An \extracolsep command can be used only in an
@-expression in the cols argument.
o *{num}{cols} - Equivalent to num copies of cols, where num
is any positive integer and cols is any list of column-specifiers, which
may contain another *-expression.
* pos Specifies the vertical position of the whole tabular
environment (recall that it is a box). The default is to align the box
on the center of the environment.
o t - align on top row
o b - align on bottom row
* width Specifies the width of the tabular* environment. There must
be rubber space between columns that can stretch to fill out the
specified width.
Note that \\ must be used to specify the end of each line of the table,
except the last. (It must be used after the last line if an \hline
command is used to put a line at the bottom of the table.)
Aligning on decimal points: an example of the @ specifier
In scientific tables it is often desirable to align the columns on a
decimal point. This can be done using the @ col specifier and breaking
the number into the integral part in a right-justified column and the
fractional part in a left-justified column:
The following input: will display as:
\begin{tabular}{r@{.}l}
3&14159\\ 3.14159
16&2\\ 16.2
123$456\\ \end{tabular} 123.456
Note that the decimal point is replaced by the column separator, & and
that the @suppresses the intercolumn space
Another example: centering and controlling table width
LaTeX normally sets the width of the tabular environment to "natural"
width, i.e., determined from the contents of the columns. For narrow
tables it is sometimes more pleasing to make them wider. The tabular*
environments allows for setting a width; however, it is necessary to
have rubber space between colunmns that can expand to the specified
width. This can often be most easily accomplished by using an
\extracolsep{wdth} command in an @ specifier as shown in the example
below which sets the table width to 75% of the text width.
This example also centers the table.
\begin{center} % put inside center environment
\begin{tabular*}{0.75\textwidth}%
{@{\extracolsep{\fill}}cccr}
label 1 & label 2 & label 3 & label 4 \\
\hline % put a line under headers
item 1 & item 2 & item 3 & item 4 \\
...
\end{tabular*}
\end{center}
See also
* \cline
* \hline
* \multicolumn
* \vline Ricardo Levi Donada wrote:
>>Pessoal,
>>
>>preciso fazer uma tabela no Latex; em cada célula da tabela, preciso
>>escrever
>>duas ou tres linhas.
>
>
> Vc quer escrever palavras ou números?!
>
>
>
>
--
_/_/_/_/ _/_/_/_/_/ _/_/_/_/_/ Prof. Altamir Dias, Dr. Eng.
_/ _/ _/ _/ _/ Departamento de Eng. Mecânica
_/_/_/ _/ _/ _/ _/ UFSC Universidade Federal de SC
_/ _/ _/ _/ _/ 88.040-900 - Florianópolis-SC
_/_/_/_/ _/ _/ _/ _/_/_/_/_/ BRASIL
Phone: 55-48-331-9264
Fax : 55-48-234-1519
http://www.emc.ufsc.br/professores/altamir/
Mais detalhes sobre a lista de discussão GUFSC