When I have something like:


at the end of the line, LaTeX always breaks after the '-', even when I use:


I do know about solutions like using \mbox{}, but I ask for an explanation, not a way to work around, but if there's a "better" way to do this, I'm grateful for any recommondations!

I also tried \nolinebreak[4] which although should be the same.

  • 3
    Because the - is set as \hyphenchar. The \hyphenchar has two meanings in TeX: 1) it is printed when\- primitive (or automatic hyphenation) is activated at the point where line is broken and 2) if it is used in the middle of the word then \discretionary{}{}{} is added. And the second meaning is the reason of the described behaviour. No matter that the \penalty10000 follows after such character.
    – wipet
    Oct 28, 2015 at 20:21
  • Ah okay, Iso basically the \nolinebreak has no effect as it doesn't break after but at the '-'? Well learned something new! Thanks for the explanation. (Why don't you move it to the answers?^^)
    – ljrk
    Oct 28, 2015 at 20:25
  • Also (Some\mbox{-})Thing, which doesn't require any extra package.
    – egreg
    Oct 28, 2015 at 23:13

2 Answers 2


If you use babel in German, you can use "~ that produces exactly what you want:





The \parbox{0pt} is for inviting TeX to break wherever possible, but if you try you'll see that no break at all is taken.

enter image description here

What "~ does is, basically, issuing \mbox{-}.

If you don't use ngerman, but still use babel, you could import the German shorthands (see Babel: two languages, active shorthands) or, more simply, define a macro:

\newcommand{\ppref}[1]{(#1\mbox{-})} % Parenthesized PREFix

and input the text as


The reason why \nolinebreak is ineffective is that - in normal text inserts a discretionary break after it, so typing


is the same as typing


and TeX is allowed to break lines at discretionaries. The penalty that follows cannot change this. There is no \undiscretionary similar to \unskip or \unpenalty.

The \nobreakdash macro of amsmath just encloses in an \mbox the -, -- or --- that follows, so typing


is exactly the same as typing


If you use the amsmath package, you could type


A full MWE (minimum working example):

\usepackage{amsmath}  % for '\nobreakdash' macro
\usepackage[textwidth=1mm]{geometry} % set a very narrow measure
\hspace{0pt}(Some-)Thing  % this will produce a line break

\hspace{0pt}(Some\nobreakdash-)Thing % no linebreak here...
  • This is definitely a cool macro! Weird that one needs a maths package, but I have them anyway :D
    – ljrk
    Oct 28, 2015 at 20:19

You must log in to answer this question.

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