Take the 2-minute tour ×
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.

I have a quite long text, and I sometimes I have words breaking in a weird way, so I wonder if there is some command in LaTeX which will prevent the splitting of words in the whole document?

share|improve this question

migrated from stackoverflow.com Aug 2 '12 at 16:05

This question came from our site for professional and enthusiast programmers.

1  
If you're not concerned about a justified look, then may be interested in \raggedright, or \RaggedRight provided by ragged2e. –  Werner Aug 1 '12 at 19:12
    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Aug 2 '12 at 16:10
1  
although hyphenation can be suppressed completely, if your document contains a lot of long words, doing so would likely result in very ragged spacing and some overfull lines, and make it more difficult to read, as well as ugly. better to "correct" individual problems as suggested in the answer by @AndrewSwann. if certain words are consistently hyphenated incorrectly, see the tugboat hyphenation exception log for information on reporting such problems. –  barbara beeton Aug 2 '12 at 17:22

1 Answer 1

If you are writing in a language other than English, then you should use the babel package to change to the hyphenation patterns appropriate for your language. If there are still some isolated bad hyphenations then you can correct these either by inserting discretionary hyphens \- in to the words that give a problem e.g. dis\-cre\-tion\-ary or declare hyphenations for such words with the \hyphenation command, e.g. put \hyphenation{dis-cre-tion-ary} in the preamble.

If you really wish to disable hyphens, then the babel package provides the hyphenrules environment which can be called with the argument {nohyphenation}. To turn off hyphenation everywhere include the whole body of the document in such an environment. (As Barbara Beeton explains in her comment, usually one does not wish to have this effect, as the resulting output spacing is often poor.)

The document below has the first paragraph set with hypenation rules for Latin and the second set without hypehnation.

NB when experimenting with changing languages with babel, don't be too put off by errors, you often will have to run latex twice. This is caused by the way babel writes and uses some information in an auxialliary file.

\documentclass[a5paper]{article}

\usepackage[latin]{babel}
\usepackage{lipsum}

\begin{document}
\lipsum[1]

\begin{hyphenrules}{nohyphenation}
  \lipsum[1]
\end{hyphenrules}
\end{document}

Sample output

share|improve this answer

Your Answer

 
discard

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