4

I am using em-dashes---for interjections---in text. Based on Why can words with hyphen char not be hyphenated? I'm using a \hyphenchar definition to let pdfTeX hyphenate words attached to em-dashes:

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
\hyphenchar\font=\string"7F
\parbox{1pt}{constrictions constrictions---constrictions constrictions}
\end{document}

The result is not satisfactory, though. Notice especially line 5: "s—-" where the "s" is lopped off and the em-dash is followed by a hyphen.

enter image description here

What I would like is a proper hyphenation of the two words attached to each em-dash, and---if necessary---to use the em-dash itself as a "hyphen" (no additional hyphen necessary if the line break occurs at the em-dash). Here I've achieved this desired result manually:

enter image description here

How can I get this behavior automatically?

2

You could define your own emdash command that allows a break as follows:

\newcommand{\emdash}{\nobreak---\nobreak\hskip0pt}

Sample output

\documentclass{article}

\usepackage[T1]{fontenc}
\newcommand{\emdash}{\nobreak---\nobreak\hskip0pt}

\begin{document}

\parbox{1pt}{constrictions constrictions\emdash constrictions constrictions}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.