1

I have the following code and can't find out the command to sort my abbreviation list alphabetically.

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

Currently, the compiled document looks like this:

enter image description here

EDIT

Here are some lines from the 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
    Can you please add a few lines from abbreviations.tex? – egreg Dec 26 '16 at 10:45
  • @egreg I added the three first entrees – Michael Engeli Dec 26 '16 at 15:06
2

The first argument to \DeclareAcronym is used for sorting.

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

Note the final changes.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.