# XeTeX: Vollkorn typeface causes overfull hboxes

XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/Debian)

I'm using fontspec to set the main-font to Vollkorn. The typeface is rather big, so I presumed it might be normal that latex can not optimize the hboxes?

I tried both the Debian package fonts-vollkorn and, after uninstallation, the TTFs and OTFs directly from the manufacturer. Any idea what the problem might be? Vollkorn is the only font I'm having this issue with. This also occurs several times in larger files.

\documentclass[12pt, a4paper, ngerman]{scrreprt}

\usepackage[ngerman]{babel}

\usepackage{fontspec}
\setmainfont{Vollkorn}
\setsansfont{FreeSans}
\setmonofont{FreeMono}


and:

Overfull \hbox (22.59073pt too wide) in paragraph at lines 144--154
\TU/Vollkorn(0)/m/n/12 für nicht ansteckende Krankheiten, wie Krebs, Diabetes u
nd Herz-Kreislauf-Erkrankungen.


• Herz"=Kreislauf"=Erkrankungen Making compound words using - inhibits hyphenation for everything after the first -. Therefore babel defines the "= shorthand which provides a workaround for that problem. – Henri Menke Jul 9 '19 at 23:27
• Or, you can always manually insert discretionary hyphens such as Herz-Kreis\-lauf-Er\-kran\-kun\-gen. – Ruixi Zhang Jul 10 '19 at 0:47
• Off-topic: Any chance you could update your TeX distribution to TeXLive2019? In my testing, the long composite word "Herz-Kreislauf-Erkrankungen" still sticks out into the right-hand margin, but far less so than with older versions of XeLaTeX and/or LuaLaTeX. – Mico Jul 10 '19 at 5:14
• @HenriMenke Ahm, ok, again what learned – but why do I only have this problem with Vollkorn, never with other typefaces? The problem also occurs in other, larger files without compund words, though just up to 8pt overfullness. Is the typeface just too fat? – Theo Freeman Jul 10 '19 at 9:53
• @Mico Sometime the next months I will switch to ArchLinux and hopefully get rid of using stone age packages. Though I'd be surprised if it changed that much – the algorithms used to fill the boxes are extremely old and optimized, by Knuth himself, aren't they? – Theo Freeman Jul 10 '19 at 9:57

When TeX breaks paragraph into lines, it goes through a 3-phase process (Bouckaert, 2003, A Probabilistic Line Breaking Algorithm):

• Phase 1, use only spaces as breaking points. Each line gets a “badness”, the value of which depends on how tight or loose the line is. If none of the badness exceeds a predefined limit, then the paragraphs is accepted.
• Otherwise, in Phase 2, TeX tries to hyphenate, with additional/alternative “badness” calculation attached to each line. The paragraph is accepted if none of the badness exceeds yet another predefined limit.
• Otherwise, in Phase 3, TeX adds \emergencystretch and repeat Phase 2 in the hope that extra stretchability would be good enough.

If all phases have failed, then TeX will just spit out overly long lines.

You have many options to influence the line-breaking:

1. As @HenriMenke pointed out, after the Herz-, auto-hyphenations for Kreislauf and Erkrankungen are prohibited, so you can use "= from babel in place of -. However, this will effectively suppress kernings around your hard hyphens.
2. In similar fashion, you can always manually insert hyphenation points as in Herz-Kreis\-lauf-Er\-kran\-kun\-gen. This method preserves kernings around your hard hyphens.

So far, the two methods above require manual adjustments: You go to the overfull line and change the word that sticks out, helping TeX in Phase 2. I prefer the second due to kernings (compare Audio"=Video versus Audio-Video).
3. Set a positive \emergencystretch to help TeX in Phase 3.
4. Change Vollkorn’s inter-word space. IMHO, the normal space in Vollkorn is too narrow (a deliberate choice by the font designer): It is just 15 em wide. In comparison, Times, Palatino and Baskerville all have spaces 14 em wide. Personally, I wouldn’t mind enlarging Vollkorn’s inter-word space (as well as its stretchability and shrinkability) by 10%.

\documentclass{article}
\usepackage{showframe}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\setmainfont{Vollkorn-Regular.otf}
\newfontface\VollkornLargerSpace{Vollkorn-Regular.otf}[
WordSpace=1.1
]

\setlength\parindent{0pt}% for illustration
\setlength\parskip{6pt}  % for illustration

\begin{document}
Unfortunate line breaks:\\
für nicht ansteckende Krankheiten, wie Krebs, Diabetes und
Herz-Kreislauf-Erkrankungen.

Method~1:\\
für nicht ansteckende Krankheiten, wie Krebs, Diabetes und
Herz"=Kreislauf"=Erkrankungen.\hfill
\hbox{An eagle eye will notice that kernings in -K' and -E' are lost!}

Method~2:\\
für nicht ansteckende Krankheiten, wie Krebs, Diabetes und
Herz-Kreis\-lauf-Er\-kran\-kun\-gen.

Audio"=Video' versus Audio-Video'.

\begingroup
\setlength\emergencystretch{1em}%
Method~3:\\
\dots\ sterben immer zuerst und in größerer Zahl.
Sie sind ebenso weit anfälliger
für nicht ansteckende Krankheiten, wie Krebs, Diabetes und
Herz-Kreislauf-Erkrankungen. % an empty line to finish this local paragraph

\endgroup

\begingroup
\VollkornLargerSpace % use larger inter-word spaces
Method~4:\\
\dots\ sterben immer zuerst und in größerer Zahl.
Sie sind ebenso weit anfälliger
für nicht ansteckende Krankheiten, wie Krebs, Diabetes und
Herz-Kreislauf-Erkrankungen.
\endgroup
\end{document}

• Thanks for this great answer. But: Why does the small intermediate word distance of Vollkorn affect line-breaking negatively? In my estimation it should affect it positively, as more words will fit in one line if necessary. And I can't really see any difference between the Audio-Video examples; what should you pay attention to? – Theo Freeman Jul 13 '19 at 9:25
• @TheoFreeman 1) Small word space usually implies small stretchability and shrinkability. So TeX has limited resources to work with to balance each line (remember one of the goals is to achieve even grayness across the entire paragraph). 2) As for Audio-Video, pay attention to the -V combination: The lower half of V is hollow. If not kerned (as in Audio"=Video), then there is excessive space (it creates a “hole” in the word). If kerned (as in Audio-Video), then the hyphen and the V are moved closer to each other and the word looks more even. Search “kerning” to learn more. – Ruixi Zhang Jul 13 '19 at 14:22