temporarily suppress hyphenation

Hyphenation can be disabled in different ways. One is to set

\hyphenpenalty=10000
\exhyphenpenalty=10000

that assign "infinite" cost to discretionary and explicit hyphens respectively.

Another way is to choose a language with no hyphenation patterns, which is more efficient, because it spares TeX from computing demerits.

All modern TeX distributions have already such a language in their predefined set, and it's called nohyphenation. If you're using babel, then

\begin{hyphenrules}{nohyphenation}
<text>
\end{hyphenrules}

will allow line breaking only at explicit hyphens. If you want to disable also them, then setting \exhyphenpenalty=10000 is still necessary. However, one has to cope with paragraph setting, allowing larger interword spaces without too many Underfull \hbox messages, which is obtained by saying \sloppy.

A "complete" solution might be to define a nohyphens environment so that one can type

\begin{nohyphens}
Text not to be hyphenated
\end{nohyphens}

in the following way

\makeatletter
\@ifpackageloaded{babel}
  {\newenvironment{nohyphens}
     {\par\sloppy\exhyphenpenalty=\@M
      \@ifundefined{l@nohyphenation}
        {\language=\@cclv}
        {\hyphenrules{nohyphenation}}%
     }
     {\par
      \@ifundefined{l@nohyphenation}
        {}
        {\endhyphenrules}%
     }
  }
  {\newenvironment{nohyphens}
     {\par\sloppy\exhyphenpenalty=\@M
      \@ifundefined{l@nohyphenation}
        {\language=\@cclv}
        {\language=\l@nohyphenation}%
     }
     {\par}
  }
\makeatother

If babel is loaded we use its features, otherwise we simply set the current language to the "no hyphenation" one, if existent; in the worst case we set the language number to 255, which shouldn't be defined (TeX formats usually assign progressive numbers to the enabled languages and having 256 of them is highly unlikely).

Note that assigning \language=-1 is not a solution: the TeXbook says, at p. 455,

If \language is negative or greater than 255, TeX acts as if \language = 0


You can make hyphens infinitely expensive

  \hyphenpenalty=10000

or use a language without any hyphenation patterns loaded

  \newlanguage\nohy
  \language=\nohy

Then you might want to use \sloppy or \begin{sloppypar}...\end{sloppypar} so the word spacing can stretch more than usual.


it makes sense to put the text into \begin{sloppypar}...\end{sloppypar} when it is not hyphenated.

\listfiles
\documentclass[ngerman]{article}
\usepackage{libertine}
\usepackage{babel}
\usepackage{blindtext}
\textwidth=10cm
\begin{document}
\blindtext

\foreignlanguage{nohyphenation}{\begin{sloppypar}\blindtext\end{sloppypar}}

\blindtext
\end{document}

enter image description here

Tags:

Hyphenation