![为什么我会收到欠满和过满的错误?](https://linux22.com/image/348241/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E4%BC%9A%E6%94%B6%E5%88%B0%E6%AC%A0%E6%BB%A1%E5%92%8C%E8%BF%87%E6%BB%A1%E7%9A%84%E9%94%99%E8%AF%AF%EF%BC%9F.png)
我正在尝试编译以下代码:
\documentclass{article}
\usepackage{graphicx,algpseudocode,algorithm,multirow,hyperref,subfig,cancel,natbib,epstopdf,xspace}
\begin{document}
\clubpenalty=10000
\widowpenalty = 10000
\begin{table}
%\newcommand{\tabcolwidth}[1]{\parbox[c]{3cm}{\centering #1}}
\renewcommand\multirowsetup{\centering}
\caption{caption}
\subfloat
{
\resizebox{1.0\linewidth}{!}
{
\begin{tabular}{lrrrr}
\hline
\multirow{2}{*}{A} & \multicolumn{4}{c}{B} \\
& $20 \%$ & $40 \%$ & $60 \%$ & $80 \%$ \\
\hline
Alg1 & $48.21$ & $48.64$ & $51.13$ & $52.46$ \\
Alg2 & $42.72$ & $46.31$ & $48.56$ & $51.64$ \\
\hline
\end{tabular}
}
}\\
\end{table}
\end{document}
使用 pdflatex。
我在编译过程中收到以下错误:
Overfull \hbox (6.71255pt too wide) in paragraph at lines 28--29
[][]
Underfull \hbox (badness 10000) in paragraph at lines 28--29
我无法找出这里的原因!
答案1
这overfull \hbox
是因为行尾有空格。您应该注释掉这些行尾。
这underfull \hbox
是因为\\
绝不应该用那个来伪造段落:
\documentclass{article}
\usepackage{graphicx,multirow,subfig,hyperref}% Load only used packages
% settings moved to preamble
\clubpenalty=10000
\widowpenalty = 10000
\begin{document}
\begin{table}
%\newcommand{\tabcolwidth}[1]{\parbox[c]{3cm}{\centering #1}}
\renewcommand\multirowsetup{\centering}
\caption{caption}
\subfloat{%
\resizebox{1.0\linewidth}{!}{%
\begin{tabular}{lrrrr}
\hline
\multirow{2}{*}{A} & \multicolumn{4}{c}{B} \\
& $20 \%$ & $40 \%$ & $60 \%$ & $80 \%$ \\
\hline
Alg1 & $48.21$ & $48.64$ & $51.13$ & $52.46$ \\
Alg2 & $42.72$ & $46.31$ & $48.56$ & $51.64$ \\
\hline
\end{tabular}%
}%
}
\end{table}