TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how to enforce correct hyphenation of (near-)uniform as (near-) uniform instead of (near- )uniform?

share|improve this question
Related: tex.stackexchange.com/questions/27198/… – lockstep May 30 '12 at 8:54
up vote 10 down vote accepted

You can use \discretionary. It takes three arguments:

\discretionary{at line end}{at next line begin}{if not hyphened}

In you case all arguments must be empty. I suggest define a new command for that, like this.



(near-)\myhyph uniform


The {minipage} is only used to get a narrow line in this example.



You can also define a non breakable hyphen:

(near\nbhyph)\myhyph uniform

I’m sure on can use active characters to make the macros shorter.

Note that babel with (n)german defines several short hands for hyphenations. See the manual on page 81.

You may warp this in new macros to get a short access:

[Update: As egreg said it’s maybe easier to define \newcommand{\sh}[1]{(#1\mbox{-})\discretionary{}{}{}}. I changed it]


\newcommand{\sh}[1]{% s = special, h = hyphen ...


share|improve this answer
is there also a way to tell LaTeX to get this right automatically, i.e. without changing the text near "(near-)uniform"? – Walter May 30 '12 at 9:02
You should not call it a 'dash': "You can also define a non breakable dash:" since its a hyphen. – yo' May 30 '12 at 9:03
@Walter: I added a solution with command, but I guess you can’t tell TeX to do this automatically … – Tobi May 30 '12 at 9:06
@tohecz: But how should I call it. A “non break hyphen” seems contradictory to me, since a hyphen always appears at line breaks. – Tobi May 30 '12 at 9:09
@Walter: You can disable the breaks after the hyphen. See my answer here: tex.stackexchange.com/questions/13296/…. But you will still have to insert a breakpoint before "uniform". – Ulrike Fischer May 30 '12 at 9:13

You could use the german shorthands:


share|improve this answer
I'd rather suggest (near"~)""uni"-form. "~ to prevent hyphenation immediately after the dash, and "- to allow hyphenation for the rest of word. – lockstep May 30 '12 at 8:52
Is there a way without using additional packages? – Walter May 30 '12 at 8:57
@lockstep The "- in uniform is not necessary. But I add the "~. – Ulrike Fischer May 30 '12 at 9:02
@Walter: Using babel (for hyphenation) is a good idea anyway. Also: if you don't like to load packages, don't use LaTeX. It is part of the LaTeX philosophy to have a rather small core and to activate additional features through packages. And at last: naturally you could define such shorthands yourself by copying the babel definitions. – Ulrike Fischer May 30 '12 at 9:06
Adding \declare@shorthand{ngerman}{")}{\mbox{-})\hskip\z@skip} allows for (near")uniform, which might be more appealing. – egreg May 30 '12 at 9:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.