This code produces a table with three centered column:
\begin{table}[htbp]
\centering
\begin{tabularx}{\textwidth}{| c | c | c |}
\hline
Alpha & Beta & Gamma \\ \hline
0 & 2 & 4 \\ \hline
1 & 3 & 5 \\ \hline
\end{tabularx}
\end{table}
This code produces a full-width table with columns of equal width:
\begin{table}[htbp]
\centering
\begin{tabularx}{\textwidth}{| X | X | X |}
\hline
Alpha & Beta & Gamma \\ \hline
0 & 2 & 4 \\ \hline
1 & 3 & 5 \\ \hline
\end{tabularx}
\end{table}
I can't get how to produce full-width table, with centered header (~ first row) and columns of width |50%|25%|25%|
respectively?
Would be nice if I could define these styles somewhere at the beginning of the document, so that all further tables will be able to use it.
Best Answer
The code below defines two new
columntypes
:b
for 'big' ands
for 'small'I followed the details of section 4.3 of the
documentation
to create these.If you'd like to center the heading, then you can use something like the following, which defines a
\heading
command to center its argument