caption 和 longtable 包之间的冲突引发了“过满 \hbox”警告!

caption 和 longtable 包之间的冲突引发了“过满 \hbox”警告!

问题:该行处带有 的过满\hbox (416.83289pt too wide) detected.. 警告消息。longtable\caption{}

可能的解释(恕我直言):与 ;所设定的定义caption package相冲突,而; 只不过是的框内的一个-- ,因此它永远不会影响列宽(参考 - )。如果事实证明这是真的(根据专家的说法),那么这令人惊讶,因为根据这两个软件包的文档,这两个软件包应该是兼容的。\caption{}longtable package\multicolumn{\LT@cols}{c}{<a \parbox of width \LTcapwidth , with the table's caption>}width 0ptlongtable documentation

我的解决方法(这对我来说是不可接受的)删除整\caption{}行或删除caption package相应的\captionsetup{}配置。这是不可接受的,因为在我的论文中,还有其他一些图表、表格、清单等, caption package & 这 \captionsetup{} 配置非常好!

MWE 的:1. 有caption package& 2. 没有caption package

注意:我使用过 showframe & \documentclass[draft]{<class>} 指出输出中有问题的行。

最大能量损失 1:caption package

\documentclass[11pt,a4paper,oneside,draft]{report}
\usepackage[top=1in,bottom=1.5in,left=1.5in,right=1in]{geometry}
\usepackage{showframe}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{caption} % This is throwing a "400+ pt overfull hbox error" for longtables!
\usepackage{lipsum}

% A group of packages required for tables 
\usepackage{array}
\usepackage{booktabs}
\usepackage{longtable}

\DeclareCaptionLabelSeparator{periodQuad}{. \quad}  % DIY customisation of labelsep  
\DeclareCaptionLabelFormat{tabulab}{\textbullet\quad #1 #2}
\DeclareCaptionStyle{periodQuad}[labelsep=period]{labelsep=periodQuad}

\captionsetup{%
        font={sf,up}, 
        labelfont={bf},
        singlelinecheck=true,
        justification=centerfirst,
        labelformat=tabulab,
        labelsep=periodQuad, 
        position=bottom
        }%

\providecommand{\negsci}[1]{\ensuremath{\hspace*{0.5pt}\text{\sc{e}\hspace*{0.5pt}{-}}{#1}}}

\begin{document}

\lipsum[9]
\vspace*{-2em}

{                           % Begin group --- % To keep the effect local!
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\setlength\LTpost{-14ex}

\begin{center}
\renewcommand*{\arraystretch}{1.6}
%\begin{longtable}{ccccc}
\begin{longtable}{@{\extracolsep{\fill}}ccccc@{}}
\caption[Parameter Values for the model]{Parameter Values for the model\label{tab:mod_pars}}\medskip\\
% Gives (./longtableMWE.tex Overfull \hbox (416.83289pt too wide) detected .. ERROR!  
\midrule
Equation & Parameter & Value & Units & Reference \\
\midrule
\endfirsthead
\midrule
\endhead
\addlinespace[4pt]\multicolumn{5}{r}{\textcolor{gray}{\footnotesize(\textit{Continued on next page $\ldots$})}}
\endfoot
\endlastfoot
16 & Adenine Total & 4.81 & mM & 2-6, \& 23-25 \\
31, 36 & Calcium ions & {6.0}\negsci{03}{} & mM & 56, 23, 55, 12 \\
34 & Carbon dioxide & 1.63 & mM & 9, 11, 4, 8 \\
13, 17, 3, 6 & CoA Total & 2.7 & mM & 5, 11 \\
20 & Bicarbonate & 21.2 & mM & 7, 23, 42, 63 \\
52, 16, 23 & Cytosolic Malate & 0.47 & mM & \textemdash \\
\midrule\addlinespace[5em]
\end{longtable}
\end{center}
}                           % End group --- % To keep the effect local! 

\lipsum[8]
\cleardoublepage

\end{document}

MWE 1 的输出:caption package

在此处输入图片描述

最大能量损失 2:没有caption package

\documentclass[11pt,a4paper,oneside,draft]{report}
\usepackage[top=1in,bottom=1.5in,left=1.5in,right=1in]{geometry}
\usepackage{showframe}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{amsmath}
%\usepackage{caption} % This is throwing a "400+ pt overfull hbox error" for longtables!
\usepackage{lipsum}

% A group of packages required for tables 
\usepackage{array}
\usepackage{booktabs}
\usepackage{longtable}

% For formatting the numbers in scientific format
\providecommand{\negsci}[1]{\ensuremath{\hspace*{0.5pt}\text{\sc{e}\hspace*{0.5pt}{-}}{#1}}}

\begin{document}

\lipsum[9]
\vspace*{-1em}

{                           % Begin group --- % To keep the effect local!
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\setlength\LTpost{-14ex}

\begin{center}
\renewcommand*{\arraystretch}{1.6}
%\begin{longtable}{ccccc}
\begin{longtable}{@{\extracolsep{\fill}}ccccc@{}}
\caption[Parameter Values for the model]{Parameter Values for the model\label{tab:mod_pars}}\\
% Gives (./longtableMWE.tex Overfull \hbox (416.83289pt too wide) detected .. ERROR!
\midrule
Equation & Parameter & Value & Units & Reference \\
\midrule
\endfirsthead
\midrule
\endhead
\addlinespace[4pt]\multicolumn{5}{r}{\textcolor{gray}{\footnotesize(\textit{Continued on next page $\ldots$})}}
\endfoot
\endlastfoot
16 & Adenine Total & 4.81 & mM & 2-6, \& 23-25 \\
31, 36 & Calcium ions & {6.0}\negsci{03}{} & mM & 56, 23, 55, 12 \\
34 & Carbon dioxide & 1.63 & mM & 9, 11, 4, 8 \\
13, 17, 3, 6 & CoA Total & 2.7 & mM & 5, 11 \\
20 & Bicarbonate & 21.2 & mM & 7, 23, 42, 63 \\
52, 16, 23 & Cytosolic Malate & 0.47 & mM & \textemdash \\
\midrule\addlinespace[5em]
\end{longtable}
\end{center}
}                           % End group --- % To keep the effect local! 

\lipsum[8]
\cleardoublepage

\end{document}

MWE 2 的输出:没有caption package

在此处输入图片描述

因此,在这两个输出之间,我们可以清楚地看到 出现的位置overfull \hbox error以及当caption package被删除时它是如何消失的。我希望在我的论文中longtable同时使用 和caption包,因此这种解决方法对我来说毫无用处。有人能帮我解决这个错误吗,不用删除caption package?而且,overfull \hbox错误足够大(几乎400+ pt!)不能被忽视!任何帮助/建议/指示都将不胜感激。谢谢!

答案1

事实证明,caption软件包版本不应\LTleft被设置为 0pt。

环境

\setlength\LTleft{0pt plus \textwidth}
\setlength\LTright{0pt plus \textwidth}

将标题居中而不影响表格(因为 extracolsep 中的填充胶水抵消了这种有限的拉伸)

您还应该删除center不影响对齐的环境,但只会增加虚假的垂直空间(这可能是您设置\LTpost负数的原因)

相关内容