![横向表格不会位于页面的中心](https://linux22.com/image/296809/%E6%A8%AA%E5%90%91%E8%A1%A8%E6%A0%BC%E4%B8%8D%E4%BC%9A%E4%BD%8D%E4%BA%8E%E9%A1%B5%E9%9D%A2%E7%9A%84%E4%B8%AD%E5%BF%83.png)
我阅读了所有关于这个问题和答案,但它们只会让我更加困惑。我希望我的表格位于横向页面的中央,但它总是在左侧对齐。有没有办法让它出现在中间?我将文档序言中的包和命令包括在内,以防它们引起冲突。最小示例:
\documentclass{amsart}
\usepackage{relsize, fullpage, url, amsmath, amssymb, graphicx}
\usepackage{lscape, afterpage}
\setlength{\parindent}{0cm}
\begin{document}
Some text
\afterpage{
\begin{landscape}
\begin{table}[h] %[!h]
\centering
\begin{tabular}{l|cccccccccccccccccccccc}
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
\end{tabular}
\caption{I want this table to be in the middle of the page, above the 2. It would also be nice if there was more vertical space before this caption.}
\end{table}
\end{landscape}
}
\end{document}
答案1
\vfill
在环境中添加一对landscape
。我添加了threeparttable
,以便表格标题不会比表格宽太多,并在表格和标题之间留出更多间距:
\documentclass{amsart}
\usepackage{relsize, fullpage, url, amsmath, amssymb, graphicx, array}
\usepackage{lscape, afterpage}
\setlength{\parindent}{0cm}
\usepackage{threeparttable}
\begin{document}
Some text
\afterpage{
\begin{landscape}
\mbox{}\vfill
\begin{table}[!h]
\begin{threeparttable}
\begin{tabular}{l|*{22}{c}}
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
& 0& 1 &2& 3&4& 5& 6& 7& 8& 9& 10& 11& 12& 13& 14& 15& 16& 17& 18& 19& 20 &21\\
\end{tabular}
\vskip 2ex
\caption{I want this table to be in the middle of the page, above the 2. It would also be nice if there was more vertical space before this caption.}
\end{threeparttable}
\end{table}
\vfill
\end{landscape}
}
\end{document}