About 🛈
Shop 🛒Shop 🛒
LaTeX 🖹
Software 💾
Books 📚
Gallery 🖺
News 📢
Contact 📧
Blog 🖋

Gallery (glossaries): Cross-References Sample

Image of cross-references in glossary sample
The glossaries user manual suggests a number of methods for cross-referencing entries in the Cross-Referencing Entries section, but here's another method that's an adaptation of the citations in glossary sample. Here, instead of using the see key, I'm going to use the user1 key. This now gives me the flexibility to place the cross-references wherever I like by defining a custom glossary style, instead of having to put up with wherever xindy or makeindex puts the cross-references. This method also works if the number list needs to be suppressed.

As with the citation example, this custom style is based on the list style (\setglossarystyle{list}) but it's again modified to check if the useri field is set (useri is the internal field name corresponding to the user1 key). To allow for the possibility of a comma-separated list of cross-references, the value of the useri is fetched and stored in a control sequence using \glsletentryfield which is then expanded before being processed by \glsseelist.

Note that if any of the cross-references aren't actually used in the document, \glsseelist doesn't add them to the glossary. This will cause undefined hypertargets. This can be fixed by redefining \glsseeitem so that it uses \glstext instead of \glshyperlink. Since \glsseeitem is robust, we need to use etoolbox's \renewrobustcmd. I've also defined a command called \crossrefentry that can be used in the document, if required.

Remember that if the cross-referenced term only appears in the glossary, you'll need an extra makeglossaries call.

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

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex




{% based on list style
       \glossentrydesc{##1}\glspostdescription\space ##2
     See also \expandafter\glsseelist\expandafter{\thisref}.}{}%





\forglsentries{\thislabel}{\gls{\thislabel}. }

Reference a term: \gls{aliquampurus} (see also

The entries have all been defined in the file example-glossaries-seealso.tex. The entry definitions look like this:
description={suscipit cursus sem},user1={vivamus}}

description={risus mi, egestas ac}}

description={varius, faucibus quis, leo},user1={vivamus}}


\newglossaryentry{crasid}{name={cras id},
description={justo quis nibh scelerisque dignissim},

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

pdflatex seealso
makeglossaries seealso
pdflatex seealso
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.

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.

Terms of Use Privacy Policy Cookies Site Map FAQs