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?

  • 1
    \mbox{\enquote{---\,Lorem ipsum dolor}} – Bobyandbob Apr 4 '17 at 4:30
  • 1
    An excellent MWE, by the way! – Mico Apr 4 '17 at 5:52
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}
  • I modify you’re answer to add a second solution based on your own one. The second solution seems better for me. – fauve Apr 5 '17 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}
  • seems to me that the babel approach might also suppress breaks after hyphens where they would be not only unobjectionable but desirable. – barbara beeton Apr 4 '17 at 13:43
  • 1
    in the screenshot there is an inserted hyphen at the position of \babelhyphen{nobreak}, is that intentional? – Marijn Apr 4 '17 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 Apr 4 '17 at 14:22
  • 1
    @Marijn - I rewrote the answer and dropped the \babelhyphen{break} method. – Mico Apr 4 '17 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 Apr 4 '17 at 14:34

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.