Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to alter the glossary style to be able to show each entry as: (name) (see _, if exists) (description) (page#)

How can I accomplish this? Really appreciate your help in advance.

\documentclass{article}
\usepackage{datatool}    
\usepackage{glossaries}      
\makeglossaries
\makeindex

\newglossaryentry{random variable}
{
  name={random variable},
  description={a variable which can take on multiple values}
}
\newglossaryentry{sample space}
{
  name={sample space},
  description={a set of values that a random variable 
  can take},
 see={random variable}
}

\begin{document}
Something about \gls{random variable} and \gls{sample space}
\printglossary
\end{document}

The output is then:

enter image description here

I'd really like to have the "see random variable" before the description.

share|improve this question
1  
Welcome to TeX.sx! It would be useful if you augmented your question by a Minimal Working Example (a minimal but complete running document) showing what packages etc. as well as the issue about which you are asking –  Peter Jansson Jan 19 '13 at 21:34
    
Not sure about your intent, but might it not serve to simply nest \gls{random variable} within sample space's definition (if possible)? Indeed, a simple parenthetical list preceding your definition answers the mail - description = {(\gls*{random variable}, \gls*{sample}) a set of values that a \gls*{random variable} can take}, and appears to obviate the whole "See" thing. Again...if possible. –  commonhare Jan 20 '13 at 4:20
    
Actually @commonhare, the downside to your suggestion is that I get page numbers for the cross-references, which is something I don't want to have. I simply want page numbers to refer to where the \gls call was used in the main text. The one way I can accomplish this is to abandon using \gls altogether for cross-references, simply doing "see \textit{random variable}" in the description. Feels kind of hacky though, so I was wondering if there'd be a better option. Thanks! –  east Jan 20 '13 at 13:17
    
I erroneously supposed \gls* suppressed citing as well as linking. Just imagine: the package authors thought of all this! Anyway, somewhere within the package is the code that orders the description and cross-ref list. I looked, but is opaque to me. Certain that someone here can identify it though... –  commonhare Jan 20 '13 at 23:36
add comment

1 Answer

You can use \glshyperlink to cross-reference a term without indexing it. (The hyperlink will only occur if you use the hyperref package.) So you could do:

\documentclass{article}
\usepackage{datatool}    
\usepackage{glossaries}      
\makeglossaries
\makeindex

\newglossaryentry{random variable}
{
  name={random variable},
  description={a variable which can take on multiple values}
}
\newglossaryentry{sample space}
{
  name={sample space},
  description={(see \glshyperlink{random variable}) a set of values that a random variable 
  can take}
}

\begin{document}
Something about \gls{random variable} and \gls{sample space}
\printglossary
\end{document}

Result:

Resulting text

The see key essentially works as a special location, in a similar manner to \index{sample space|see{random variable}}, so value of the see key isn't easy to access.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.