'\DeclareAcroListStyle' 已被删除

'\DeclareAcroListStyle' 已被删除

当我编译下面的内容时,一旦运行 MWE,我现在就会收到错误

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

好像软件包acro已经更新了,但是我找不到任何相关的记录\DeclareAcroListStyle。有人知道现在是怎么做的吗?

\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}

提前致谢!


我想获得以下结果:

在此处输入图片描述

答案1

在版本 3 中,acro列表样式(现在称为模板)的定义方式已完全改变 - 这使得整个过程更加灵活和可定制。缺点是它与版本 2 中的方式不兼容。正如您所发现的,仅重命名命令是行不通的。

手册中有相当一部分内容描述了如何定义和修改模板。对于你的情况来说,调整你已有的布局其实并不困难:

\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}

在此处输入图片描述


您发布的图片中的布局略有不同。以下代码演示了如何longtable定义基于的模板来模拟此布局:

\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}

在此处输入图片描述

相关内容