# Gallery (glossaries): Symbols Glossary Sample

This example uses the "altlongragged4col" glossary style, which isn't available by default. You need to explicitly load it using the glossary-longragged package. I've decided to use the "symbols" glossary rather than the "main" one. There's no particular difference except that the title is automatically set to "Symbols" rather than "Glossary". The file extensions are different as well, but this isn't a problem as makeglossaries can find out the extensions from the .aux file. Since I'm not using the "main" glossary, I've prevented it from being created with the nomain package option. The symbols package option creates the "symbols" glossary. It also defines \printsymbols so instead of using
\printglossary[type=symbols,style=altlongragged4col,nogroupskip]

I could use
\printsymbols[style=altlongragged4col,nogroupskip]


The comment lines below are arara directives. You can remove them if you don't use arara.

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{report}

\usepackage[colorlinks]{hyperref}
\usepackage[nopostdot,toc,nomain,symbols]{glossaries}
\usepackage{glossary-longragged}

\makeglossaries

\loadglsentries[symbols]{example-glossaries-symbols}

\begin{document}

\chapter{Sample}

\forglsentries[symbols]{\thislabel}{\gls{\thislabel}. }

\forglsentries[symbols]{\thislabel}{\glssymbol{\thislabel}. }

\printglossary[type=symbols,style=altlongragged4col,nogroupskip]

\end{document}

This document loads the hyperref package, which creates hyperlinks from the entries in the document (referenced using commands like \gls) to their definition in the glossary. These hyperlinks are displayed in red text. I've used \forglsentries just to iterate over all the defined entries for this example. In practice, you would typically just use \gls{label}. For example:
Here is a reference to the term \gls{alpha}.

I can reference the symbol (rather than the term) using \glssymbol instead of \gls.
Here is a reference to the symbol \glssymbol{alpha}.


The entries have all been defined in the file example-glossaries-symbols.tex, which you should find installed in the same location as the glossaries package (or in a sub-directory called test-entries). The entry definitions look like this:

\newglossaryentry{alpha}{name={alpha},symbol={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}

\newglossaryentry{beta}{name={beta},symbol={\ensuremath{\beta}},
description={Cras nibh.}}

\newglossaryentry{gamma}{name={gamma},symbol={\ensuremath{\gamma}},
description={Morbi vel justo vitae lacus tincidunt ultrices.}}


If you don't use arara, you need to run the following commands:

pdflatex symbols-glossary
makeglossaries symbols-glossary
pdflatex symbols-glossary

These commands can be run from a terminal or command prompt or you might be able to run them by clicking on a button in your text editor.

I've used the nopostdot option to remove the terminating full stop that is placed by default after the description. The entries all have a "1" after the description. This is the page number on which the entry was referenced. In this sample document all the entries were referenced on page 1.

Download: PDF, document source, sample glossary definitions.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.