LuaTeX and em dashes
Update 3/2019
The bug will be resolved with the next luaotfload update
==============================================================
To expand a bit on Alan's answer:
It is imho clearly a bug in the fontloader imported from context (you see the same in context if you set \automatichyphenmode=0
). It only happens if the fonts are rendered with the mode=node
:
\documentclass{article}
\begin{document}
\font\test={file:lmroman10-regular.otf:mode=node;+tlig}
\test
A---B
\font\test={file:lmroman10-regular.otf:mode=base;+tlig}
\test
A---B
\end{document}
The source of the problem is imho that with \automatichyphenmode=0
, luatex has at first to convert the last hyphen to a discretionary to allow a linebreak:
A---B ---> A--\discretionary{-}{}{-}B
and after the line has been set this has to be converted back again to ---
, and this step seems to fail.
The problem has been reported, but it is unclear if it will be fixed.
\automatichyphenmode=1
avoids the problem by not converting the hyphen to a discretionary in a number of cases. So you should be aware of the fact that this suppress line breaking in a number of cases:
\documentclass[parskip=half-]{scrartcl}
\begin{document}
\parbox[t]{1pt}{%
\textbf{0}
\automatichyphenmode=0
A-B
A--B
A---B
-begin
A!-B}
\hspace{2cm}
\parbox[t]{1pt}{\automatichyphenmode=1
\textbf{1}
A-B
A--B
A---B
-begin
A!-B}
\end{document}
You can add \automatichyphenmode=1
to your preamble:
\documentclass{article}
\automatichyphenmode=1
\begin{document}
\begin{enumerate}
\item en--dash
\item em---dash
\item em --- dash space
\end{enumerate}
\begin{enumerate}
\item en–dash unicode
\item em—dash unicode
\item em — dash space unicode
\end{enumerate}
\begin{enumerate}
\item en\textendash{}dash macro
\item em\textemdash{}dash macro
\item em \textemdash{} dash space macro
\end{enumerate}
\end{document}