0

I have a single line in a text that ends with an em dash that protrudes into the margin. I've tried to cut the line with \\; I've tried LuaLaTeX; I've tried enclosing the line with \sloppy{bad line ending in em dash here}, same with \mbox{} as per this question: How to adjust font size or kerning to fit line width?. I also tried changing the em dash to an en dash in the hopes it would be less noticeable. I haven't come up with a solution. Only this line needs fixing; I would rather not apply a global fix because it might affect the rest of what is a very long and complex text.

Here's the MWE:

\documentclass[fontsize=12pt,paper=5.in:8.in,DIV=12,headings=small]{scrbook} 
\usepackage[english]{babel}
\usepackage{fontspec}
\setromanfont[Mapping=tex-text]{Alegreya}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Andada SC}
\addtokomafont{disposition}{\rmfamily}

\usepackage{leading}
\leading{5mm}
\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000
\tolerance=5000 %fix hyphenation and protrusion issues
\usepackage{microtype}

\title{book}
\author{author}
\date{}

\begin{document}


Three times a week---Mondays,Wednesdays and Saturdays---at a lopsided dive on the corner of Iberville and Burgundy, Professor Dylan  Hardwick held court.

\end{document}

I believe Alegreya is a free font. It seems to have the same size as the licensed font I am using. Here's a picture of the problem:enter image description here

user26732
  • 1,785
  • 2
  • 22
  • 35
  • Looks like: \tolerance=10000{offending line} fixes it. Will this intratext command only affect the text in brackets? That is, the rest of the text will be at \tolerance=5000? – user26732 Jul 16 '17 at 18:46
  • \tolerance always affects a whole pararaph (so like \sloppy) you need {.. settings ... text here blank line } – David Carlisle Jul 16 '17 at 18:57

1 Answers1

4

TeX reports

Overfull \hbox (28.41684pt too wide) in paragraph at lines 23--24

You do not say what you want to do to avoid this, I'd probably add \- so

enter image description here

\documentclass[fontsize=12pt,paper=5.in:8.in,DIV=12,headings=small]{scrbook} 
\usepackage[english]{babel}
\usepackage{fontspec}
\setromanfont[Mapping=tex-text]{Alegreya}
%\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Andada SC}
\addtokomafont{disposition}{\rmfamily}

\usepackage{leading}
\leading{5mm}
\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000
\tolerance=5000 %fix hyphenation and protrusion issues
\usepackage{microtype}

\title{book}
\author{author}
\date{}

\begin{document}


Three times a week---Mondays,Wednesdays and Saturdays---at a lopsided dive on the corner of Iberville and Burgundy, Professor Dylan  Hardwick held court.


Three times a week---Mondays,Wednesdays and Satur\-days---at a lopsided dive on the corner of Iberville and Burgundy, Professor Dylan  Hardwick held court.

\end{document}
David Carlisle
  • 757,742
  • 1
    I left the text as you had it, but it appears to be missing a space after , and I would never use those settings for club and widow penalty. – David Carlisle Jul 16 '17 at 18:54
  • I dumped the space in an effort to ameliorate the effects of the protrusion. Didn't work. Your solution did--though it's strange that the program didn't properly hyphenate the plural 'Saturdays." I'd ask what's wrong with those settings but I might get a caution from the mods. – user26732 Jul 16 '17 at 19:30
  • @user26732 the hyphenation is suppressed because you have the dash abutting the word with no space, We have answers about widow/club I'll add a link here if I find it – David Carlisle Jul 16 '17 at 19:33
  • @user26732 https://tex.stackexchange.com/a/336669/1090 – David Carlisle Jul 16 '17 at 19:38