MWE:
\documentclass{scrreprt}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{enumitem}
\begin{document}
\begin{threeparttable}[!htbp]
\begin{tabularx}{\linewidth}
{
>{\hsize=0.5\hsize}X
>{\hsize=1\hsize}X
>{\hsize=1\hsize}X
>{\hsize=1\hsize}X
>{\hsize=1.5\hsize}X
}
\toprule
Head 1 & Head 2 & Head 3 & Head 4 & Head 5\\
\midrule
A
&
Some pretty long text that runs over several lines in this table cell
&
\begin{itemize}[leftmargin=*]
\item Some pretty long text that runs over several lines
\item Some short text
\end{itemize}
&
\begin{itemize}[leftmargin=*]
\item Some short text
\item Some short text
\end{itemize}
&
\begin{itemize}[leftmargin=*]
\item Some even longer text that runs over several lines in this itemization within the last column of the table
\item Some very long text that runs over several lines in this itemization within the last column of the table. I'm using it to fill up this cell.
\end{itemize}
\\
\bottomrule
\end{tabularx}
\end{threeparttable}
\end{document}
Why does the text in the last column not use the available width? When I adjust the width to anything larger than 1.5, the margin gets even larger, as if there is an "invisible" column next to the last one. What am I doing wrong?
X
must be equal to the number of columns of typeX
. In your table, the former is 4.5, whereas the latter is 5. E{lXXXX}
instead.threeparttable
enviroment does NOT take options à la[!htbp]
.X
columns containitemize
-type lists, one actually has to write>{\hsize=...\hsize\linewidth=\hsize}X
rather than just>{\hsize=...\hsize}X
. (This issue is mentioned in section 4.3 of the user guide of thetabularx
package.) I added the\linewidth=\hsize
directive in my code more or less automatically, without actually thinking actively about this issue. For further information, see also my recent query on just this subject.