4

I am currently writing an article using the IEEEtran class. I want to use the package acro to manage my acronyms and \printacronyms to display the acronyms list at the beginning of the article. It usually works fine in a single-column document but in double column the acronym spills over the acronym definition if its too long. Also the acronym on the left column should appear in bold but this is no longer the case with IEEEtran.

Here is a minimum working example

\documentclass[10pt,journal]{IEEEtran}
\usepackage{lipsum}
\usepackage[template=tabularray]{acro} 

\DeclareAcronym{a}{
    short=aaa,
    long=aaaaa,
}

\DeclareAcronym{b}{
    short=bbbbbbbb,
    long=bbbbbbb bbbbbbb bbbbbbb,
}

\begin{document}

\section*{Nomenclature}

\printacronyms  

\section{Introduction}

\lipsum[1]
\ac{a} \ac{b}   
\lipsum[1]  

\end{document}

which produces:

acro

Thanks for your help!

1 Answer 1

3

So there are two things going on here: 1. IEEEtran redefines the standard LaTeX description environment which acro defaults to using, 2. You are unsuccessful in trying to apply the tabularray list template.

  1. To fix the default acro list we can either redefine the description environment or modify the acro list template to use a different environment. As IEEEtran makes the standard LaTeX description environment available as LaTeXdescription the latter is probably best. We can redefine the acro list description template using

    \RenewAcroTemplate[list]{description}{%   \acroheading  
    \acropreamble   \begin{LaTeXdescription}
        \acronymsmapF{%
        \item[\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
          \acrowrite{list}%
          \acroifanyT{foreign,extra}{ (}%
          \acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
          \acroifT{extra}{\acrowrite{extra}}%
          \acroifanyT{foreign,extra}{)}%
          \acropagefill
          \acropages
            {\acrotranslate{page}\nobreakspace}
            {\acrotranslate{pages}\nobreakspace}%
        }
        {\item\AcroRerun}   \end{LaTeXdescription} }
    

    or to avoid hard-coding the template we can patch it locally when using \printacronyms

    \begingroup
    \let\description\LaTeXdescription
    \let\enddescription\endLaTeXdescription
    \printacronyms  
    \endgroup
    

    Compilation showing the acro description list template

  2. Instead to use the tabularray list template, we need to do a few things. acro no longer uses package options to set things like this, preferring \acsetup instead, although I'm not sure that template=tabularray has ever been a valid package option to acro.

    You should be getting a package warning

    Package acro Warning: Unknown option `template'
    (acro)                I don't know the option `template'. Please make sure
    (acro)                there is no typo. Check the manual for help.
    

    Checking Section 5 Setting options of the acro manual we see \acsetup{<options>} is preferred. \acsetup{template=tabularray} yields an error so going to Section 11 Printing the list we see it's \acsetup{list/template=tabularray}. This yields another error

    ! Package acro Error: The template `tabularray' needs the package `tabularray'
    (acro)                loaded on line 21
    

    which is straightforward, loading the tabularray package the new list template is active and compiles successfully.

    Compilation showing the acro tabularray list template

The following code is compilable for either solution, just comment out \acsetup{list/template=tabularray} to get the default description version.

\documentclass[10pt,journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{tabularray}

\usepackage{acro}
\acsetup{list/template=tabularray}

\RenewAcroTemplate[list]{description}{%
  \acroheading
  \acropreamble
  \begin{LaTeXdescription}
    \acronymsmapF{%
    \item[\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
      \acrowrite{list}%
      \acroifanyT{foreign,extra}{ (}%
      \acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
      \acroifT{extra}{\acrowrite{extra}}%
      \acroifanyT{foreign,extra}{)}%
      \acropagefill
      \acropages
        {\acrotranslate{page}\nobreakspace}
        {\acrotranslate{pages}\nobreakspace}%
    }
    {\item\AcroRerun}
  \end{LaTeXdescription}
}

\DeclareAcronym{a}{
    short=aaa,
    long=aaaaa,
}

\DeclareAcronym{b}{
    short=bbbbbbbb,
    long=bbbbbbb bbbbbbb bbbbbbb,
}

\begin{document}

\section*{Nomenclature}

\printacronyms  

\section{Introduction}

\lipsum[1]
\ac{a} \ac{b}   
\lipsum[1]  

\end{document}
9
  • Thanks for that. I have tried to compile your code but strangely it does not produce a list of acronyms (I am using TeXlive for Ubuntu)
    – Andros
    Mar 25 at 15:07
  • @Andros I'm guessing you are getting an error ! LaTeX Error: File `tabularray.sty' not found. in the log file, it's very important to read and act on errors from compilation. If you've installed TeXLive through the Ubuntu package manager you probably have TeX Live 2020, this pre-dates the tabularray package and so you cannot use the tabularray list template. Comment out \usepackage{tabularray} and \acsetup{list/template=tabularray} and use the first solution, or try a different list template.
    – Dai Bowen
    Mar 25 at 15:16
  • Thanks a lot Dai Bowen, it works like a charm! Just a quick question: is it possible to fix the length of each column so that the acronym definitions are aligned?
    – Andros
    Mar 25 at 15:30
  • @Andros absolutely, the tabularray list template would do that, but without the requisite package, check out the tabular or longtable list templates (the latter requires loading longtable)
    – Dai Bowen
    Mar 25 at 15:41
  • Sorry, my question was unclear. I cannot use the tabularray list template as I am using TexLive 2020. My question is: can your first solution be modified such that acronym definitions arealigned the same way acro with the tabularray template would do?
    – Andros
    Mar 25 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .