如何禁用/抑制长表内的坏盒警告?

如何禁用/抑制长表内的坏盒警告?

我有一个很长的(3 页)横向长表,它生成了大量坏框警告(过满\vbox\hbox消息宽度超过 30.0000pt)。但该表完全可以打印,所以我根本不关心这些消息。然而,当它们出现在表外时,我确实关心它们,所以我真的很讨厌这个表在我的日志中充斥着垃圾邮件,而我看不到我真正想要消除的坏框消息。

目前我发现的提示似乎没有任何效果。目前我的序言中有以下设置:

\hbadness=10000
\vbadness=\maxdimen
\vfuzz=30pt
\hfuzz=30pt

这只是为了测试,因为我想确保设置了正确的选项。稍后我想在表格之前设置工作设置,然后清除它。然而,这些设置在表格中不起作用。但它们不会被忽略,当我故意在表格外创建一个满的框时,警告会随着序言中的这些设置而消失……

那么我该怎么做才能消除表格中那些令人讨厌的警告呢?

以下是类似我的表格的代码。我的实际前言要长得多,所以我的实际表格看起来有点不同。在这个例子中,问题也只存在于虽然\hbox我的实际表格中也有不好的\vbox警告,但我猜这是同样的问题:

\documentclass[
   12pt,
   a4paper,
   twoside,
   headinclude,
   headsepline,
   BCOR12mm,
   DIV14,
   parskip=half,
   bibliography=totoc,
   listof=totoc,
   numbers=noenddot,
   captions=tableheading,
   appendixprefix,
   abstracton,
   pdftex
]{scrreprt}

%Testing to get rid of bad box warnings
\hbadness=\maxdimen
\vbadness=\maxdimen
\vfuzz=30pt
\hfuzz=30pt

\usepackage{pdflscape}
\usepackage{longtable, colortbl}
\usepackage{multicol, multirow}
\usepackage{tabularx}
\usepackage{array}
\usepackage{ragged2e}

\begin{document}

\begin{landscape}

% Change the footnote style to lowercase letters and ignore badness warnings
\renewcommand{\thefootnote}{\alph{footnote}}

\scriptsize
\begin{center}
\begin{longtable}{p{1.0in}p{1.0in}p{0.95in}lp{0.5in}lp{0.3in}l>{\RaggedRight\arraybackslash}p{1.0in}>{\RaggedRight\arraybackslash}p{1.0in}}
\caption[Table title]{Table title} \label{tab:market} \\

\hline \hline \\[-2ex]
  \multicolumn{1}{c}{One} & 
  \multicolumn{1}{c}{Two} &
  \multicolumn{1}{c}{Three} &
  \multicolumn{1}{c}{Four$^a$} &
  \multicolumn{1}{p{0.2in}}{Five (some words)$^b$} &
  \multicolumn{1}{c}{Six$^c$} &
  \multicolumn{1}{p{0.55in}}{Seven\-longerword} &
  \multicolumn{1}{p{0.3in}}{Eight (some words)$^d$} &
  \multicolumn{1}{c}{Nine} &
  \multicolumn{1}{c}{Ten} \\[0.5ex] \hline \\[-1.8ex]
\endfirsthead

\multicolumn{10}{c}{{\tablename} \thetable{} -- continued} \\[0.5ex]
\hline \hline \\[-2ex]
  \multicolumn{1}{c}{One} & 
  \multicolumn{1}{c}{Two} &
  \multicolumn{1}{c}{Three} &
  \multicolumn{1}{c}{Four$^a$} &
  \multicolumn{1}{p{0.2in}}{Five (some words)$^b$} &
  \multicolumn{1}{c}{Six$^c$} &
  \multicolumn{1}{p{0.55in}}{Seven\-longerword} &
  \multicolumn{1}{p{0.3in}}{Eight (some words)$^d$} &
  \multicolumn{1}{c}{Nine} &
  \multicolumn{1}{c}{Ten} \\[0.5ex] \hline \\[-1.8ex]
\endhead

\multicolumn{10}{l}{{See next page\ldots}} \\
\endfoot

\\[-1.8ex] \hline \hline
\endlastfoot


%Data starts here:

One (some words) & Two (some words) & Three (some words) & Four & Five & Six & Seven & Eight & Nine: Here comes a short text & Ten: Here comes a short text \\

One (some words) & Two (some words) & Three (some words) & Four & Five & Six & Seven & Eight & Nine: Here comes a short text & Ten: Here comes a short text \\

One (some words) & Two (some words) & Three (some words) & Four & Five & Six & Seven & Eight & Nine: Here comes a short text & Ten: Here comes a short text \\
%And a lot more data...

\end{longtable}
\end{center}

% footnote a:
\footnotetext[1]{Footnote one}
% footnote b:
\footnotetext[2]{Footnote two}
% footnote c:
\footnotetext[3]{Footnote three}
% footnote d:
\footnotetext[4]{Footnote four}

