如何減少小字體的單一段落 biblatex 參考書目中的行距

如何減少小字體的單一段落 biblatex 參考書目中的行距

我正在嘗試使用創建壓縮的單段落參考書目biblatex,例如這個答案。我還想讓字體比文件的主要字體小。我透過設定來做到這一點\bibfont;然而,這會產生看起來像雙倍間距的東西,但我只想要單倍間距。我以為

\renewcommand*{\bibfont}{\fontsize{5pt}{7pt}\selectfont}

會處理這個問題,因為\fontsize應該也設定該\baselineskip值。有誰知道為什麼我在參考書目中有這麼大的行距,以及如何將這個間距減小到看起來像正常的單行距?

\begin{filecontents*}{\jobname.bib}
@article{a1,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201--204},
  year = {1999},
}
@article{a2,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201--204},
  year = {2000},
}
@article{a3,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201--204},
  year = {2001},
}
@article{a4,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201--204},
  year = {2002},
}
@article{a5,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201--204},
  year = {2003},
}
\end{filecontents*}
\documentclass{article}

\usepackage[american]{babel}

\usepackage{csquotes}

\usepackage[backend=biber,
  style=authoryear-comp,
  maxcitenames=2,
  maxnames=1,
  minnames=1,
  firstinits=true]{biblatex}

\addbibresource{\jobname.bib}

\renewcommand*{\bibfont}{\fontsize{5pt}{7pt}\selectfont}

\defbibenvironment{bibliography}
  {}
  {}
  {\addspace}

\begin{document}

\nocite{*}
\printbibliography

\end{document}

顯示參考書目項目之間較大間距的圖像

答案1

問題是,如果水平模式未在參考書目環境中結束,則 的值\baselineskip將恢復為文件中其他位置的值。這在中討論這個答案在環境中使用較小字體時減少行距

您可以輸入命令的一部分\endgraf來結束段落(即結束水平模式並強制將材料分成行):<end code>\defbibenvironment

\defbibenvironment{bibliography}
  {}
  {\endgraf}
  {\addspace}

您必須\endgraf在此處使用而不是\par,否則您會收到錯誤(請參閱什麼時候使用 \par 比 \endgraf 更好?\par和之間差異的一些討論\endgraf)。

這是完整的 MWE:

\begin{filecontents*}{\jobname.bib}
@article{a1,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201-204},
  year = {1999},
}
@article{a2,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201-204},
  year = {2000},
}
@article{a3,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201-204},
  year = {2001},
}
@article{a4,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201-204},
  year = {2002},
}
@article{a5,
  author = {Smith, Jane},
  journal = {Nature},
  volume = {7},
  pages = {201-204},
  year = {2003},
}
\end{filecontents*}
\documentclass{article}

\usepackage[american]{babel}

\usepackage{csquotes}

\usepackage[backend=biber,
  style=authoryear-comp,
  maxcitenames=2,
  maxnames=1,
  minnames=1,
  firstinits=true]{biblatex}

\addbibresource{\jobname.bib}

\renewcommand*{\bibfont}{\fontsize{5pt}{7pt}\selectfont}

\defbibenvironment{bibliography}
  {}
  {\endgraf}
  {\addspace}

\begin{document}

\nocite{*}
\printbibliography

\end{document}

這是最終的輸出,看起來像單行間距:

在此輸入影像描述

相關內容