latex sidewaystable 没有对齐

latex sidewaystable 没有对齐

我尝试在我的文档中添加一个表格,因此我使用了以下代码:

\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}

在此处输入图片描述

相关内容