.sty 中的 \hbox 未滿 (badness 10000)

.sty 中的 \hbox 未滿 (badness 10000)

我研究了很多關於不完整盒子問題的建議。但我嘗試的任何方法都沒有解決問題。我為某種格式編寫了一個 .sty 文件,並在每次出現此標記時收到此警告:

\newcommand{\recordsAffected}[2]{%
\noindent This problem affects #1 record\s{#1}:

\vspace{3pt}

\setlength\parindent{0pt}{\tiny #2}
}

.tex 檔案內的程式碼如下所示,任何地方都沒有換行符,但它可以包含數百個數字:

\recordsAffected{39}{123, 456, 789, 123, 456, 789, 123, 456, 789, 123, 456, 789, 123, 456}%

我究竟做錯了什麼?

最小的例子:

\documentclass[a4paper]{scrartcl}
\sloppy         %improves justification, problem occured also without 
\usepackage{my_possibly_dumb_package}

\begin{document}

\recordsAffected{39}{a43278/008, a43942/008, a45969/008, a46754/008, a49221/008, a49581/008, a49622/008, a52060/008, a52125/008, a52127/008, a52435/008, a55814/008, a56445/008, a57540/008, a57622/008, a57624/008, a57808/008, a60025/008, a61589/008, a61966/008, a69208/008, ocm02999106/008, ocm30263703/008, a40465/008, a40629/008, ocm02573713/008, ocm27892685/008, ocm04943922/008, ocm09696410/008, ocm08401480/008, ocm19374238/008, ocm04445359/008, ocm10964101/008, ocm12302731/008, ocm06112303/008, ocm08717325/008, ocm23645394/008, ocm23400177/008, a69971/008}%

\end{document}

警告:

    Underfull \hbox (badness 4647) in paragraph at lines 7--8
[]\T1/ptm/m/n/6 a43278/008, a43942/008, a45969/008, a46754/008, a49221/008, a49
581/008, a49622/008, a52060/008, a52125/008, a52127/008, a52435/008, a55814/008
,
 []

答案1

發布的範例給出了一個錯誤,\s但我猜到了它的定義。

我用\raggedright這裡來避免盒子過滿/未滿。

\par在範圍末尾添加了一個缺失值,以便\tiny使用匹配的基線跳過,而不是正常的基線跳過。

在此輸入影像描述

\usepackage{my_possibly_dumb_package}

\begin{document}

\recordsAffected{39}{a43278/008, a43942/008, a45969/008, a46754/008, a49221/008, a49581/008, a49622/008, a52060/008, a52125/008, a52127/008, a52435/008, a55814/008, a56445/008, a57540/008, a57622/008, a57624/008, a57808/008, a60025/008, a61589/008, a61966/008, a69208/008, ocm02999106/008, ocm30263703/008, a40465/008, a40629/008, ocm02573713/008, ocm27892685/008, ocm04943922/008, ocm09696410/008, ocm08401480/008, ocm19374238/008, ocm04445359/008, ocm10964101/008, ocm12302731/008, ocm06112303/008, ocm08717325/008, ocm23645394/008, ocm23400177/008, a69971/008}%

\end{document}

\def\s#1{%
\ifnum#1>1 s\fi
}

\newcommand{\recordsAffected}[2]{%
\noindent This problem affects #1 record\s{#1}:%

\vspace{3pt}%

{\raggedright\tiny#2\par}%
}

或者,如果您想要合理的段落,並允許拉伸以應對單字間的空格,則替換

{\raggedright\tiny#2\par}%

經過

{\parindent0pt \spaceskip .3em plus\textwidth \tiny#2\par}%

在此輸入影像描述

相關內容