4

In dialogues I often need to use the form \enquote{---\,Lorem ipsum dolor}. But sometimes, when the quote begins toward the end of a line, I get an ugly rendering like this:

d sse lectus lorem sit amet et consectetur quia adipit erit et « —

Lorem ipum dolor »

This is a minimal example of this behaviour:

\documentclass{article}
\usepackage[french]{babel}
\RequirePackage[babel=true]{csquotes}
\begin{document}
d sse lectus lorem ipsum quia dolor sit amet et consectetur quia adipit     \enquote{---\,Lorem ipsum dolor}
\end{document}

As you see, i use an \, between the long dash and the following word but the line is breaked in the rending. I get the same behavior with ~.

So, how can I force the whole chain “« — Lorem” to be in the same line?

2
  • 1
    \mbox{\enquote{---\,Lorem ipsum dolor}}
    – Bobyandbob
    Commented Apr 4, 2017 at 4:30
  • 1
    An excellent MWE, by the way!
    – Mico
    Commented Apr 4, 2017 at 5:52

2 Answers 2

3

First solution

Mico's answers are good, but here's one that doesn't require any packages.

\documentclass{article}
\usepackage{csquotes}

\newcommand{\denquote}[1]{%
   \enquote{\mbox{---\,}\ignorespaces#1}}

\begin{document}

% orig. form of "paragraph"
d sse lectus lorem ipsum quia dolor sit amet et consectetur 
quia adipit \enquote{---\,Lorem ipsum dolor}

% with \denquote
d sse lectus lorem ipsum quia dolor sit amet et consectetur 
quia adipit \denquote{Lorem ipsum dolor}

\end{document}

output of example code

i threw in the \ignorespaces just in case the input isn't careful, and begins with a typed space.

Second solution

You can also create the macro \longdash you could use anywhere you need dash and not especially in \enquote command:

\documentclass{article}
\usepackage[french]{babel}
\RequirePackage[babel=true]{csquotes}

\newcommand\longdash{\mbox{---\,}\ignorespaces{}}
\begin{document}
d sse lectus lorem ipsum quia dolor sit amet et consectetur quia adipit     \enquote{---\,Lorem ipsum dolor}

d sse lectus lorem ipsum quia dolor sit amet et consectetur quia adipit     \enquote{\longdash{}Lorem ipsum dolor}
\end{document}
1
  • I modify you’re answer to add a second solution based on your own one. The second solution seems better for me.
    – fauve
    Commented Apr 5, 2017 at 1:46
5

I suggest you load the amsmath package use its \nobreakdash macro as follows:

\enquote{\nobreakdash---\,Lorem ipsum dolor}

A full MWE:

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "\nobreakdash" macro
\usepackage[french]{babel}
\RequirePackage[babel=true]{csquotes}
\begin{document}

% orig. form of "paragraph"
d sse lectus lorem ipsum quia dolor sit amet et consectetur 
quia adipit \enquote{---\,Lorem ipsum dolor}

% with \nobreakdash immed. before "---"
d sse lectus lorem ipsum quia dolor sit amet et consectetur 
quia adipit \enquote{\nobreakdash---\,Lorem ipsum dolor}

\end{document}
5
  • seems to me that the babel approach might also suppress breaks after hyphens where they would be not only unobjectionable but desirable. Commented Apr 4, 2017 at 13:43
  • 1
    in the screenshot there is an inserted hyphen at the position of \babelhyphen{nobreak}, is that intentional?
    – Marijn
    Commented Apr 4, 2017 at 14:06
  • @Marijn - Thanks for pointing out this issue -- I hadn't noticed it myself. Let me look into what's going on.
    – Mico
    Commented Apr 4, 2017 at 14:22
  • 1
    @Marijn - I rewrote the answer and dropped the \babelhyphen{break} method.
    – Mico
    Commented Apr 4, 2017 at 14:33
  • @barbarabeeton - Thanks. Based on your comment and the one by @Marijn, I decided to rewrite the answer and drop the \babelhyphen{break} method.
    – Mico
    Commented Apr 4, 2017 at 14:34

You must log in to answer this question.

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