Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
  1. How can I make an em-dash allow a linebreak on either side?

  2. Optionally, how do I preserve the hyphenation points of the word on both sides?

The following code allows for refrigerator---refrigerator to be line-broken only after the em-dash but nowhere else. (Regarding (2): The word "refrigerator" is hyphenated re-frig-er-a-tor according to US hyphenation (see for example Merriam-Webster, which is also what LaTeX does.)

\documentclass{memoir}
\usepackage{lipsum}
\usepackage[pass,showframe]{geometry}

\begin{document}

\lipsum[1]

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\noindent qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq refrigerator---refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator refrigerator

\end{document}

By the way, if someone knows of the most straightforward way to demonstrate such linebreaking behavior with code, please let me know (something with \hspace*? - I'm really looking for the best, shortest way to code such an example). You're welcome to edit my question to that effect.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You can replace --- by \foo defined by

\newcommand\foo{\linebreak[0]---\linebreak[0]}

Depending on the effect you want you may also want to add a small amount of stretchable glue.

share|improve this answer
1  
I've just tried this out; the hyphenation points of the word on the left are preserved. In order to preserve the ones on the right as well, \newcommand\foo{\linebreak[0]---\linebreak[0]\hspace{0pt}} did the trick for me. –  Lover of Structure Feb 10 '13 at 13:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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