# Hyphenation with Acronyms

I have difficulties getting hyphenation right in long acronyms with user-defined hyphenation rules when trying to prevent line breaks between the long and the short form.

\documentclass{article}

\usepackage{showframe}

\hyphenation{mi-cros-co-py}

\begin{document}
\paragraph{Long Text} This is some text abcdefgh Acronym Containing Microscopy~(ACM).
\paragraph{Longer Text} This is some text abcdefgh Acronym Containing Microscopy~(ACM).
\paragraph{Even Longer Text} This is some text abcdefgh Acronym Containing Microscopy~(ACM).

\paragraph{Another try} Let's try manual hyphenation.

\paragraph{Long Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py~(ACM).
\paragraph{Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py~(ACM).
\paragraph{Even Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py~(ACM).

\paragraph{Another try} Let's also skip the non-breaking space.

\paragraph{Long Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py (ACM).
\paragraph{Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py (ACM).
\paragraph{Even Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py (ACM).

\end{document}


As can be seen from the MWP, in certain cases the typesetting ends up in overfull hboxes even without the non-breaking space and manual hyphenation. Setting \hyphenpenalty=0 in the preamble doesn't help either, same result.

What am I missing here?

Strictly speaking, I am using the glossaries package in my actual document with adjusted acronym formatting including the non-breaking space before the short form: \renewcommand{\acrfullformat}[2]{#1~(#2)} I replaced these parts with plain text for the MWP as the result is the same. Just in case anybody knows about a solution based on glossaries to solve this issue.

Assuming you don't want a break within (ACM) then adding more hyphenation points (or reducing the penalty for hyphenation) won't help. You need to allow white space to stretch to allow the line to fill up after you have broken.
\begin{document}\setlength\emergencystretch{1.5em}

• it would really be better to restrict this change to the relevant portions of the text. and if it's just particular paragraphs that are affected, wrapping just those paragraphs in \begin{sloppypar} ... \end{sloppypar} restricts the damage to only the places where it's absolutely needed. Mar 13 '14 at 13:31
• one can (and sometimes does) redefine \sloppypar to fine-tune the degree of sloppiness. Mar 13 '14 at 13:47