\normalsize

% Reset the footnotes and badness
\renewcommand{\thefootnote}{\arabic{footnote}}

\end{landscape}

\end{document}

答案1

即使我注释掉禁用警告的块,以下排版也不会出现任何警告

%\hbadness=\maxdimen
%\vbadness=\maxdimen
%\vfuzz=30pt
%\hfuzz=30pt

在固定列中,p{zz}没有必要使用多列{1}{p{yy}}`条目,如果 yy 小于 xx,则只会强制行缩短,如果大于 zz,则强制列变宽,导致其他每个条目中的行缩短。此外,在指定小于一英寸的列中,您需要不规则设置。

\documentclass[
   12pt,
   a4paper,
   twoside,
   headinclude,
   headsepline,
   BCOR12mm,
   DIV14,
   parskip=half,
   bibliography=totoc,
   listof=totoc,
   numbers=noenddot,
   captions=tableheading,
   appendixprefix,
   abstracton,
   pdftex
]{scrreprt}

%Testing to get rid of bad box warnings

%\hbadness=\maxdimen
%\vbadness=\maxdimen
%\vfuzz=30pt
%\hfuzz=30pt

\usepackage{pdflscape}
\usepackage{longtable, colortbl}
\usepackage{multicol, multirow}
\usepackage{tabularx}
\usepackage{array}
\usepackage{ragged2e}

\begin{document}

\begin{landscape}

% Change the footnote style to lowercase letters and ignore badness warnings
\renewcommand{\thefootnote}{\alph{footnote}}

\scriptsize
\begin{center}
X\dotfill X

\begin{longtable}{
              >{\RaggedRight\arraybackslash}p{.7in}
              >{\RaggedRight\arraybackslash}p{.7in}
              >{\RaggedRight\arraybackslash}p{.7in}
              >{\RaggedRight\arraybackslash}p{0.7in}
              >{\RaggedRight\arraybackslash}p{0.5in}
              >{\RaggedRight\arraybackslash}p{0.3in}
              >{\RaggedRight\arraybackslash}p{0.7in}
              >{\RaggedRight\arraybackslash}p{.7in}
              >{\RaggedRight\arraybackslash}p{1in}
              >{\RaggedRight\arraybackslash}p{1in}}
\caption[Table title]{Table title} \label{tab:market} \\

\hline \hline \\[-2ex]
  \multicolumn{1}{c}{One} & 
  \multicolumn{1}{c}{Two} &
  \multicolumn{1}{c}{Three} &
  \multicolumn{1}{c}{Four$^a$} &

  Five (some words)$^b$ &
  \multicolumn{1}{c}{Six$^c$} &
  \hspace*{0pt}Seven\-longer\-word &
  Eight (some words)$^d$ &
  \multicolumn{1}{c}{Nine} &
  \multicolumn{1}{c}{Ten} \\[0.5ex] \hline \\[-1.8ex]
\endfirsthead

\multicolumn{10}{c}{{\tablename} \thetable{} -- continued} \\[0.5ex]
\hline \hline \\[-2ex]
  \multicolumn{1}{c}{One} & 
  \multicolumn{1}{c}{Two} &
  \multicolumn{1}{c}{Three} &
  \multicolumn{1}{c}{Four$^a$} &
  Five (some words)$^b$ &
  \multicolumn{1}{c}{Six$^c$} &
  \hspace*{0pt}Seven\-longer\-word &
  Eight (some words)$^d$ &
  \multicolumn{1}{c}{Nine} &
  \multicolumn{1}{c}{Ten} \\[0.5ex] \hline \\[-1.8ex]
\endhead

\multicolumn{10}{l}{{See next page\ldots}} \\
\endfoot

\\[-1.8ex] \hline \hline
\endlastfoot


%Data starts here:

One (some words) & Two (some words) & Three (some words) & Four & Five & Six & Seven & Eight & Nine: Here comes a short text & Ten: Here comes a short text \\

One (some words) & Two (some words) & Three (some words) & Four & Five & Six & Seven & Eight & Nine: Here comes a short text & Ten: Here comes a short text \\

One (some words) & Two (some words) & Three (some words) & Four & Five & Six & Seven & Eight & Nine: Here comes a short text & Ten: Here comes a short text \\
%And a lot more data...

\end{longtable}
\end{center}

% footnote a:
\footnotetext[1]{Footnote one}
% footnote b:
\footnotetext[2]{Footnote two}
% footnote c:
\footnotetext[3]{Footnote three}
% footnote d:
\footnotetext[4]{Footnote four}

\normalsize

% Reset the footnotes and badness
\renewcommand{\thefootnote}{\arabic{footnote}}

\end{landscape}

\end{document}

相关内容