This answer shows a nicely spaced emdash. I'm wondering if with lualatex and all its power if it's possible to automatically convert --- to the \dash command in the above link? (say with the toggles \autodashON and \autodashOFF)
- 1,474
1 Answers
You can replace --- in the input by \dash
\documentclass{article}
\DeclareRobustCommand\dash{%
\unskip\nobreak\thinspace\textemdash\allowbreak\thinspace\ignorespaces}
\directlua{
function dashes(s)
return string.gsub(s,'[-][-][-]','\string\dash ')
end}
\def\autodashON{\directlua{%
luatexbase.add_to_callback("process_input_buffer",dashes,"spaced em dash")%
}}
\def\autodashOFF{\directlua{%
luatexbase.remove_from_callback("process_input_buffer","spaced em dash")%
}}
\setlength\parskip{20pt}
\setlength\parindent{0pt}
\begin{document}
One---two three --- four five.
One---two three --- four five.
One---two three --- four five.
One---two three --- four five.
\autodashON
One---two three --- four five.
One---two three --- four five.
One---two three --- four five.
One---two three --- four five.
\autodashOFF
One---two three --- four five.
One---two three --- four five.
One---two three --- four five.
One---two three --- four five.
\end{document}
- 757,742

---possibly unlikely butx--common in C-like languages, also any --- coming from package code – David Carlisle Jan 18 '23 at 19:12