Text Formattingno hyphentation for one word

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
koszta5
Posts: 7
Joined: Sat Jan 15, 2011 8:28 pm

no hyphentation for one word

Post by koszta5 »

Hi latex folk,

I am using hyphenation for my document but I need to turn it off for some particular words (like POSIX or openVPN). I want to use it for the rest of the document but I want POSIX or openVPN to always "stick together". How can I achieve that?

thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

no hyphentation for one word

Post by meho_r »

One way would be to put (preferably after \begin{document}) the following code:

Code: Select all

\hyphenation{posix openvpn}
This command allows you to specify custom hyphenation points and, if there are none, like in this case, it'll make sure the word isn't hyphenated at all.

Another way might be the manual one: to use \mbox{}:

Code: Select all

\mbox{POSIX}
\mbox{openVPN}
or even to create a custom command which you will use for all those words, e.g.

Code: Select all

\newcommand{\nohyph}[1]{\mbox{#1}}

\nohyph{POSIX}, \nohyph{openVPN} ...
Last edited by meho_r on Wed Feb 23, 2011 11:51 pm, edited 1 time in total.
Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

no hyphentation for one word

Post by Frits »

Put the following in your preamble:

Code: Select all

\hyphenation{openVPN}
\hyphenation{POSIX}
Also, with the hyphenat package you can specify words that will not be hyphenated once by specifying in your document.

Code: Select all

\nohyphens{openVPN}
EDIT: beaten by the clock and meho_r :roll:
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

no hyphentation for one word

Post by meho_r »

I wouldn't place \hyphenation command in the preamble, but after \begin{document}. The reason is that, in case he's using XeLaTeX and Polyglossia, \hyphenation command in the preamble can easily be missed/ignored.
koszta5
Posts: 7
Joined: Sat Jan 15, 2011 8:28 pm

Re: no hyphentation for one word

Post by koszta5 »

thank you all :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

no hyphentation for one word

Post by localghost »

koszta5 wrote:thank you all […]
Now that the problem is solved, please mark the topic (not the last post) accordingly.


Thorsten
Post Reply