我在文本中有一个以长破折号结尾的行,该破折号突出到页边距。我尝试过用 \\ 截断该行;我尝试过 LuaLaTeX;我尝试过用 \sloppy{bad line ending in em dash here} 将该行括起来,用 \mbox{} 也是一样,正如这个问题所述:如何调整字体大小或字距以适应线宽?。我还尝试将长破折号改为短破折号,希望它不那么显眼。我还没有想出解决办法。只有这一行需要修复;我宁愿不应用全局修复,因为它可能会影响非常长且复杂的文本的其余部分。
这是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}
答案1
TeX 报告
Overfull \hbox (28.41684pt too wide) in paragraph at lines 23--24
你没有说你想做什么来避免这种情况,我可能会补充\-
说
\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}