Skip to content

Commit

Permalink
Provide option to suppress glossaries page list printing
Browse files Browse the repository at this point in the history
A long overdue feature anyway
  • Loading branch information
alexpovel committed Dec 7, 2020
1 parent 481dec6 commit b75d3d1
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 64 deletions.
39 changes: 39 additions & 0 deletions chapters/frontmatter.tex
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,45 @@
style=long3colheader,
]

\addchap{\glossaryname{} without page lists}%

\emph{
The following styles do not contain page lists of the entries' occurrences,
leading to a cleaner, more concise look.
Refer to the source code on how to achieve this (which options and styles to use).
}

% For all sorts of styles, see also
% https://www.dickimaw-books.com/gallery/glossaries-styles/

% Simply pass the `nonumberlist` parameter where desired/required:
\printunsrtglossary[
type=symbols,
style=symbunitlong,
nonumberlist,
]
\printunsrtglossary[
type=numbers,
style=numberlong,
nonumberlist,
]
\printunsrtglossary[
type=subscripts,
style=mcolalttree,
nonumberlist,
]
\printunsrtglossary[
type=abbreviations,
% If `nonumberlist` is passed, the `long3colheader` style simply leaves the
% corresponding table cells *empty* (leading to an entirely empty column), but does
% not actually remove the column. So use a different, but equivalent style
% altogether:
style=longheader,
% The `longheader` style prints the page list behind the description, just not in a
% separate column. So also explicitly suppress the generation of that:
nonumberlist,
]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\listoffigures%

