# How to use Abbreviations inside tables

I have a very rare and uncommon situation. I want to call abbreviations the first time inside a table environment. It works as intended, but the package hyperref does not like it. The following MWE creates the problem:

\documentclass[
12pt,
ngerman,
a4paper,
]{scrreprt}

\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{tabularx}
\usepackage[]{hyperref}
\usepackage[smaller]{acronym}

\begin{document}

\tableofcontents

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Abkürzungsverzeichnis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\begin{acronym}[EEPROM]
\setlength{\itemsep}{-\parsep}
% \acro{CV}{Computer Vision}
\acro{EDR}{Experiment Data Record}
\acro{RCE}{Rover Compute Element}
\acro{JPL}{Jet Propulsion Lab}
\acro{MIPL}{Massive Impulse Propellant Lab}
\acro{RMC}{Rover Motion Counter}
\end{acronym}

\clearpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Kapitel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{arabic} %Arabic numerals

\chapter{TABLE}

Some Text infront of the issuefull table with the abbrevation of \ac{JPL}.

\begin{table}[ht]
\begin{tabularx}{\textwidth}{|c|l|l|>{\raggedright\arraybackslash}X|}
\hline
Pos & Name & Wert & Erklärung \\ \hline
1 & config & BLUB & \ac{RCE} \\
2 & prod & BLUB & \ac*{EDR} \\
3 & site & BLUB & \ac*{RMC} \\
4 & drive & BLUB & \ac*{RMC} \\
5 & venue/who & BLUB & \ac{MIPL} (at \ac*{JPL}) or \ac{JPL} \\
\hline

\end{tabularx}
\caption{Blub}
\label{tab:Blub}
\end{table}

Now let us call a different Abbrevation from the table, maybe \ac{EDR}.

\end{document}


The Warnings for this MWE looks as follows:

There were undefined references.
LaTeX [1, 1]
Hyper reference acro:EDR' on page 2 undefined.
LaTeX [59, 1]
Hyper reference acro:EDR' on page 2 undefined.
LaTeX [59, 1]
Hyper reference acro:RCE' on page 2 undefined.
LaTeX [60, 1]
Hyper reference acro:RCE' on page 2 undefined.
LaTeX [60, 1]
Hyper reference acro:MIPL' on page 2 undefined.
LaTeX [62, 1]
Hyper reference acro:MIPL' on page 2 undefined.
LaTeX [62, 1]


As you might have recognized, the abbreviation JPL is not a problem because it was called before the table and the abbreviation RMC because it was called with the asterix. So calling all abbreviations inside the table with an asterix seems to be the solution.

Sadly I have a different apperance of this solution in the original document and I am unable to create a working MWE with the following warnings:

Label acro:RMC@cref' multiply defined.
LaTeX [1, 1]
There were multiply-defined labels.
LaTeX [1, 1]


This Happens if an abbreviation is used twice inside the table or if I use an abbreviation again outside the table with \ac{RMC}

Also I actually want to you use the short versions of the abbreviations inside the table, which would happen if I call the command \ac{} before the table like I did with JPL.

So is there any way to achieve this without warnings or should I rewrite the text, so that the commands correctly called before?

the problem is not the table but tabularx: as it processes its content twice, the acronym is marked as used and then doesn't write the label.

You can try this in the preamble (after tabularx):

\usepackage{etoolbox}
\makeatletter

\patchcmd \TX@trial

Side remark: you have because of the \pagenumbering{arabic} two pages with number 1 and hyperref won't like this.
• That actually worked perfectly, but I need to admit that I don't have any clue how ;). To the sidemark: Maybe this is an leftover because i deleted accidently the \pagenumbering{roman}` – MaKaNu Jan 29 at 11:30