![latex sidewaystable 没有对齐](https://linux22.com/image/352761/latex%20sidewaystable%20%E6%B2%A1%E6%9C%89%E5%AF%B9%E9%BD%90.png)
我尝试在我的文档中添加一个表格,因此我使用了以下代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage[figuresright]{rotating}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Caption}
\label{Label}
\begin{tabular}{|p{1.5cm}|p{2.35cm}|p{3.12cm}|p{3.12cm}|p{3.12cm}|p{3.12cm}|}
\hline
\multicolumn{2}{|c|}{}& \multicolumn{4}{|c|}{XXXXXX XXXXXXX}\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX}& XXXXXX XXXXXXX BXXXXXXX XXXXXX& XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX\\
\hline
\multirow{3}{1.5cm}{XXXX}& XXXXXX XXXXXXX & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & XXXXXX XXXXXXX \\
\cline{2-6}
&XXXXXX XXXXXXX & XXXXXX XXXXX XXXXXXXX XXXXXXX & XXXXXX XXXXXXX& \makebox[\linewidth][c]{-} & XXXXXX XXXXXXX XXXXXX XXXXXXX\\
\cline{2-6}
&XXXXXX XXXXXXX &XXXXXX XXXXXXX & XXXXXX XXXXXXX &\makebox[\linewidth][c]{-} &\makebox[\linewidth][c]{-}\\
\cline{2-6}
&XXXXXX XXXXXXX & XXXXXX XXXXXXX & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} &\makebox[\linewidth][c]{-} \\
\cline{2-6}
&XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & \makebox[\linewidth][c]{-}\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX &\makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-}\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & XXXXXX XXXXXXX\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX& \makebox[\linewidth][c]{-}\\
\hline
\end{tabular}
\end{sidewaystable}
\end{document}
答案1
这个问题是由于
\setlength\@fptop{0\p@}
\setlength\@fpsep{12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\@fpbot{0\p@ \@plus 1fil}
在svjour3.cls
。
加载时,rotating
\rotFPtop
会自动设置为 ,\@fptop
并将\rotFPbot
设置为\@fpbot
。因此,旋转后的表格会向右(顶部)移动。
如果您明确设置,则可以更改此设置\rotFPtop
: 到0pt plus 1fil
或 到\rotFPbot
。
\documentclass{article}
%%% the following 5 lines only for simualating the issue
\makeatletter
\setlength\@fptop{0\p@}
\setlength\@fpsep{12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\@fpbot{0\p@ \@plus 1fil}
\makeatother
%%%
\usepackage{graphicx}
\usepackage{multirow}
\usepackage[figuresright]{rotating}
\setlength{\rotFPtop}{0pt plus 1fil}% <- add this line after loading rotating
\setlength{\rotFPbot}{0pt plus 1fil}% <- maybe its better to add this line too
\begin{document}
\begin{sidewaystable}
\centering
\caption{Caption}
\label{Label}
\begin{tabular}{|p{1.5cm}|p{2.35cm}|p{3.12cm}|p{3.12cm}|p{3.12cm}|p{3.12cm}|}
\hline
\multicolumn{2}{|c|}{}& \multicolumn{4}{|c|}{XXXXXX XXXXXXX}\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX}& XXXXXX XXXXXXX BXXXXXXX XXXXXX& XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX\\
\hline
\multirow{3}{1.5cm}{XXXX}& XXXXXX XXXXXXX & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & XXXXXX XXXXXXX \\
\cline{2-6}
&XXXXXX XXXXXXX & XXXXXX XXXXX XXXXXXXX XXXXXXX & XXXXXX XXXXXXX& \makebox[\linewidth][c]{-} & XXXXXX XXXXXXX XXXXXX XXXXXXX\\
\cline{2-6}
&XXXXXX XXXXXXX &XXXXXX XXXXXXX & XXXXXX XXXXXXX &\makebox[\linewidth][c]{-} &\makebox[\linewidth][c]{-}\\
\cline{2-6}
&XXXXXX XXXXXXX & XXXXXX XXXXXXX & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} &\makebox[\linewidth][c]{-} \\
\cline{2-6}
&XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & \makebox[\linewidth][c]{-}\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX &\makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-}\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & \makebox[\linewidth][c]{-} & XXXXXX XXXXXXX\\
\hline
\multicolumn{2}{|c|}{XXXXXX XXXXXXX} & XXXXXX XXXXXXX & XXXXXX XXXXXXX & XXXXXX XXXXXXX& \makebox[\linewidth][c]{-}\\
\hline
\end{tabular}
\end{sidewaystable}
\end{document}