1

In my tabularray tables acronyms (with the acronym package) are not expanded like expected. Only the short form is printed, also if the acronym appears for the first time in the document. The workaroud to use the long version \acl{acro} followed by (\acs{acro}) I used in row No. 3 of the MWE is not a solution from my point of view.

\documentclass[12pt]{article}
\usepackage{tabularray}
\usepackage[printonlyused]{acronym}
\usepackage{hyperref} 

\begin{document}
    I lost my \ac{USB} stick.

    \begin{tblr}[long]{ 
        colspec = {c Q[0.6\textwidth] c},
        vlines, hlines}
        No. & Interface & Year\\
        1 & \ac{HDMI} is a proprietary audio/video interface for transmitting \ldots & 2002\\
        2 & \ac{DVI} is a video display interface developed by the \ac{DDWG}. & 1999\\
        3 & \acl{SATA} (\ac{SATA}) is a computer bus interface \ldots & 2000

    \end{tblr}
    I found my \ac{USB} stick!

    \section{Abbreviations}

    \begin{acronym}[TDMA]
        \acro{USB}{Universal Serial Bus}
        \acro{DVI}{Digital Visual Interface}
        \acro{DDWG}{Digital Display Working Group}
        \acro{SATA}{Serial AT Attachment}
        \acro{HDMI}{High Definition Multimedia Interface}
    \end{acronym}
\end{document}

enter image description here

3
  • Welcome to TeX.SE!
    – Mensch
    Mar 22, 2023 at 21:51
  • You may need to look into 3.2.3 of the tabularray documentation. Mar 22, 2023 at 23:14
  • @User23456234 I looked into tabularray documentation 3.2.3 but did not find a solution. Neither to expand the \ac command nor the external definition of the table body changed anything.
    – smallman
    Mar 24, 2023 at 21:37

1 Answer 1

4

We experience this apparent bug because tabularray has to render each cell twice: the first time just measures the size of the cell and the second time is when it is actually typesetting the table. Thanks to a request from the acro package author, tabularray now has a boolean variable that we can check to discover whether tabularray is measuring the size of the cell or actually printing the final product.

Here is how we can leverage that tabularray hook for the acronym package. This solution requires at least tabularray version 2023A 2023-03-01.

  1. We create new commands to use within the tblr environment (technically, we could use them anywhere) that test for the boolean value of \lTblrMeasuringBool. If it is true, then tabularray is in the process of measuring the cell size and we do not want it to mark the acronym as used so we have it use the starred version of the acronym command instead. If it is false, we proceed as we otherwise would have.
  2. We change our calls to the acronym package macros in the tblr environment to the names of the macros that we just created.
\documentclass[12pt]{article}
\usepackage{tabularray}
\usepackage[printonlyused]{acronym}
\usepackage{hyperref} 

\newcommand\tblrac[1]{%
    \IfBooleanT{\lTblrMeasuringBool}{\ac*{#1}}%
    \IfBooleanF{\lTblrMeasuringBool}{\ac{#1}}}
\newcommand\tblracp[1]{%
    \IfBooleanT{\lTblrMeasuringBool}{\acp*{#1}}%
    \IfBooleanF{\lTblrMeasuringBool}{\acp{#1}}}

\begin{document}
    I lost my \ac{USB} stick.

    \begin{tblr}[expand=\expanded,long]{ 
        colspec = {c Q[0.6\textwidth] c},
        vlines, hlines}
        No. & Interface & Year\\
        1 & \tblrac{HDMI} is a proprietary audio/video interface for transmitting \ldots & 2002\\
        2 & \tblrac{DVI} is a video display interface developed by the \tblracp{DDWG}. & 1999\\
        3 & \tblrac{SATA} is a computer bus interface \ldots & 2000

    \end{tblr}
    I found my \ac{USB} stick!

    \section{Abbreviations}

    \begin{acronym}[TDMA]
        \acro{USB}{Universal Serial Bus}
        \acro{DVI}{Digital Visual Interface}
        \acro{DDWG}{Digital Display Working Group}
        \acro{SATA}{Serial AT Attachment}
        \acro{HDMI}{High Definition Multimedia Interface}
    \end{acronym}
\end{document}

A screenshot of the above code typeset output

You probably noticed that I changed your "DDGW" acronym to be plural. Although this does not make sense contextually, it demonstrates how to extend this answer to your question to other acronym package commands, of which there are 21: A screenshot of the acronym package documentation listing the 21 commands

You must log in to answer this question.

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