1

I am trying to compile on older document that was originally set up using acro 1.x. The document used the following settings:

\acsetup{
    first-long-format = \itshape,
    list-style = lof,
    list-short-width = 6.4em,
    list-caps = true,
    pages = first
}

On my current system I only have acro 3.8, which threw me a bunch of errors upon compilation. After going through the documentation I found the equivalents for some of the previous parameters:

\acsetup{
    format/first-long = \itshape,
    list/template = lof,
    pages/display = first
}

However it seems the following two options are gone:

  1. list-short-width - Sets the width of the acronym column in the list of abbreviations
  2. list-caps - Makes the written out acronyms in the list of abbreviations start with a capital letter.

Unfortunately all of my attemps in searching for a solution to adjust the column width lead me to older questions, where the solution was using list-short-width. Based on the documentation I also played a bit around with setting templates/colspec, but I didn't manage to get a working solution so far...

Any idea on how can I restore the previous behavior using aro 3.8?


Minimal example:

% !TeX spellcheck = en_US
\documentclass[a4paper]{article}%
%
\usepackage{acro}%
%
\DeclareAcronym{ransac}{
    short=RANSAC,
    long=random sample consensus
}%
%
\DeclareAcronym{sift}{
    short=SIFT,
    long=scale invariant feature transform
}%
%
\acsetup{
    format/first-long = \itshape,
    list/template = lof,
    pages/display = first
    %list-caps = true,
    %list-short-width=6.4em,
}%
%
\begin{document}%
\section{Some Text}
\Ac{ransac} is a common approach to match features like \ac{sift}.

\section*{List of Abbreviations} \printacronyms[heading=none]%

\end{document}%

Current output:

Output

Desired list appearance (original document):

Output in old document

exocore
  • 15
  • 3
  • I think you want \acsetup{list/template=longtable}, probably without any further modifications? – Dai Bowen Apr 30 '23 at 12:52
  • Thanks for the hint. With \acsetup{list/template=longtable}the first column is at least not reaching into the second one anymore, but there are a few other issues instead: 1) The overall table width doesn't match \linewidth, 2) the first column is formatted in bold and 3) the written out acronyms still don't start with an uppercase letter. – exocore May 01 '23 at 14:07
  • Yes, I thought there might be more. I can probably sort that all out but I think I've dug up the necessary for lof, as far as list-caps you want sentence casing (so typically \Acl) rather than title casing right? – Dai Bowen May 02 '23 at 18:49
  • Regarding the first two points I already figured that I can fix them by setting \acsetup{templates/colspec = p{0.15\linewidth}p{.819\linewidth}} and adding \setlength\LTleft{-0.45em}. The values are from my original document template, so they might not match perfect for the minimal example. Unfortunately I'm failing with the uppercasing so far. The intended behavior is indeed only to have a capital first letter as in \Acl. However, adding something like >{\expandafter\MakeUppercase} to the second column doesn't work as Latex adds a \noindent at the beginning of the cell content. – exocore May 02 '23 at 21:05

1 Answers1

0

As far as capitalisation, the list-caps key seems to have an equivalent in \acsetup{uppercase/list=true} however this key is undocumented. \acsetup{format/list=\acroupper} is probably not an intended method but will also work as \acroupper is internally the difference between \Ac and \ac.

For the list there are a couple of options with differing dependencies.

  • lof can be modified through use of tocloft as described in cgnieder's answer to Space between acronym and its description when using LOF style for List of Acronyms. This matches the screenshot provided reasonably well, but deviates from the lof style that acro ships with.

  • The table-based lists (tabular/longtable) also largely match the screenshot provided without modification. These default to a bold short form, due to the default templates/colspec=>{\bfseries}lp{.7\linewidth}, which can be overriden with \acsetup{templates/colspec=lp{.7\linewidth}}. We can span the full page width setting \acsetup{templates/colspec=p{6em}p{\linewidth-6em-3\tabcolsep}} (relying on calc for the in-place maths).

  • tabularray may also be worth looking into as it allows the first column to be l (not requiring a hard-coded width) and the second will automatically fill, but the current (3.8) acro template is a bit awkward to customise without resorting to \RenewAcroTemplate (in the below I've left the columns as default and used a very hacky local setting of format/short=\normalfont to override the built-in \bfseries), I'm also not sure where the extra vertical space after the heading is coming from there.

\documentclass{article}
\usepackage{tocloft}% for lof - needs to be loaded before acro
\usepackage{array}% for tabular/longtable list templates
\usepackage{longtable}% for longtable list template
\usepackage{tabularray}% for tabularray list template
\usepackage{calc}% for easy calculations within colspec
\usepackage{acro}

\DeclareAcronym{ransac}{ short=RANSAC, long=random sample consensus } \DeclareAcronym{sift}{ short=SIFT, long=scale invariant feature transform }

\acsetup{ format/first-long = \itshape, pages/display = first, format/list = \acroupper }

\SetupAcroTemplate[list]{lof}{ \setlength\cftfignumwidth{6em} }

\acsetup{templates/colspec=p{6em}p{\linewidth-6em-3\tabcolsep}}

\begin{document}% \section{Some Text} \Ac{ransac} is a common approach to match features like \ac{sift}.

\printacronyms[template=lof]% \printacronyms[template=tabular]% { \acsetup{format/short=\normalfont} \printacronyms[template=tabularray] }

\end{document}

Compiled code showing the adapted lof, tabular, and tabularray lists

Dai Bowen
  • 6,117
  • Thanks a lot! It works great - except for one special case which is nested acronyms like \DeclareAcronym{rgb}{short=RGB, long={red, green, and blue}} \DeclareAcronym{rgbd}{short=RGB-D, long=\ac{rgb} and depth}. I only have this one case, where both acronyms appear right behind each other in the list, so I just wrote plain "RBG" in the second one as no reader will ever look for a hyperlink there. Another solution would be renaming the reference from rgb to RGB. However, out of pure academic curiosity, I would be interested in knowing how to solve this properly... – exocore May 06 '23 at 07:00
  • Ah, that's interesting, amusing it gives a fairly acceptable failure path in your case. I've just realised the undocumented uppercase/list is probably intended to replace short-caps, but that flat out errors with nested acronyms. Could you ask a separate question about nesting acronyms while capitalising the list? There are probably a couple of approaches and this Q&A is already a little broad, It can just use the default list and any answers should readily transfer. – Dai Bowen May 06 '23 at 12:07
  • I'm not sure if I actually have anything more intelligent to say than use list=RGB and depth but somebody else might have a better idea. – Dai Bowen May 08 '23 at 21:13