How can I avoid hyphenation in words such as "2-D"? \hyphenation{} is not working since the dash is not a letter.
|
|
||||
|
|
|
Write it inside a box, like this: |
|||||||
|
|
To expand on Herbert's answer, here's a list of
|
|||||||||||||
|
And an example with several languages and extended shorthands
|
|||||||||||||||
|
|
With Xe(La)TeX, at least, you could also use the "non-breaking hyphen" (U+2011), given a font which contains the glyph. |
|||||||||||||||||
|
|
If your editor supports Unicode and the font used by it includes the non-breaking hyphen (this is, e.g., the case for Emacs under current Debian Linux) you can try the following: Load the
Define a macro yielding a non-breaking hyphen, e.g.:
or:
Bind the corresponding Unicode character to
Then, whenever you type the Unicode character U+2011 (using an adequate input method) you get a non-breaking hyphen, e.g.:
|
|||||
|
|
Maybe this general method help. First, define a macro who insert a non-breaking hyphen after some (math) stuff, but allowed hyphenation in the word after :
Then define the macro twoD :
the text-mode version works too :
The advantage of this method is if you want a hyphen follow by a long word, by ex. 2-cyclotetrabenzene. P.S. I apologize for my poor english |
||||
|
|
|
Using XeLaTeX, and if you can input your non-breaking hyphen (U+2011) directly, the following elegant solution is available (courtesy of the XeTeX archives, post by Roland Kuhn, 2010.11.01):
You put the above two lines in your preamble, and then in your source you simply use the non-breaking hyphen as needed. Working like a charm here (TeXShop+MacTeX 2011), with big thanks to Roland. Servus, J |
|||||||||
|
