tud-cd / tudscr

TUD-Script
Other
105 stars 22 forks source link

symbol glossary suggestion with longtabu does not work anymore #67

Closed Pratched closed 3 years ago

Pratched commented 3 years ago

I am referring to the user guideline for this package from the 29th of March 2017, specifically page 21.

Within this document there was an alternative symbol glossary introduced which worked fine for me before. Unfortunately this does not work any longer with adaptations made by exemplary #58.

The following MWE yield an error about Missing }, but only when printing the glossary with the predefined style symblongtabu and I cannot figure out what is causing this.

\documentclass[%
twoside=true,%  
open=right,%
]{tudscrreprt}
\usepackage[T1]{fontenc}
\usepackage{siunitx}

\usepackage[%
acronym,% 
symbols,%
toc,%
sanitizesort,%
translate=babel,%
xindy={language=german-din},%
section=chapter,%
]{glossaries}

\makenoidxglossaries

\usepackage{tabu}

\newglossarystyle{symblongtabu}{%
    \renewenvironment{theglossary}{%
        \begin{longtabu}spread 0pt[l]{ccX<{\strut}l}%
        }{%
        \end{longtabu}%
    }%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand*{\glsgroupskip}{}%
    \renewcommand*{\glossaryheader}{%
        \toprule
        \bfseries Formelzeichen & \bfseries Einheit &
        \bfseries Bezeichnung & \bfseries Seite(n)
        \tabularnewline\midrule\endhead%
        \bottomrule\endfoot%
    }%
    \renewcommand*{\glossentry}[2]{%
        \glsentryitem{##1}% Entry number if required
        \glstarget{##1}{\glossentrysymbol{##1}} &
        \glsentryuseri{##1} &
        \glossentryname{##1} &
        ##2\tabularnewline%
    }%
}

\defglsentryfmt[symbols]{%
    \ifmmode%
    \glssymbol{\glslabel}%
    \else%
    \glsgenentryfmt~\glsentrysymbol{\glslabel}%
    \fi%
}

\newcommand*{\nsymbol}[5][]{%
    \newglossaryentry{#2}{%
        type=symbols,%
        name={#3},%
        description={\nopostdesc},%
        symbol={\ensuremath{#4}},%
        sort={#2},%
        #1,%
    }%
}

\nsymbol{ipv}{Strom}{I_{pv}}{\ampere}

\begin{document}
    \tableofcontents
    \printnoidxglossary[type=symbols, style=symblongtabu]

    \chapter{test}
    \gls{ipv}
\end{document}

Am i missing something or is this just due to changes made within the package(s) and therefore incompatible?

mrpiggi commented 3 years ago

The package tabu is officially declared broken since 2019-01-12 and will probably never be fixed. But you can easily switch to xltabular instead. Package tabularray would be an alternative, too.

\usepackage{xltabular}
\usepackage{booktabs}
%\usepackage{tabu}

\newglossarystyle{symblongtabu}{%
  \renewenvironment{theglossary}{%
%    \begin{longtabu}[l]{ccX<{\strut}l}% ’spread 0pt’ defekt in v2.9
    \xltabular[l]{\linewidth}{ccXl}%
    }{%
%    \end{longtabu}%
    \endxltabular%
  }%
  ...
}
Pratched commented 3 years ago

Thanks for the easy fix!