使用 acro 包进行 Alphabetica 排序

使用 acro 包进行 Alphabetica 排序

我有以下代码,但找不到按字母顺序对缩写列表进行排序的命令。

\documentclass [11pt, a4paper] {article}

\usepackage{acro} %list of abbreviations
\acsetup{first-style=short} %list of abbreviations

\input{abbreviations.tex} %define abbreviations in this file.

\begin{document}

\addcontentsline{toc}{section}{\numberline{}List of Abbreviations}
\acuseall %to make all abbreviations appear in list of abbreviations (formally uses all of them)

\printacronyms[heading=none,include-classes={abbrev},sort=true] % print list of abbreviations

\end{document}

目前,编译后的文档如下所示:

在此处输入图片描述

编辑

以下是其中的一些内容abbreviations.tex

%------------------------------------
% DEFINING ABBREVIATIONS
%------------------------------------
\DeclareAcronym{1}{ % every abbreviation must be defined this way
    short = {LDL} , % abbreviation shown in the list of abbrev
    long  = {Low-density lipoprotein} , % long text shown in the list of abbrev
    class = {abbrev}
}
\DeclareAcronym{2}{
    short = {HDL} ,
    long = {High-density lipoprotein},
    class = {abbrev}
}
\DeclareAcronym{3}{
    short = {RYGB} ,
    long = {Roux-en-Y gastric bypass},
    class = {abbrev}
}

答案1

第一个参数\DeclareAcronym用于排序。

\documentclass [11pt, a4paper] {article}
\usepackage{acro} %list of abbreviations

\acsetup{first-style=short}
%\input{abbreviations.tex} %define abbreviations in this file.

\DeclareAcronym{LDL}{ % every abbreviation must be defined this way
    short = {LDL}, % abbreviation shown in the list of abbrev
    long  = {Low-density lipoprotein}, % long text shown in the list of abbrev
    class = {abbrev}
}
\DeclareAcronym{HDL}{
    short = {HDL},
    long  = {High-density lipoprotein},
    class = {abbrev}
}
\DeclareAcronym{RYGB}{
    short = {RYGB},
    long  = {Roux-en-Y gastric bypass},
    class = {abbrev}
}
\begin{document}

\acuseall

\cleardoublepage
\addcontentsline{toc}{section}{\protect\numberline{}List of Abbreviations}
\printacronyms[heading=none,include-classes={abbrev},sort=true]

\end{document}

注意最后的变化。

在此处输入图片描述

更新

随着acro软件包的新版本的推出,有些事情发生了变化。特别是,ID 不再用于排序,而是shortis。但是,可以添加一个sort键来解决排序问题。如果未指定,则按键对条目进行排序short。现在还有classesistaginclude-classesis include。在下面的示例代码中,sort键被注释掉,因为实际上不需要。

\documentclass [11pt, a4paper] {article}
\usepackage{acro} %list of abbreviations

\acsetup{first-style=short}
%\input{abbreviations.tex} %define abbreviations in this file.

\DeclareAcronym{LDL}{ % every abbreviation must be defined this way
    short = {LDL}, % abbreviation shown in the list of abbrev
    long  = {Low-density lipoprotein}, % long text shown in the list of abbrev
    tag = {abbrev},
    %sort = {LDL},
}
\DeclareAcronym{HDL}{
    short = {HDL},
    long  = {High-density lipoprotein},
    tag = {abbrev},
    %sort = {HDL},
}
\DeclareAcronym{RYGB}{
    short = {RYGB},
    long  = {Roux-en-Y gastric bypass},
    tag = {abbrev},
    %sort = {RYGB},
}
\begin{document}

\acuseall

\cleardoublepage
\addcontentsline{toc}{section}{\protect\numberline{}List of Abbreviations}
\printacronyms[heading=none,include=abbrev,sort]

\end{document}

相关内容