尽管我hfuzz=…
已隐藏(足够小的)溢出框警告,但我的参考书目中的 URL 中发生溢出框时仍会显示警告。为什么?我该如何消除警告?
为了说明这一点,在下面的例子中,正文中的过满行不会产生任何警告(这表明该警告hfuzz
是有效的),但参考书目中的(较少)过满行却会产生警告。
\begin{filecontents}{example.bib}
@techreport{report,
author = {Unknown, U. and Unknown, U.},
institution = {Institution},
title = {Some title},
url = {https://www.example.com/some-very-long-url-with-much-text/and-a-second-part-that-is-overly-long-as-well-and-fills-the-line/},
year = {2015}
}
\end{filecontents}
\documentclass{article}
\usepackage{natbib}
\usepackage{hyperref}
\bibliographystyle{abbrvnat}
\hfuzz=4cm
\begin{document}
This url \url{http://www.example.com/is-overly-long-but-raises-no-warnings/is-overly-long-but-raises-no-warnings/is-overly-long-but-raises-no-warnings}
\citep{report}.
\bibliography{example}
\end{document}
答案1
如果你添加
\show\thebibliography
你会看见
> \thebibliography=\long macro:
#1->\bibsection \parindent \z@ \bibpreamble \bibfont \list {\@biblabel {\the \c
@NAT@ctr }}{\@bibsetup {#1}\global \c@NAT@ctr \z@ }\ifNAT@openbib \renewcommand
\newblock {\par }\else \renewcommand \newblock {\hskip .11em \@plus .33em \@mi
nus .07em}\fi \sloppy \clubpenalty 4000\widowpenalty 4000 \sfcode `\.\@m \let \
NAT@bibitem@first@sw \@firstoftwo \let \citeN \cite \let \shortcite \cite \let
\citeasnoun \cite .
l.18 \show\thebibliography
所以它\sloppy
确实
\DeclareRobustCommand\sloppy{%
\tolerance 9999%
\emergencystretch 3em%
\hfuzz .5\p@
\vfuzz\hfuzz}
因此\hfuzz
在参考书目中重置为 .5pt。您可以重新定义\sloppy
以获得更大的 hfuzz 或添加
\usepackage{xurl}