I am working on a complex document in LaTeX and have various types of tables. I'd like the 2nd column wider and the 3rd column rather narrow. I tried different ideas with this code chunk {c *6{>{}X}}
.
I am thinking something like this for width: 1st column 25pts, 2nd column 300pts, last column 80pts. The idea is, to define column widths right within the table environment, but not in the document preamble. I reviewed the tabularx
manual, some posts here, I'd like to see a full example of the table syntax, below what I have.
\begin{table}[!htbp]
\setlength{\tabcolsep}{6pt}
{\tabcolsep=0pt\def\arraystretch{1}
\caption{caption} \label{tab:some-table}
\begin{tabularx}{\textwidth}{c *6{>{}X}}\midrule
& \centering\hspace{-1in} some text & \centering\hspace{-0.75in} some text \tabularnewline\midrule
1 \hspace{12pt} & some very very long text and much much more text & \multirow{5}{\linewidth}{some text}\tabularnewline
2 \hspace{12pt} & some text & \tabularnewline
3 \hspace{12pt} & some text & \tabularnewline
4 \hspace{12pt} & some text & \tabularnewline
5 \hspace{12pt} & some text & \tabularnewline
\midrule
\end{tabularx}}
\end{table}
Best Answer
Here are three versions of your table. In the first one, I have used a regulat
tabular
environment with the column widths you specified in your question. However, the table is a lot larger than the textwidth (at least of a standard article class; indicated by the red lines). I therefore suggest to usetabularx
with either one or twoX
type columns. Which of them is better depends on the contents of the actual table. I have also replaced two of the\midrule
commands with\toprule
and\bottomrule
respectively. To horizontally center the column headers with respect to the corresponding columns, I have used the\thead
command from themakecell
package:Update with the
apa6
document class: I have used\multirow{6}{=}{...}
.6
is needed in order to vertically center the text since the contents of the column take up a total of 6 lines.=
ensures that the text is only as wide as the corensponding column.