I'm using LuaLaTeX instead of XeLaTeX for my book, mainly because it supports microtype's expansion
feature, to produce the optimal word spacing and line breaking that will result in the most uniform textspace coverage while minimizing hyphenation. A problem I'm finding is that LaTeX doesn't seem to understand that an emdash without spaces (which I insert directly into the .tex document as the Unicode character — ) provides just as good a spot for ending a line as whitespace does, and it will do whatever it has to to avoid ending a line immediately before or after an emdash, even where that would be the optimal spot. I've tried replacing the Unicode with \textemdash
, but this had no effect. XeTeX doesn't have this problem. Is there any way to explain to LuaTeX what XeTeX seems to understand? To illustrate:
\documentclass[letterpaper,12pt,onecolumn,final]{memoir}
\usepackage{luatextra}
% fontspec is loaded by luatextra in LuaLaTex
\usepackage{xparse}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage[final=true]{microtype}
\usepackage[showframe]{geometry}
\setmainfont{Linux Libertine O}
\begin{document}
So, with dash and verve, he sang: “I am the very model of a modern major general
Now, adding a little more more \emph{dash} to his verve\ldots
So, with dash and verve, he sang: “I am the very model of a modern major general—
This brings the paragraph to just a hair shy of the end of the line. No font expansion has been done by
microtype, because it fits perfectly. This would then be an optimal position for a line break, were the
paragraph to continue onto the next line. Does it do that? Let’s see.
So, with dash and verve, he sang: “I am the very model of a modern major general—I’ve information
vegetable animal and mineral.”
As you can see, microtype negatively expands (in other words, compresses) the first line to avoid the
optimal break point, if only it knew!
\end{document}
fontspec
?microtype
-related options did you set?microtype
I have protrusion and expansion set.