我有一张横向表格,它不能填满整个页面。它居中,但我希望它左对齐(或者如果你把书翻过来,则对齐到顶部)。有办法吗?请参阅下面的示例。
\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
\usepackage[figuresright]{rotating}
\usepackage{threeparttable}
\usepackage{longtable, booktabs, tabularx}
\begin{document}
\begin{sidewaystable}
\caption{Overview of the literature}
\label{tab2:overviewliterature}
\begin{threeparttable}
\begin{tabularx}{\textwidth}{lXlXX}
\toprule
Year & Author(s) & Method & (+) & (--) \\
\midrule
xx & xx & xx & xx \\
\addlinespace
\bottomrule
\end{tabularx}
\begin{tablenotes}[para,flushleft]
\footnotesize
\item\hspace{-2.5pt}\noindent\textit{Continued on the next page.}
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\end{document}
答案1
- 而不是
sidewaystable
查看使用pdflandscape
(或者如果您更喜欢lscape
包)和afterpage
包是否能得到所需的结果:
\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
\usepackage{pdflscape}
\usepackage{booktabs, longtable, tabularx}
\usepackage[referable]{threeparttablex}
\usepackage{afterpage}
\usepackage{lipsum} % for dummy text, not needed in real document
\begin{document}
\lipsum[1]
\afterpage{
\begin{landscape}
\begin{threeparttable}
\caption{Overview of the literature}
\label{tab2:overviewliterature}
\begin{tabularx}{\linewidth}{lXlXX}
\toprule
Year & Author(s) & Method & $(+)$ & $(-)$ \\
\midrule
xx & xx & xx & \lipsum[66] & \lipsum[11] \\
\bottomrule
\end{tabularx}
\begin{tablenotes}[para,flushleft]\footnotesize
\textit{Continued on the next page.}
\end{tablenotes}
\end{threeparttable}
\vfill\mbox{}
\end{landscape}
}
\lipsum[2-9]
\end{document}
- 不清楚,为什么使用
threeparttable
并tablenotes
注意表格在下一页继续? - 如果是这种情况,则使用
tabularx
将无法在几页上写入表格。相反,您应该使用例如xltabular
表格环境,并且threeparttable
仅在需要表格注释时才使用。
答案2
此解决方案使用\rotatebox
(adjustbox 包)来实现横向表格。它使用 minpage 覆盖文本区域。对齐由第三个可选参数处理:[t] [b] [c] 和 [s] 用于拉伸(用户提供的粘合)。
\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
%\usepackage[figuresright]{rotating}
\usepackage{threeparttable}
\usepackage{longtable, booktabs, tabularx}
\usepackage{adjustbox}
\usepackage{showframe}% MWE only
\begin{document}
\begin{table}[p]
\rotatebox{90}{\begin{minipage}[b][\textwidth][t]{\textheight}
\caption{Overview of the literature}
\label{tab2:overviewliterature}
\begin{threeparttable}
\begin{tabularx}{\textwidth}{lXlXX}
\toprule
Year & Author(s) & Method & (+) & (--) \\
\midrule
xx & xx & xx & xx \\
\addlinespace
\bottomrule
\end{tabularx}
\begin{tablenotes}[para,flushleft]
\footnotesize
\item\hspace{-2.5pt}\noindent\textit{Continued on the next page.}
\end{tablenotes}
\end{threeparttable}
\end{minipage}}
\end{table}
\end{document}