3

I am making a list of abbreviations for a thesis, that will have multiple categories (and probably around 100 abbreviations in total). I want to subgroup these into various classes.

The acro package allows this, and allows me to standardise the distance between the start of the first letter and definition, using the \acsetup{list-style=tabular} command. However, if I want multiple lists of abbreviations (see MWE below), the distance changes between tables. Is there a way of standardising this, so that I can set this manually, so that it is the same for both lists?

The MWE below gives me two lists (good), but the distance differs depending on the length of acronyms in each of the lists (bad).

I am keen to continue using acro as it other options that I find very useful.

MWE:

\documentclass{article}

\usepackage{acro}
\usepackage{relsize}
\usepackage[hidelinks]{hyperref}

\DeclareAcronym{SALSAS}{
    short = SALSAS ,
    long  = some are long some are short ,
    class = long
}
\DeclareAcronym{HP}{
    short = HP ,
    long  = help putting ,
    class = long
}


\DeclareAcronym{S}
{   short = S , 
    long = short ,
    class = short}

\DeclareAcronym{C}
{   short = C , 
    long = command ,
    class = short}



\acsetup{list-heading=subsection*} %Means that the acronyms lists are classed as a subsection
\acsetup{list-style=tabular}


\setlength{\tabcolsep}{10pt}


\begin{document}


    \section*{Acronyms}


    \printacronyms[include-classes=long,name={Long}]

    \printacronyms[include-classes=short,name={Short}]




Acronyms are useful: \ac{SALSAS}. The \ac{S} ones are my favourite. Any \ac{HP} tables in the right \acp{C} would be gratefully received. 



\end{document}

Different widths

  • I wouldn't create to much subgroups. As a reader I would hate to have to skim various lists to find the meaning of an abbreviation. – Ulrike Fischer Apr 17 '15 at 7:51
5

Here's a hack that changes the template for the tabular; I wasn't able to find a better solution, as the column types are hardcoded.

I'd say that an automatic solution is out of question, because it would need measuring all acronyms and set the width for the column. Maybe the package author can think to something better.

Adjust the length (now 2cm) where %<--- appears

\documentclass{article}

\usepackage{acro}
\usepackage{relsize}
\usepackage[hidelinks]{hyperref}

\DeclareAcronym{SALSAS}{
    short = SALSAS ,
    long  = some are long some are short ,
    class = long
}
\DeclareAcronym{HP}{
    short = HP ,
    long  = help putting ,
    class = long
}


\DeclareAcronym{S}
{   short = S , 
    long = short ,
    class = short}

\DeclareAcronym{C}
{   short = C , 
    long = command ,
    class = short}

\acsetup{list-heading=subsection*} %Means that the acronyms lists are classed as a subsection
\acsetup{list-style=tabular}

\ExplSyntaxOn
\DeclareTemplateInterface {acro-list} {table} {3}
  {
    table       : tokenlist = longtable         ,
    table-spec  : tokenlist = p{2cm}p{\l__acro_table_width_dim} ,%<---
    foreign-sep : tokenlist = { ~ }
  }
\DeclareInstance { acro-list } { tabular }
  { table }
  { table = tabular }
\ExplSyntaxOff

%\setlength{\tabcolsep}{10pt}


\begin{document}


    \section*{Acronyms}


    \printacronyms[include-classes=long,name={Long}]

    \printacronyms[include-classes=short,name={Short}]

Acronyms are useful: \ac{SALSAS}. The \ac{S} ones are my favourite. Any \ac{HP} tables in the right \acp{C} would be gratefully received. 

\end{document}

enter image description here


Update

With a newer version of acro it's possible to act on the list without hacks.

\documentclass{article}

\usepackage{acro}

\DeclareAcronym{SALSAS}{
    short = SALSAS ,
    long  = some are long some are short ,
    class = long
}
\DeclareAcronym{HP}{
    short = HP ,
    long  = help putting ,
    class = long
}

\DeclareAcronym{S}
{   short = S , 
    long = short ,
    class = short}

\DeclareAcronym{C}
{   short = C , 
    long = command ,
    class = short}

\DeclareAcroListStyle{mytabular}{table}{
  table=tabular,
  table-spec=@{}p{2cm}p{\dimexpr\textwidth-2cm-2\tabcolsep}@{},
}

\acsetup{list-heading=subsection*} %Means that the acronyms lists are classed as a subsection
\acsetup{list-style=mytabular}

\begin{document}

\section*{Acronyms}

\printacronyms[include-classes=long,name={Long}]

\printacronyms[include-classes=short,name={Short}]

Acronyms are useful: \ac{SALSAS}. The \ac{S} ones are my favourite. Any \ac{HP} tables in the right 
\acp{C} would be gratefully received.

\end{document}

enter image description here

  • You may get the width of the longest acronym and use it in the tabular definition. – cacamailg Jul 15 '15 at 22:30
  • I get the following error when doing so: xtemplate error: "argument-number-mismatch" Object type 'acro-list' takes 2 argument(s). For immediate help type H <return>. } Plus: is there an option to get the acronyms printed in bold? – nmy2015 Feb 4 '16 at 21:46
  • @nmy2015 Hmm, acro got updated and this got broken. :-O – egreg Feb 4 '16 at 21:48
  • @nmy2015 It's become much easier! – egreg Feb 4 '16 at 22:03
  • Thanks, that helped a lot. Now there's only the question remaining about how to make the acronyms in the list bold. Do ypu know that, @egreg? – nmy2015 Feb 5 '16 at 8:42

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.