3

When I compile the following, once working MWE I do now get the error

! Package acro Error: The command \DeclareAcroListStyle has been removed.

Seems as if the package acro has been updated, however I couldn't find any record regarding \DeclareAcroListStyle. Does anyone know how it is done now?

\documentclass[12pt]{report}

\usepackage{acro}
\usepackage{enumitem}

\newlength\myitemwidth
\setlength\myitemwidth{5em}

\newlist{listabbrev}{description}{1}
\setlist[listabbrev]{
    labelindent = 0pt,
    labelsep    = 0pt,
    leftmargin  = \myitemwidth,
    labelwidth  = \myitemwidth,
    format      = \normalfont
    }

\DeclareAcroListStyle{styleabbrev}{list}{list = listabbrev}

\acsetup{list/template  = styleabbrev,
     list/heading   = chapter*,
     list/name      = Abkürzungen
     }

\DeclareAcronym{EEG}{
  short = EEG,
  long  = Erneuerbare-Energien-Gesetz,
}

\DeclareAcronym{dbms}{
  short = DBMS,
  long  = Database Management System,
}

\begin{document}

\printacronyms
\acuseall

\end{document}

Thanks in advance!


I would like to obtain the following result:

enter image description here

2
  • This command seems te be replaced with \NewAcroTemplate[list], see section 23.5 of the acro package manual on page 41.
    – Marijn
    Jul 2, 2020 at 11:50
  • @Marijn Thanks for the note! Unfortunately I don't find a solution to get the desired result (see image). Do you or anyone else have an idea how to get there? If I exchange \DeclareAcroListStyle{styleabbrev}{list}{list = listabbrev} with \NewAcroTemplate[list]{styleabbrev} it simply won't print anything regarding the abbreviations... clearly there is something wrong.
    – TeXlearner
    Jul 3, 2020 at 10:35

1 Answer 1

5

With version 3 of acro the way the list styles (now called templates) are defined has changed completely – this happened to make the whole process more flexible and more customisable. The drawback is that it is not compatible with the way it was done in version 2. Just renaming the command will not do as you have discovered.

Quite some part of the manual describes how templates can be defined and modified. In your case it is actually not very difficult to adapt the layout you had:

\documentclass[12pt]{report}

\usepackage{acro}
\usepackage{enumitem}

\newlength\myitemwidth
\setlength\myitemwidth{5em}

\newlist{listabbrev}{description}{1}
\setlist[listabbrev]{
    labelindent = 0pt,
    labelsep    = 0pt,
    leftmargin  = \myitemwidth,
    labelwidth  = \myitemwidth,
    format      = \normalfont
    }

\NewAcroTemplate[list]{styleabbrev}{%
  \let\description\listabbrev
  \let\enddescription\endlistabbrev
  \UseAcroTemplate[list]{description}[0]%
}

\acsetup{
  list/template  = styleabbrev,
  list/heading   = chapter*,
  list/name      = Abkürzungen
}

\DeclareAcronym{EEG}{
  short = EEG,
  long  = Erneuerbare-Energien-Gesetz,
}

\DeclareAcronym{dbms}{
  short = DBMS,
  long  = Database Management System,
}

\begin{document}

\printacronyms
\acuseall

\end{document}

enter image description here


The layout in the picture you posted is a little different. The following code demonstrates how a template based on a longtable could be defined which simulates this layout:

\documentclass[12pt]{report}

\usepackage{acro}
\usepackage{longtable,array}

\newlength\abbrevwidth
\setlength\abbrevwidth{6em}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}

\NewAcroTemplate[list]{styleabbrev}{%
  \AcroNeedPackage{array,longtable}%
  \acronymsmapF{%
    \AcroAddRow{%
      \acrowrite{short}%
      \acroifT{alt}{/}\acrowrite{alt}%
      &
      \acrowrite{list}%
      \acroifanyT{foreign,extra}{ (}%
      \acrowrite{foreign}%
      \acroifallT{foreign,extra}{, }%
      \acrowrite{extra}%
      \acroifanyT{foreign,extra}{)}%
      \acropagefill
      \acropages
        {\acrotranslate{page}\nobreakspace}
        {\acrotranslate{pages}\nobreakspace}%
      \tabularnewline
    }
  }{\AcroRerun}
  \acroheading
  \acropreamble
  \par\noindent
  \begin{longtable}{@{}p{\abbrevwidth}p{\dimexpr\linewidth-\abbrevwidth-2\tabcolsep\relax}@{}}
    \bfseries Abkürzung & \bfseries Erläuterung \endhead
    \AcronymTable
  \end{longtable}
}

\acsetup{
  list/template  = styleabbrev,
  list/heading   = chapter*,
  list/name      = Abkürzungsverzeichnis
}

\DeclareAcronym{EEG}{
  short = EEG,
  long  = Erneuerbare-Energien-Gesetz,
}

\DeclareAcronym{dbms}{
  short = DBMS,
  long  = Database Management System,
}

\begin{document}

\printacronyms
\acuseall

\end{document}

enter image description here

1
  • Awesome, thanks!
    – TeXlearner
    Jul 6, 2020 at 8:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .