cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
40 stars 9 forks source link

Acronyms are not horizontally aligned for supertabular environment due to hyperref package #245

Closed ChristianH2809 closed 2 years ago

ChristianH2809 commented 2 years ago

Hi, I have the following issue:

I use the code below to generate a list of abbreviations. However, if I also load the hyperref package below the acro package, the abbreviation and the description are no longer aligned.

This problem does not occur in TeXLive 2021 with acro v3.7 and hyperref v7.00n, but only in TeXLive 2022 with acro v3.8 and hyperref v7.00q.


% LOAD DOCUMENTCLASS
%------------------------------
\documentclass[
]{scrreprt}
%------------------------------
% DOCUMENT AND ENCODING
%------------------------------
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
    ngerman,                % new german language
    english,                % english language  
]{babel}                    % language package, second language is DEFAULT
\usepackage{csquotes}
\usepackage{calc}
\usepackage{supertabular,array} % table type for acro
\usepackage[
]{acro}                     % package for list of abbreviations
%\usepackage{hyperref}

\newlength{\myabbrevlength}
\setlength{\myabbrevlength}{2cm}
\newlength{\descriptionWidth}
\setlength{\descriptionWidth}{\linewidth-2\tabcolsep-\myabbrevlength}
\iflanguage{english}{
    \newcommand{\abbrevname}{List of Abbreviations}
    }{\iflanguage{ngerman}{
        \newcommand{\abbrevname}{Abkürzungsverzeichnis}}{}
}
\NewAcroTemplate[list]{mysupertabu}{
    \AcroNeedPackage{array}%
    \def\arraystretch{1.2}
    \acronymsmapF{%
        \AcroAddRow{%
            \acrowrite{short} & \acrowrite{list} \acropagefill \tabularnewline}
    }
    {\AcroRerun}%
    \acroheading
    \acropreamble
    \begin{supertabular}{>{\bfseries\sffamily}p{\myabbrevlength}p{\descriptionWidth}@{}}
        \AcronymTable
    \end{supertabular}
}
\acsetup{   
    format/first-long=\itshape, % first appearence is set in italics
    index/use=true,             % add abbrevs to index
    make-links=true,            % make links for abbrevs
    list / display = all        % make all abbrevs visible
}

%% Abbreviation definitions
%------------------------------
% NUMERICS
%------------------------------
\DeclareAcronym{ab}{%
    short={ab},
    long={\textbf{a}ctive \textbf{b}ound},
    short-plural={s},
    short-plural-form={abs},
    long-plural={s},
    long-plural-form={\textbf{a}ctive \textbf{b}ounds},
    tag={Numerics},
}%
\DeclareAcronym{dae}{%
    short={DAE},
    long={\textbf{D}ifferential-\textbf{a}lgebraic \textbf{e}quation (system)},
    short-plural={s},
    short-plural-form={DAEs},
    long-plural={s},
    long-plural-form={\textbf{D}ifferential-\textbf{a}lgebraic \textbf{e}quation (systems)},
    tag={Numerics},
}%
%------------------------------
% SOFTWARE
%------------------------------
\DeclareAcronym{sundials}{
    short={SUNDIALS},
    long={\textbf{Su}ite of \textbf{n}onlinear and \textbf{di}fferential-\textbf{al}gebraic equation \textbf{s}olvers},
    tag={Software},
}

\begin{document}
\addchap{\abbrevname}                           % KOMA command to add chapter to toc without numbering
%------------------------------
% COLUMN WIDTH
%------------------------------
\settowidth{\myabbrevlength}{SUNDIALS}
%------------------------------
% LIST(S) OF ABBREVIATIONS
%------------------------------
\printacronyms[template=mysupertabu, sort=true, include={Numerics}, heading=section*, name=Numerics]
\printacronyms[template=mysupertabu, sort=true, include={Software}, heading=section*, name=Software]

\vspace{1.5cm}
Alternatively, you can only have one list of abbreviations without further classification:

\printacronyms[template=mysupertabu, sort=true, heading=none]
\end{document}
ChristianH2809 commented 2 years ago

A working solution has been proposed in latex3/hyperref#241.

@cgnieder: Maybe it is possible to modify the \acrowrite{} command as Ulrike suggested?