I have this MWE which I would like to use for my glossary. Problem is that the width of the third column is based on \setlength{\glsdescwidth}{12cm}
which will/will not work depending on the document class's page margins.
I would like the right column to use the full usable page width after left and center column have adopted to what is needed to display their content. I understand that ltxtable
or tabularx
can be utilized but I just can't figure out how to get it right. Can someone point me in the right direction?
\documentclass{article}
\usepackage{lipsum}
\usepackage{siunitx}
\usepackage[acronym,toc]{glossaries} % use glossaries-package
\setlength{\glsdescwidth}{12cm}
\usepackage{glossary-longbooktabs}
\newglossary[slg]{unitlist}{syi}{syg}{Verzeichnis der Kurzzeichen} % create add. symbolslist
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\makeglossaries % activate glossaries-package
%===================================================================
%Einträge Einheitenverzeichnis
%===================================================================
\newglossaryentry{m}{name=\ensuremath{m},
description={Meter},
unit={\si{m}},
type=unitlist}
\newglossaryentry{symb:Pi}{name=\ensuremath{\pi},
description={Geometrischer Wert},
unit={},
type=unitlist}
\newglossaryentry{energyconsump}{
name=\ensuremath{P},
description={Leistung},
unit={\si{kW}},
type=unitlist}
\glsnoexpandfields
\newglossaryentry{sqkm}{
name=\ensuremath{A},
description=Quadratkilometer Quadratkilometer Quadratkilometer Quadratkilometer Quadratkilometer,
unit=\si{\square\kilo\metre},
type=unitlist}
%===================================================================
%Stilvorlage
%===================================================================
\newglossarystyle{3colger}{%
\setglossarystyle{longragged3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{l l p{\glsdescwidth}}}%
{\end{longtable}}%
%
\renewcommand*{\glossaryheader}{% Change the table header
\bfseries Zeichen & \bfseries Einheit & \bfseries Beschreibung \\
% \hline
\vspace{0.05cm}
\endhead}
\renewcommand*{\glossentry}[2]{% Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glsunit{##1}
& \glossentrydesc{##1} \tabularnewline
}
}
\begin{document}
\lipsum[2-4]
\glsaddall
\printglossary[type=unitlist,style=3colger]
\end{document}
How it looks like if the \setlength{\glsdescwidth}{12cm}
has not been chosen correctly:
geometry
package. Replaced by [layout].