2

I'm trying to customize a glossary style from the glossaries/glossaries-extra packages called altlisthypergroup.

Below is what it looks like and I have annotated the changes I'd like to make:

Annotated Image

So I would like the navigation pane centered in the page, enlarge the group headings (A, B, C,... etc), and indent the entries a bit, with the description tabbed a bit from the name of the entry.

I have read the user manuals and code manuals for both packages, as well as looked around and so far I have come up with the following code for my custom glossary style:

\newglossarystyle{mygls}
{
\setglossarystyle{altlisthypergroup}
    \renewenvironment{theglossary}{
    \begin{description}[style=standard, labelindent=0pt]}{\end{description}}

    \renewcommand*{\glsgroupheading}[1]{\item[]\makebox[0pt]{\begin{Large}\textbf{\glsgetgrouptitle{##1}}\end{Large}}}
}

and this is the result:

image

However, the navigation pane dissappears. Changing labelindent (example 28pt) moves the group heading and the entry name but not the entry description.

enter image description here

From what I've read, I might have to use \glsnavigation to bring back the navigation pane, but no sure how to do it in combination with:

\renewcommand*{\glsgroupheading}[1]{%  
\item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]} 

from the manual.

How can I edit the group heading, and entry name and description separately? Do I use \renewenvironment{theglossary} to bring back the navigation pane? If so, how?

MWE:

\documentclass[12pt]{report}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\usepackage[explicit, noindentafter]{titlesec}
\usepackage{enumitem}
\usepackage[english]{babel}
\doublespacing

%Hyperlinks Settings
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
    citecolor = orange,
    linktoc=all
}

%Appendices - Acronyms, Definitions, Code
\usepackage[toc,page]{appendix}
\usepackage[nopostdot,acronym,automake=immediate]{glossaries}
\usepackage[stylemods=all]{glossaries-extra}
\preto\chapter{\glsresetall} %reset acronym expansion for every chapter
\setabbreviationstyle[acronym]{long-short}
\setglossarysection{subsubsection}
\renewcommand{\glossarysection}[2][]{}

\newglossarystyle{mygls}
{
\setglossarystyle{altlisthypergroup}
    \renewenvironment{theglossary}
    {\begin{description}[style=standard, labelindent=0pt]}{\end{description}}
\renewcommand*{\glsgroupheading}[1]{\item[]\makebox[0pt]{\begin{Large}\textbf{\glsgetgrouptitle{##1}}\end{Large}}}
}

\makeglossaries

\newacronym{ai}{AI}{Artificial Intelligence}

\newacronym{asl}{ASL}{American Sign Language}

\newacronym{rps}{RPS}{Rock Paper Scissors}

\newacronym{vr}{VR}{Virtual Reality}

%Quick Filler Text
\usepackage{blindtext}
\usepackage{kantlipsum}

%%%Document Begin%%%
\begin{document}

%Chapter Title Format
\titleformat{\chapter}[display]{\bfseries\centering}{\huge Chapter \thechapter}{1em}{\huge #1}
\titlespacing{\chapter}{0pt}{-32pt}{1cm}
\chapter{Custom Glossary Woes}

\blindtext[2]
\gls{ai}
\blindtext[42]
\gls{asl}
\blindtext[12]
\gls{asl}
\kant
\gls{rps}
\kant
\gls{vr}
\kant

\newpage
\appendix
%Appendix Title Format
\titleformat{\chapter}[display]{\bfseries\centering}{\huge Appendix \thechapter}{1em}{\huge #1}
\titlespacing{\chapter}{0pt}{-32pt}{1cm}
\chapter{Acronyms}
\setglossarystyle{mygls}
\printglossary[type=acronym]

\end{document}

Thanks.

ErMo
  • 43
  • Ok I found through reading the enumitem package documentation that itemindent controls the horizontal alignment of the description of the glosaary entry. So I have made the following changes to the description block: labelindent=36pt, itemindent=6pt and, inside the makebox square brackets, -60pt. So I have the alignment I want, just need to bring back a centered navigation pane. – ErMo Jun 04 '20 at 21:10
  • I was able to get the navigation pane back, there is actually a workable example in the documentation, glossaries-user.pdf, page 227, under the \glsnavigation but now the numbers I used do not affect the same items. If I center the navigation pane, the group letters also centered and labelindent does nothing and itemindent moves the navigation pane, the group letter and item label together. The item level seems to be the issue but I don't understand why \glsnavigation is inside the \item brackets in the example. Still working/hoping for a solution. – ErMo Jun 05 '20 at 02:53
  • Ok so I am figuring I have to modify the \glossentry separately. There is an example in the manual, glossaries-user.pdf, page 228, under the \glossentry but it has the entry label and description on the same line. I just need to modify it so it looks like the description type entry of the original altlisthypergroup and I'll be good. Not sure how to do that yet. – ErMo Jun 05 '20 at 04:07

1 Answers1

1

Ok I think I got it. Here is my code for the custom glossary definition:

\usepackage{needspace}
\newglossarystyle{mygls}
{
    \setglossarystyle{altlisthypergroup}
    \renewenvironment{theglossary}
    {
        \label{\thechapter}
        \begin{description}
        [style=standard, labelindent=0pt, itemindent=0pt]
    }
    {\end{description}}
\renewcommand*{\glsgroupheading}[1]
{
\begin{center}
\vspace{25pt}
\glsnavhypertarget{##1}{}
\vspace{25pt}
\end{center}
\needspace{6\baselineskip}\item[]\makebox[-85pt]{\begin{Large}\textbf{\glsgetgrouptitle{\hyperref[\thechapter]{##1}}}\end{Large}}
}

\renewcommand*{\glossentry}[2] { \leftskip2em \needspace{3\baselineskip}%%% \item[\hspace{5pt}\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}] \ \ \nobreak\glossentrydesc{##1}\glspostdescription\space ##2 }

\renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\vspace{0pt}\fi} }

Not the most elegant, but it does what I asked.

I got the code from the glossaries-code.pdf, Section 3.3, by reading the code for list and altlist and all their variants. I modified it quite a bit.

Here is a pic of the result:

enter image description here

Hope it helps someone in the future.

ErMo
  • 43