Expand Down
204 changes: 140 additions & 64 deletions cookbook.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1961,91 +1961,167 @@
\newcommand*{\glshdrfont}[1]{\textbf{#1}} % Font for gls table heads
% To print symbols:
\newglossarystyle{custom-base}{
% A simple style subsequent, custom-defined styles will have in common.
\setglossarystyle{long-name-desc-loc}
\renewcommand*{\glossaryheader}{}% Remove it
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Standard base style, without page list
\newglossarystyle{symbunitlong}{% https://tex.stackexchange.com/a/269571/120853
% Base new style on existing one. This is quite important, since it implements
% all otherwise missing but maybe required commands,
% like \glsgroupskip if --group option is used for bib2gls
\setglossarystyle{long-name-desc-loc}
\setglossarystyle{custom-base}
\renewcommand*{\glossaryheader}{}% Remove it
\renewcommand*{\glsgroupskip}{\addlinespace\addlinespace}%
\renewenvironment{theglossary}{%
% Use Longtabu over longtable, the latter caused inexplicable issues with
% 'Column widths have changed, rerun Latex'
\begin{longtabu}{%
r%
p{0.5\linewidth}%
p{\glspagelistwidth}%
l%
% This command is taken from the source code, I hope I am not abusing it:
\ifglsnonumberlist
% User requested NO location list/number list/page list to be printed, so
% remove those columns.
\renewenvironment{theglossary}{%
% Use Longtabu over longtable, the latter caused inexplicable issues with
% 'Column widths have changed, rerun Latex'
\begin{longtabu}{%
r%
p{0.5\linewidth}%
l%
}%
}{%
\end{longtabu}%
}%
}{%
\end{longtabu}%
}%
\renewcommand*{\glsgroupskip}{\addlinespace\addlinespace}%
\renewcommand*{\glsgroupheading}[1]{%
\glshdrfont{\glsgetgrouptitle{##1}} &
\glshdrfont{\descriptionname} &
\glshdrfont{\TransUnit{}}
\tabularnewline
}%
\renewcommand*{\glsgroupheading}[1]{%
\glshdrfont{\glsgetgrouptitle{##1}} &
\glshdrfont{\descriptionname} &
\glshdrfont{\pagelistname} &
\glshdrfont{\TransUnit{}}
\tabularnewline
}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
% Use glsentryunit to access entry, NOT glsunit,
% https://tex.stackexchange.com/a/281772/120853:
\glsentryunit{##1}
\tabularnewline
}
\else
\renewenvironment{theglossary}{% Redefine this, overwriting the base style
\begin{longtabu}{%
r%
p{0.5\linewidth}%
p{\glspagelistwidth}%
l%
}%
}{%
\end{longtabu}%
}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
##2 &
% Use glsentryunit to access entry, NOT glsunit,
% https://tex.stackexchange.com/a/281772/120853:
\glsentryunit{##1}
\tabularnewline
}
\renewcommand*{\glsgroupheading}[1]{%
\glshdrfont{\glsgetgrouptitle{##1}} &
\glshdrfont{\descriptionname} &
\glshdrfont{\pagelistname} &
\glshdrfont{\TransUnit{}}
\tabularnewline
}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
##2 &
% Use glsentryunit to access entry, NOT glsunit,
% https://tex.stackexchange.com/a/281772/120853:
\glsentryunit{##1}
\tabularnewline
}
\fi
}
% To print constants, as in physical constants with values and unit:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Numbers.
% To print constants, as in physical constants with values and unit.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newglossarystyle{numberlong}{% https://tex.stackexchange.com/a/269571/120853
% Base new style on existing one. This is quite important, since it implements
% all otherwise missing but maybe required commands, like
% \glsgroupskip if --group option is used for bib2gls
\setglossarystyle{long-name-desc-loc}
\setglossarystyle{custom-base}
% This command is taken from the source code, I hope I am not abusing it:
\ifglsnonumberlist
% User requested NO location list/number list/page list to be printed, so
% remove those columns.
\renewenvironment{theglossary}{
% Use Longtabu over longtable, the latter caused inexplicable issues with
% 'Column widths have changed, rerun Latex'
\begin{longtabu}{%
r%
p{0.3\linewidth}%
r%
@{\;}%
l%
}%
}{%
\end{longtabu}%
}%
\renewcommand*{\glossaryheader}{}% Remove it
\renewcommand*{\glossaryheader}[1]{%
\glshdrfont{\symbolname} &
\glshdrfont{\descriptionname} &
\multicolumn{2}{l}{{\glshdrfont{\TransPhysicalQuantity{}}}}
\tabularnewline
}%
\renewenvironment{theglossary}{
% Use Longtabu over longtable, the latter caused inexplicable issues with
% 'Column widths have changed, rerun Latex'
\begin{longtabu}{%
r%
p{0.3\linewidth}%
r%
@{\;}%
l%
p{\glspagelistwidth}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
\glsentryvalue{##1} &
% Use glsentryunit to access entry, NOT glsunit,
% https://tex.stackexchange.com/a/281772/120853:
\glsentryunit{##1}
\tabularnewline
}%
\else
\renewenvironment{theglossary}{
% Use Longtabu over longtable, the latter caused inexplicable issues with
% 'Column widths have changed, rerun Latex'
\begin{longtabu}{%
r%
p{0.3\linewidth}%
r%
@{\;}%
l%
p{\glspagelistwidth}%
}%
}{%
\end{longtabu}%
}%
}{%
\end{longtabu}%
}%
\renewcommand*{\glossaryheader}[1]{%
\glshdrfont{\symbolname} &
\glshdrfont{\descriptionname} &
\multicolumn{2}{l}{{\glshdrfont{\TransPhysicalQuantity{}}}} &
\glshdrfont{\pagelistname}
\tabularnewline
}%
\renewcommand*{\glossaryheader}[1]{%
\glshdrfont{\symbolname} &
\glshdrfont{\descriptionname} &
\multicolumn{2}{l}{{\glshdrfont{\TransPhysicalQuantity{}}}} &
\glshdrfont{\pagelistname}
\tabularnewline
}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
\glsentryvalue{##1} &
% Use glsentryunit to access entry, NOT glsunit,
% https://tex.stackexchange.com/a/281772/120853:
\glsentryunit{##1} &
##2
\tabularnewline
}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
\glsentryvalue{##1} &
% Use glsentryunit to access entry, NOT glsunit,
% https://tex.stackexchange.com/a/281772/120853:
\glsentryunit{##1} &
##2
\tabularnewline
}%
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down

0 comments on commit b75d3d1

Please sign in to comment.