TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I want to put pdflatex to not put a hyphen in a word went it comes to the end of the line.

I tried to put a \- in the beginning or the end of that word but it doesn't work.

For example if I put:This is a very long sentence that needs two lines with thatshouldnot\- be hyphened I will get:

This is a very long sentence that needs two lines with thatshouldnot-
be hyphened

and if I do it this way: This is a very long sentence that needs two lines with \-thatshouldnot be hyphened I will get:

This is a very long sentence that needs two lines with -
thatshouldnot be hyphened

I want 'thatshouldnot' to stay in one word and with no hyphen in the beginning or the end of the word.

share|improve this question
2  
Do you want to suppress hyphenation of (a) all words everywhere, (b) all words of that paragraph, (c) all occurences of thatshouldnot, or (d) only this one word thatshouldnot ? – yo' Aug 17 '12 at 14:30
    
@tohecz (c) all occurences of thatshouldnot – MSIS Aug 17 '12 at 15:28
    
Is this similar to my question? tex.stackexchange.com/questions/100010/… – Jörg Apr 19 '13 at 13:01
up vote 57 down vote accepted

if this word appears more than once in your document, and you never want it to be hyphenated, you can suppress hyphenation everywhere by putting this line in the preamble:

\hyphenation{thatshouldnot}

if it only occurs once, then david's answer using \mbox suffices.

share|improve this answer
    
it does not work for an acronym like `K-PLUS' – Valerio May 17 at 13:01
    
@Valerio -- can you give an example? how is the acronym input/referenced? – barbara beeton May 17 at 13:03
    
as a simple text: "..if we consider K-PLUS then we would..." – Valerio May 17 at 13:35
    
that already contains a hyphen. the only practical way to suppress a break in that case is to box it. there is a "less practical" way, and that is to set \exhyphenpenalty=10000; since this will suppress breaks after all explicit hyphens, it has to be buried in a group along with the string on which it is supposed to act. – barbara beeton May 17 at 15:41
1  
@Valerio -- to handle this in the preamble, you will have to make a command: \newcommand{\KPLUS}{\mbox{K-PLUS}}. it would be better, usually, to deal with it in the main text: if we consider \mbox{K-PLUS} then ... – barbara beeton May 17 at 16:25

Put it in a box:

\mbox{thatshouldnot}
share|improve this answer

Your Answer

 
discard

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.