在 LaTeX 中创建 sidwaystable 时出错

在 LaTeX 中创建 sidwaystable 时出错

当我创建时,sidewaystable我遇到了一个持续的错误。表格始终位于顶部,这是表格位置的错误。我想将表格定位在页面中心。以下是头部的源代码。

\documentclass{book}
\usepackage[a4paper]{geometry}% just for the example
\usepackage{rotating}
\usepackage{caption}
%\usepackage{pdflscape}
%\usepackage{lipsum}
%\usepackage{caption}
%\usepackage{siunitx}
%\usepackage{etoolbox}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage[tableposition=below]{caption}
%\setlength{\rotFPbot}{0pt plus 1fil }
\setlength{\rotFPtop}{0pt plus 2fil }
%\robustify\itshape
\captionsetup{compatibility=false}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
%
% \usepackage{mathptmx}      % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
% etc.
%
% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%
\makeatletter
\makeatother
\begin{document}
\begin{sidewaystable*}
\begin{center}
%\bigskip
%\bigskip
%\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\caption{\label{TableauCapteurs}Comparison of Available Mobility Solutions based on Network Mobility for WSNs and 6LoWPAN}
\label{Tab:Comparison of Available Mobility Solutions based on Network Mobility for WSNs and 6LoWPAN}
\centering\small\renewcommand{\arraystretch}{0.5}
%\captionsetup{type=table}
%\captionabove{very wide table (sidewaystable)}
%\rowcolors{1}{tablebodycolor}{tablerowcolor}
\centering
%\begin{tabularx}{1.25\textwidth}{>{\centering\arraybackslash}XXXXXXXXXXXX}
%\begin{tabularx}{1.25\textwidth}{| >{\centering\arraybackslash}C{1.5cm}|| *{11}{X|}}
\begin{tabularx}{1.25\textwidth}{|C{2.5cm}|| C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|}
\hline
%\rowcolor{tableheadcolor}
%head & head & head & head & head & head \\
%\hline
& \bf test1 & \bf test12 & \bf test3  & \bf test1 &  \bf test1 & \bf test1  & \bf Wang e & \bf test1   & \bf test1  & \bf test1 \\\hline\hline

答案1

您的代码中存在多个错误。首先,您调用了许多不必要的包,而这些问题并不需要这些包。下次请删除所有此类包。其次,您调用了多个包两次。请不要这样做。如果您从模板中复制内容,请仅使用您熟悉的包,并确保不要调用包两次或更多次。第三,这些包 \bf已经过时多年了。请使用\textbf{test1}bfseries代替。

现在你的问题是:

我添加了可视化打字区域showframe的选项。geometry

如果您使用,sidewaystable则应记住,然后textwidthtexthight会更改它们的值(当然,因为现在较高的值必须是表格的文本宽度)。您1.25\textwidth现在使用的太长了。这就是您的表格无法适合页面的原因。如果您改用,\textwidth您将在此处获得正确的值(请参阅我的代码和结果)。为了使用表格,我对其进行了简化。

妇女权利委员会:

\documentclass{book}

\usepackage[a4paper,showframe]{geometry}% just for the example
\usepackage{rotating}

\usepackage{tabularx}
\usepackage[tableposition=below]{caption}
\captionsetup{compatibility=false}

%\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}
\begin{sidewaystable*}
\centering\small\renewcommand{\arraystretch}{0.5}
\caption{Comparison of Available Mobility Solutions based on Network Mobility for WSNs and 6LoWPAN}
\label{tab:Comparison}
\begin{tabularx}{\textwidth}{*{11}c} % 1.25\textwidth 12cm
\hline
& \textbf{test1} & test2 &  test3  &  test4 & test5 & test6 & Wang e & test8 & test9  & test10 \\\hline\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
\end{tabularx}
\end{sidewaystable*}
\end{document}

给出:

在此处输入图片描述

答案2

      \documentclass{book}
      \usepackage[a4paper]{geometry}% just for the example
      \usepackage{rotating}
      \usepackage{caption}
      \usepackage{tabularx}
      \usepackage[tableposition=below]{caption}
      \setlength{\rotFPtop}{0pt plus 2fil }
      \captionsetup{compatibility=false}
      \newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
      \makeatletter
      \makeatother

      \begin{document}
      \begin{sidewaystable*}
      \caption{Comparison of Available Mobility Solutions based on   Network Mobility for WSNs and 6LoWPAN}
      \label{Tab:Comparison of Available Mobility Solutions based on Network Mobility for WSNs and 6LoWPAN}
      \small
      \renewcommand{\arraystretch}{0.5}
      \centering
      \begin{tabularx}{\textwidth}{|C{2.5cm}|C{1.5cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|C{1.75cm}|}
      \hline
      \bf test1 & \bf test12 & \bf test3  & \bf test1 &  \bf test1 & \bf test1  & \bf Wang e & \bf ab & \bf jk & \bf kl & \bf jh \\
      \hline
      \end{tabularx}
      \end{sidewaystable*}
      \end{document}

这是代码。编译它并查看输出。如果提交的答案符合你的目的,请勾选它。

接下来,请清晰地发布您的问题。

提前致谢。

相关内容