7

I would like to globally prevent LaTeX from hyphenating 'Objective-C'. I am aware of the \hyphenation command, but I don't see how I can make use of it. If I pass 'Objective-C' to this command, the dash will be treated as a hint to hyphenate the word there.

One solution I found is wrapping Objective-C into an mbox each time I use it. However, the document I am writing contains this name a lot, and wrapping it into an mbox each time is ugly (as is defining a command and using this over and over again in the source code).

Alejandro
  • 7,290
  • 4
  • 34
  • 59
BVC
  • 138
  • 1
  • 6

3 Answers3

9

Why is defining a new command ugly? It's how \LaTeX\ defines itself.

\def\ObjectiveC{\mbox{Objective-C}}
Spacedman
  • 92,590
  • 12
  • 140
  • 224
3

Use \nobreakdash. That's what LyX produces when I insert a nonbreakingdash and convert it to tex.

user562374
  • 3,817
  • 1
  • 22
  • 19
2

As suggested here, you could define a command like this:

 \newcommand\dash{\nobreakdash-\hspace{0pt}}

and use it like this

Consider the $n$\dash dimensional manifold ... 

Also, you could use the babel package and use "~ as a protected hyphen. I'm not sure if using babel is advisable when writing in english, though.

David
  • 3,787
  • 2
  • 29
  • 43
  • Thanks for your suggestions! All of that works, but can not be defined globally, like the \mbox solution :( – BVC Jan 05 '11 at 16:03