3

Using the cleveref package for reference ranges, I'd like to change the standard \crefrangeconjunction from _to~ to _-_, where the underscores represent spaces. Issuing

\newcommand{\crefrangeconjunction}{~-~}

I find the spaces are much too large. Defining instead

\newcommand{\crefrangeconjunction}{\,-\,}

is more compact and looks much better in my eyes but has the disadvantage of breaking at line ends.

Is there an unbreakable space smaller than ~?

  • 2
    Related/duplicate: Thin unbreakable space. – Alan Munn May 31 '17 at 12:25
  • 1
    btw: most typographical guidelines would use n-dashes, not hyphens, for this purpose and would not have spaces (let alone full spaces like ~) around the dash. – Florian May 31 '17 at 12:33
  • Related/duplicate: How to typeset a “small” non-breaking space – clemens May 31 '17 at 12:41
  • @Florian I'm aware of that. In fact, the cleveref documentation itself says "it is perfectly reasonable to define it [\crefrangeconjunction] to be an endash “--”". Call me crazy, but I really can't stand the look of it, though, so I'll stick with a hyphen for now. :) – Casimir May 31 '17 at 13:00
5

It's - that's causing the break, not \,.

\documentclass{article}

\newcommand{\unbreakablethinspace}{\leavevmode\,}

\begin{document}

\parbox{0pt}{
  a\unbreakablethinspace-\unbreakablethinspace b

  a\unbreakablethinspace\mbox{-}\unbreakablethinspace b
}

\end{document}

Hiding - in a box disallows the possibility of breaking at it.

I defined \unbreakablethinspace because \, might give surprises if used at the beginning of a paragraph. You can simply use \, if you're sure it will always go after a word.

enter image description here

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.