Text Formattinglocally avoid hyphenation

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
CoolnessItself
Posts: 47
Joined: Wed Nov 11, 2009 9:30 pm

locally avoid hyphenation

Post by CoolnessItself »

I'm aware of
\usepackage[none]{hyphenat}
\raggedright

but that works for a whole document. Is it possible to avoid hyphenation locally? Really all I need for my particular scenario is the itemize environment, so that text following \item isn't hyphenated.
Suggestions?

Thanks

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

locally avoid hyphenation

Post by gmedina »

Hi,

that can be problematic and will originate warnings concerning under/overfull hboxes; I would suggest a combination of \sloppy and the \nohyphens command from the hyphenat package; take a look at the following simple example (I used some non-sense text in my native language, but the idea is the same for any other language):

Code: Select all

\documentclass[a4paper]{article}
\usepackage[spanish]{babel}
\usepackage{hyphenat}

\begin{document}

% with standard Spanish hyphenation
\begin{enumerate}
  \item algunas palabras del castellano que deban trigonom\'etricamente ser separadas sil\'abicamente
\end{enumerate}

% without standard Spanish hyphenation
\begin{enumerate}
  \sloppy% to prevent underfull hboxes
  \item \nohyphens{algunas palabras del castellano que deban
    trigonom\'etricamente ser separadas sil\'abicamente}
\end{enumerate}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply