Friday, 7 June 2013

Increase description width and number list width in glossary to match table of contents

Increase description width and number list width in glossary to match table of contents

I want my glossary created via glossaries (bottom) to have the same width as my table of contents (top). I would like the numbers in the glossary to have a large space away from the dots and description text equal to that in the table of contents.

I feel that this is partly possible by modifying the description width via \glsdescwidth.
Here is a minimal working example:
\documentclass{report}

\usepackage{tocloft}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

\usepackage[toc]{glossaries}
\makeglossaries
\renewcommand*\glspostdescription{\cftdotfill{\cftsecdotsep}}

\begin{document}

\tableofcontents

\newglossaryentry{K}{name={kind of long name},description={King of long description}}

\newglossaryentry{S}{name={some long name},description={Super super super super super super super super super super super super super super super super super long description}}

\printglossary[style=long]

\chapter{Chap 1}

\gls{K}

\gls{S}

\end{document}
To compile the example, you must use makeglossaries in between calls to latex.

No comments:

Post a Comment