[Tex/LaTex] acronym does not hyphenate in text

acronymshyphenation

I am using the latest version of acronym (acronym 2010/09/08 v1.36) with Lualatex (Version beta-0.70.2-2012060719) and have a long acronym consisting of six words which is not hyphenated correctly. The package showhyphens shows that the first of the words in the text has no hyphenation options although it is hyphenated correctly in the list of abbreviations.

LaTeX-Community.org: acronym package and hyphenation shows a solution and
GoLaTeX: hyphenation mit Package acronym (German)
another but, unfortunately, both of them do not work for me.

Is there any other solution or has anyone encountered (and solved) a similar problem?

Edit: I have prepared a MWE. It is, however, a rather elusive bug. I have therefore stripped down the text to a point where I could not remove any more packages/text because the overfull hbox would not show. I hope it helps clarifying my problem, though.

\documentclass[DIV=calc,fontsize=12pt,titlepage=false]{scrartcl}

\usepackage{showhyphens}
\usepackage{fontspec}
\usepackage{microtype}
\newfontfeature{Microtype}{protrusion=default;expansion=false}
\setmainfont[Microtype]{Linux Libertine O}
\usepackage[ngerman,british]{babel}

\usepackage[smaller,printonlyused,withpage]{acronym}
\usepackage{bookmark}
\usepackage{booktabs}

\begin{document}
\hyphenation{Mi-ni-a-tur-netz-wer-ke}
Invertebrate neurons are larger than their vertebrate counterparts, which makes it easier to handle them.
This text is part of an interdisciplinary project: \ac{MIMU}.
\section*{List of abbreviations}
\begin{acronym}[MIMU]
\acro{MIMU}{Miniaturnetzwerke aus Insektenneuronen in multilateralen Umgebungen}
\end{acronym}
\end{document}

The MWE gives me the following output for text and abbreviation list:

  • 1: Overfull hbox in the text
  • 2: The very same word (Miniaturnetzwerke) is correctly hyphenated
    enter image description here
    enter image description here

Best Answer

It seems that the acronym package is putting stuff in front of the first mention of an acronym (some code writing to file to make a label; I didn't analyse it further) which in effect inhibits hyphenation of the first word of the acronym text.

The following change of the preamble will patch the faulty command so that hyphenation is re-established. Sorry for the strange patching pattern, but \patchcmd seems to always replace only the first occurrence (but there are two for \AC@acl).

\usepackage{etoolbox}

\makeatletter
\patchcmd\@acf{\AC@acl}{\AC@foo}{}{}
\patchcmd\@acf{\AC@acl}{\AC@foo}{}{}
\patchcmd\@acf{\AC@foo}{\hskip\z@\AC@acl}{}{}
\patchcmd\@acf{\AC@foo}{\hskip\z@\AC@acl}{}{}
\makeatother

\begin{document}

example output

Please also consider egregs advice: You'll get better hyphenation of german text if you properly mark it as german.

Related Question