12

If I'm not wrong, in French the em-dashes, typeset with --- in LaTeX, are usually treated like the guillemets as far as non-breaking spaces go. An "opening" em-dash must be followed by a non-breaking space, while a "closing" em-dash must be preceded by a non-breaking space.

[french]{babel} doesn't apply this rule, so I ended up making my own macros:

\newcommand{\ocadr}{\mbox{---~}}
\newcommand{\fcadr}{\mbox{~---}}

Is there a better way to ensure these non-breaking spaces?

Edit:

Here is a minimal example to justify the use of \mbox:

\documentclass{minimal}

\begin{document}

\parbox{9cm}{\textsc{
Dieu se sert des epreuves pour nous montrer nos c\oe{}urs,
 afin de pouvoir nous purifier et nous faire ensuite entrer
 dans le pays de la benediction ---~physiquement et spirituellement.
}}

\end{document}

which produces:

em bad newline

Whereas with \mbox around the ---~, I get:

em good newline

Nota:

I kept the \textsc because it's a case that I know produces this effect with the given size of the \parbox.

4
  • 2
    I suspect that 'cadratin' is a French term: looks like an em-dash to me.
    – Joseph Wright
    Commented Apr 19, 2011 at 14:27
  • I was always understood that in french typography it is space, en dash, space (i.e, em dash is not normally used).
    – yannisl
    Commented Apr 19, 2011 at 15:39
  • @Yiannis: according to Wikipedia (fr.wikipedia.org/wiki/Tiret#Tiret_long, in French), em dash has to be used, but en dash is sometimes preferred (although the source for that is missing in the article).
    – raphink
    Commented Apr 19, 2011 at 15:47
  • OK, I see where the break is coming from. I've updated my answer: I would keep only the necessary material inside a box.
    – Joseph Wright
    Commented Apr 19, 2011 at 17:14

1 Answer 1

11

I see that the \mbox is needed as the ligature inserts a \discretionary. However, I'd keep the space out of the box if I were you. So

\newcommand*{\ocadr}{\mbox{---}~}
\newcommand*{\fcadr}{\unskip~---}

using the primitives \unskip to avoid any additional space (the opening macro should skip spaces in any case) and the \mbox to prevent a break after the opening material would seem best.

4
  • I added an \mboxbecause I had a case were a newline was added right after the em in spite of the non-breaking space.
    – raphink
    Commented Apr 19, 2011 at 14:43
  • @Joseph: groups.google.com/group/comp.text.tex/browse_thread/thread/… mentions the newline issue.
    – raphink
    Commented Apr 19, 2011 at 16:40
  • @Joseph: I'm actually leaning towards \mbox{---}\, to make the non-breaking space smaller after the dash.
    – raphink
    Commented Apr 19, 2011 at 18:08
  • 1
    @Raphink: In that case, use \mbox{---}\nobreak\,\nobreak to ensure that the em-dash sticks to the following material.
    – Joseph Wright
    Commented Apr 19, 2011 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .