fontspec 更改 biblatex 书目的缩进

fontspec 更改 biblatex 书目的缩进

梅威瑟:

测试.tex:

% !TeX program = xelatex
\documentclass[paper=A4,fontsize=12pt]{scrartcl}
\usepackage{fontspec}
\usepackage[backend=biber,style=authoryear,citestyle=authoryear]{biblatex}
\addbibresource{resources.bib}
\begin{document}    
\cite{Test.2018}
\printbibliography
\end{document}

资源.bib:

@misc{Test.2018,
    author = {{Test}},
    year = {2018},
    title = {Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.}
}

添加\usepackage{fontspec}会减少参考书目中 biblatex 条目的缩进,删除它又会增加缩进。为什么?

我在尝试拆分文章参考书目中的长 URL 后遇到了这个问题。缩进减少会改变断点。此外,尽管我相应地设置了 biburllcpenalty 和 biburlucpenalty,它还是会导致 URL 溢出一个顽固的字符。如果不使用 fontspec,就不会溢出。

答案1

也许更了解 KOMA-Script 的人可以给出更准确的答案。但是,据我所知,这种行为取决于scrartcl类的处理方式\parindent,而 biblatex 又使用它来设置参考书目悬挂缩进。

\bibhangbiblatex 使用样式 bibenvironment 的长度authoryear。它的设置biblatex.def如下:

\setlength{\bibhang}{\ifnumequal{\parindent}{0}{1em}{\parindent}}

如果由于某种原因为 0,则将设置\bibhang\parindent,但默认\bibhang为 1em \parindent,而这里的情况并非如此(即\parindent不为 0,因此\bibhang实际上接收\parindent)。

现在,如果我们使用 XeLaTeX 构建下面的文档:

\documentclass[paper=A4,fontsize=12pt]{scrartcl}

\typeout{\the\parindent}

\begin{document}

\the\parindent

\end{document}

PDF 将打印“12.0pt”,但我们会在日志中发现“20.0pt”。

这意味着,由于某种原因,\parindent在序言中是 20pt,而在文档中是 12pt。biblatex\bibhang在序言中设置,因此,在没有其他中间包的情况下,采用 20pt 的值。

现在,如果我们fontspec在文档中添加:

\documentclass[paper=A4,fontsize=12pt]{scrartcl}

\usepackage{fontspec}

\typeout{\the\parindent}

\begin{document}

\the\parindent

\end{document}

我们将在文档和日志中发现“12pt”。因此,如果biblatex在之后调用fontspec,它将立即收到 12pt 的值。

这并不意味着它fontspec本身就负责此设置。据我所知,它更有可能带来一些 KOMA 钩子,以预测原本会在“文档开头”出现的设置。例如,如果我们用fontspecKOMA 的替换 的调用\recalctypearea,我们会得到相同的结果:文档和日志中的值为 12pt。

\documentclass[paper=A4,fontsize=12pt]{scrartcl}

\recalctypearea

\typeout{\the\parindent}

\begin{document}

\the\parindent

\end{document}

这解释了为什么在scrartcl课堂上,如果你加载biblatexfontspec会得到不同的\bibhangs。但我真的无法解释为什么\parindent它在 中是这样工作的scrartcl

不过,正如您可能希望fontspec在文档中看到的那样,这个讨论更多的是出于好奇。您不会想删除它fontspec,因为纯粹是偶然(是的,更改\bibhang可能会触发 URL 中的 hbox 过满)它允许在单个 bib 条目中进行更好的换行。因此,您必须寻找其他形式来中断条目的 url(此站点上有几个关于此主题的答案)。

相关内容