10

MWE:

test.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}

resources.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.}
}

Adding \usepackage{fontspec} decreases the indentation of the biblatex entries in the bibliography, removing it increases it again. Why?

I came across this problem after trying to break a long url in the bibliography of an article. The decreased indentation changes the breakpoint. Furthermore it makes the url overflow by one stubborn character even though I set biburllcpenalty and biburlucpenalty accordingly. Without using fontspec there is no overflow.

9

Probably someone who knows KOMA-Script better may be able to give a more precise answer. But, as far as I was able to understand, this behavior hangs on how scrartcl class handles \parindent which is, in turn, used by biblatex to set the bibliography hanging indent.

biblatex uses the length \bibhang on the bibenvironment of the authoryear style. And it is set in biblatex.def with:

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

Which will set \bibhang to \parindent but default \bibhang to 1em if \parindent is 0 for some reason, which is not the case here (that is \parindent is not 0, so \bibhang actually receives \parindent).

Now if we build the document below with XeLaTeX:

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

\typeout{\the\parindent}

\begin{document}

\the\parindent

\end{document}

The PDF will print "12.0pt", but we will find "20.0pt" in the log.

This means that, for some reason, \parindent is 20pt in the preamble, and 12pt in the document. biblatex sets \bibhang in the preamble, thus, in the absence of other intervening packages, takes the value of 20pt.

Now, if we add fontspec to the document:

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

\usepackage{fontspec}

\typeout{\the\parindent}

\begin{document}

\the\parindent

\end{document}

We will find "12pt" in both the document and the log. So, if biblatex is called after fontspec, it will receive now the value of 12pt.

This doesn't really mean that fontspec is responsible for this setting on it's own. As far as I grasp, it is more likely bringing some KOMA hook anticipating the setting which would otherwise come "at begin document". For example, if we substitute the call to fontspec with KOMA's \recalctypearea, we get the same result: 12pt in both the document and the log.

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

\recalctypearea

\typeout{\the\parindent}

\begin{document}

\the\parindent

\end{document}

This explains why, in scrartcl class, if you load biblatex after fontspec you get different \bibhangs. But I cannot really explain why \parindent works the way it does in scrartcl.

Still, as you probably want fontspec anyway in your document, this discussion is more of a curiosity. You woudn't want to remove fontspec just because, by sheer chance (yes, a change in \bibhang may trigger an overfull hbox in you url) it allows for a better line break in a single bib entry. So you'll have to look for some other form to break your entry's url (there are several answers in this site on this subject).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.