5

I'm using the package acronym but I have a problem. I have a very long acronym "ADD1/SREBP1". I defined it like this:

\acro{srebp}[ADD1/\-SREBP1]{adipocyte determination-and differentiation-dependent
    factor 1/ste\-rol regulatory element binding protein 1}

But in the text it is not separated and it creates a badbox. How can I fix this problem?

I add a MWE:

\documentclass[a4paper,11pt,titlepage,twoside,openright,draft]{book}

\usepackage[italian,english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{acronym}
\usepackage{etoolbox}

\makeatletter 
\patchcmd\@acf{\hskip\z@}{}{}{}
\patchcmd\@acf{\hskip\z@}{}{}{}
\makeatother%this patch fixes white spaces after acronyms

\begin{document}

I cite the acronym first here \ac{srebp}. Then in the end of a row like this
but depends pf course on margins \ac{srebp}.

\begin{acronym}[AAAAAAA]
\acro{srebp}[ADD1\slash SREBP1]{adipocyte determination-and differentiation-dependent
    factor 1/ste\-rol regulatory element binding protein 1}

\end{acronym}

\end{document}
lockstep
  • 250,273
Stefano_g
  • 842
  • You can try ADD1\slash SREBP1 – cgnieder Aug 01 '13 at 08:58
  • I tried both
        `ADD1\slash SREBP1`
    
    

    and

        `ADD1\slash\- SREBP1`
    
    

    but they are not working...

    – Stefano_g Aug 01 '13 at 09:02
  • 1
  • added. I found this in another question: \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 but i guess it's for the long part of the acronym. My problem is with the short one. – Stefano_g Aug 01 '13 at 09:25
  • The code snippet you "found" needs the etoolbox package and will produce an error without it, as you could have found out by compiling the latest version of your MWE. – lockstep Aug 01 '13 at 09:30
  • I have it in my thesis, just I forgot to add it to the MWE posted! – Stefano_g Aug 01 '13 at 09:35
  • 1
    You should add some \- to differentiation-dependent as currently it is only allowed to hyphenate at the dash. (Maybe it would be a good idea to add ngerman's shorthands to english.) Also I think that determination-and is missing a space. – cgnieder Aug 01 '13 at 10:03
  • 1
    @cgnieder Re:shorthands: The OP might be interested in http://tex.stackexchange.com/questions/27198/babel-adding-ngerman-s-language-shorthands-to-english-as-the-main-document-lan – lockstep Aug 01 '13 at 10:10

1 Answers1

6

Redefine the internal macro \AC@acs so that it doesn't use \mbox (which prevents line breaks).

\documentclass[a4paper,11pt,titlepage,twoside,openright,draft]{book}

\usepackage[italian,english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{acronym}

\makeatletter
\renewcommand*\AC@acs[1]{%
    \expandafter\AC@get\csname fn@#1\endcsname\@firstoftwo{#1}}
\makeatother

\begin{document}

I cite the acronym first here \ac{srebp}. Then in the end of a row like
this but debpnds pf course on margins \ac{srebp}.

\begin{acronym}[AAAAAAA]
\acro{srebp}[ADD1\slash SREBP1]{adipocyte determination-and differentiation-dependent
    factor 1/ste\-rol regulatory element binding protein 1}

\end{acronym}

\end{document}

enter image description here

lockstep
  • 250,273