我有一个表格,标记表格是否移动到下一页。但由于某种原因,表格的标题向右移动。原因是什么?下面的代码和截图。
提前致谢。
\setlength\tabcolsep{4pt}
\begin{longtable}{p{2.5cm}p{10cm}}
\label{tab:Table caption positioning}
\caption{Table caption shifted from center by unknown reason}\\
\endfirsthead
\multicolumn{2}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\endhead
\hline \multicolumn{2}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
\hline
\textbf{Cell11} & Cell12\\
\textbf{Cell21} & Cell22\\
\textbf{Cell31} & Cell32\\
\textbf{Cell41} & Cell42\\
\textbf{Cell51} & Cell52\\
\textbf{Cell61} & Cell62\\
\textbf{Cell71} & Cell72\\
\textbf{Cell81} & Cell82\\
\textbf{Cell91} & Cell92\\
\textbf{Cell101} & Cell102\\
\textbf{Cell111} & Cell112\\
\textbf{Cell121} & Cell122\\
\textbf{Cell131} & Cell132\\
\textbf{Cell141} & Cell142\\
\hline
\end{longtable}
答案1
我使用 Overleaf 编译了您的 longtable,编译得很好。我假设您使用的 caption 包(或 KOMA 脚本)没有正确的选项。(我将标签移到了标题内,以消除错误消息并确保引用正确)
以下是 MWE:
\documentclass{article}
\usepackage{longtable, lmodern}
\setlength\tabcolsep{4pt}
\begin{document}
\begin{longtable}{p{2.5cm}p{10cm}}
\caption{Table caption shifted from center by unknown reason\label{tab:Table caption positioning}}\\
\endfirsthead
\multicolumn{2}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\endhead
\hline \multicolumn{2}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
\hline
\textbf{Cell11} & Cell12\\
\textbf{Cell21} & Cell22\\
\textbf{Cell31} & Cell32\\
\textbf{Cell41} & Cell42\\
\textbf{Cell51} & Cell52\\
\textbf{Cell61} & Cell62\\
\textbf{Cell71} & Cell72\\
\textbf{Cell81} & Cell82\\
\textbf{Cell91} & Cell92\\
\textbf{Cell101} & Cell102\\
\textbf{Cell111} & Cell112\\
\textbf{Cell121} & Cell122\\
\textbf{Cell131} & Cell132\\
\textbf{Cell141} & Cell142\\
\textbf{Cell11} & Cell12\\
\textbf{Cell21} & Cell22\\
\textbf{Cell31} & Cell32\\
\textbf{Cell41} & Cell42\\
\textbf{Cell51} & Cell52\\
\textbf{Cell61} & Cell62\\
\textbf{Cell71} & Cell72\\
\textbf{Cell81} & Cell82\\
\textbf{Cell91} & Cell92\\
\textbf{Cell101} & Cell102\\
\textbf{Cell111} & Cell112\\
\textbf{Cell121} & Cell122\\
\textbf{Cell131} & Cell132\\
\textbf{Cell141} & Cell142\\\textbf{Cell11} & Cell12\\
\textbf{Cell21} & Cell22\\
\textbf{Cell31} & Cell32\\
\textbf{Cell41} & Cell42\\
\textbf{Cell51} & Cell52\\
\textbf{Cell61} & Cell62\\
\textbf{Cell71} & Cell72\\
\textbf{Cell81} & Cell82\\
\textbf{Cell91} & Cell92\\
\textbf{Cell101} & Cell102\\
\textbf{Cell111} & Cell112\\
\textbf{Cell121} & Cell122\\
\textbf{Cell131} & Cell132\\
\textbf{Cell141} & Cell142\\\textbf{Cell11} & Cell12\\
\textbf{Cell21} & Cell22\\
\textbf{Cell31} & Cell32\\
\textbf{Cell41} & Cell42\\
\textbf{Cell51} & Cell52\\
\textbf{Cell61} & Cell62\\
\textbf{Cell71} & Cell72\\
\textbf{Cell81} & Cell82\\
\textbf{Cell91} & Cell92\\
\textbf{Cell101} & Cell102\\
\textbf{Cell111} & Cell112\\
\textbf{Cell121} & Cell122\\
\textbf{Cell131} & Cell132\\
\textbf{Cell141} & Cell142\\\textbf{Cell11} & Cell12\\
\textbf{Cell21} & Cell22\\
\textbf{Cell31} & Cell32\\
\textbf{Cell41} & Cell42\\
\textbf{Cell51} & Cell52\\
\textbf{Cell61} & Cell62\\
\textbf{Cell71} & Cell72\\
\textbf{Cell81} & Cell82\\
\textbf{Cell91} & Cell92\\
\textbf{Cell101} & Cell102\\
\textbf{Cell111} & Cell112\\
\textbf{Cell121} & Cell122\\
\textbf{Cell131} & Cell132\\
\textbf{Cell141} & Cell142\\
\hline
\end{longtable}
\end{document}
输出如下: