我正在尝试使用该sidewaystable
包制作一个旋转表格,但无法让文本换行。它可以编译,但我无法在列内换行或定义列的宽度。
代码比较乱,下面是摘录的部分:
\begin{sidewaystable}[htbp]
\centering
\caption{bla bla bla}
\begin{threeparttable}[b]
\begin{tabular}{rrr}
\toprule
Awesome intro\\
\midrule
\multicolumn{1}{l}{bla bla} & \multicolumn{1}{l}{more bla} & \multicolumn{1}{l}{final bla} \\
\bottomrule
\end{tabular}%
\begin{tablenotes}\footnotesize
\item Source: bla bla
\end{tablenotes}
\end{threeparttable}
\label{tab:xx}%
\end{sidewaystable}%
编辑:
- 如果有所不同的话,它也会放在附录中的单独页面上。
- 我正在使用
threeparttable
在表格中添加“脚注”。
答案1
使用p{...}
类型列并避免\multicolumn{1}{l}{...}
覆盖初始列类型;您仍然可以使用\multicolumn
列p{...}
类型来合并多列。举个小例子:
\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{rotating}
\usepackage{threeparttable}
\begin{document}
\begin{sidewaystable}[htbp]
\centering
\caption{bla bla bla}
\begin{threeparttable}[b]
\begin{tabular}{p{4cm}p{4cm}p{4cm}}
\toprule
Awesome intro\\
\midrule
Some test text spanning several lines & Some test text spanning several lines & Some test text spanning several lines \\
\multicolumn{2}{>{\centering}p{8cm}}{Some test text spanning several lines in a multicolumn for two columns} & Some test text spanning several lines \\
\bottomrule
\end{tabular}%
\begin{tablenotes}\footnotesize
\item Source: bla bla
\end{tablenotes}
\end{threeparttable}
\label{tab:xx}
\end{sidewaystable}
\end{document}