如何仅增加参考书目中的词间距?

如何仅增加参考书目中的词间距?

我正在编写的文档中的许多参考书目条目都产生了溢出的水平盒子。我在下面附上了一个展示这种不良行为的小示例。

我认为这个问题可以通过允许更大的单词间距来轻松解决。虽然很长的单词间距也会看起来很丑,但我愿意接受它们出现在参考书目中。然而,我不希望它们出现在文档的正文或附录中(在参考书目之后)

所以我的问题是:如何允许 LaTeX 在参考书目中使用更大的词间空间?

我希望有一个解决方案可以实现这一点,同时只需要更改文档的序言。(为了保持文档正文的整洁)

当然,我们也欢迎完全不同的解决方案,比如从参考书目中删除过长的行。

小例子:

\documentclass{article}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}

\begin{filecontents}{references.bib}
@inproceedings{bad,
  title         = {{The Protracted Example Heading for Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
@inproceedings{better,
  title         = {{The\, Protracted\, Example\, Heading\, for\, Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
\end{filecontents}

\addbibresource{references.bib}

\begin{document}
\cite{bad}
\cite{better}
\printbibliography
\end{document}

引用bad导致行过满。引用better通过人为插入更长的空格来“解决”此问题。

示例生成的 PDF

答案1

'Parametrize' ( pa-ram-e-trize) 是美国连字异常列表中的一个,TeX 无法使用默认的美国英语模式正确连字。此列表可在https://ctan.org/pkg/hyphenex并在 TUGBoat 中定期更新。

你可以加

\hyphenation{pa-ram-e-trized}

在你的序言中帮助 TeX 发展。

\documentclass{article}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}
\hyphenation{pa-ram-e-trized}

\begin{filecontents}{\jobname.bib}
@inproceedings{good,
  title     = {The Protracted Example Heading for Parametrized Bibliography Entries},
  author    = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher = {Publishing},
  series    = {Lecture Notes and Other Stuff},
  volume    = {1337},
  pages     = {290--301},
  year      = {2019}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\autocite{good}
\printbibliography
\end{document}

用连字符“参数化”很好地对齐了参考书目条目

加载babel或可能仍然是一个好主意polyglossia,但如果您用美式英语(english, american)书写,那么单独加载其中一个包将无助于连字。

书目中的换行比较棘手,并非所有问题都可以通过引入新的连字符点来解决。请参阅如何调整参考书目的断行?对改进书目换行的方法进行调查。

这个答案也给出了问题的解决方案

如何让 LaTeX 在参考书目中使用更大的词间空间?

即(第 2 点一般解决方案

\begingroup
\setlength{\emergencystretch}{.5em}
\printbibliography
\endgroup

如果你更喜欢只涉及前导码的解决方案,那么

\appto\bibfont{\setlength{\emergencystretch}{.2em}}

将紧急拉伸变化附加到参考书目字体设置中。

请注意,此处的值.2em是任意猜测的。您可能需要调整它以获得更好的结果(使其尽可能小)。

\documentclass{article}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}

\appto\bibfont{\setlength{\emergencystretch}{.2em}}

\begin{filecontents}{\jobname.bib}
@inproceedings{bad,
  title         = {{The Protracted Example Heading for Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
@inproceedings{better,
  title         = {{The\, Protracted\, Example\, Heading\, for\, Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{bad}
\cite{better}

\printbibliography
\end{document}

书目无过满框

答案2

这只是语言问题。一般来说,最好让 TeX 自己做事,而不是强制执行某些行为。在这个特殊情况下,Biblatex 无法正确使用连字符,因为它不知道您的输入是哪种语言。

\documentclass{article}
\usepackage{polyglossia}
    \setmainlanguage{english}
    \hyphenation{pa-ra-me-tri-zed}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}

\begin{filecontents}{references.bib}
@inproceedings{bad,
  title         = {{The Protracted Example Heading for Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019},
  Langid = {english}
}
@inproceedings{better,
  title         = {{The\, Protracted\, Example\, Heading\, for\, Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
\end{filecontents}

\addbibresource{references.bib}

\begin{document}
\cite{bad}
\cite{better}
\printbibliography
\end{document}

相关内容