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 define my entry with:

\newglossaryentry{foo}{name={foo}, description={foo description}}

I can refer to it in a text with \Gls{foo} which puts a href link to Glossary. Is is possible to get a raw string with description from glossary entry? For example

The term \gls{foo} is defined as: \GlsDesc{foo}

or something like this. I'd like it to output a raw description text without hreflinks and such in the middle of the text.

So the output of that would be:

The term foo is defined as: foo description

Is it possible ?

EDIT: It would be nice if a reference to another glossary entry in description wouldn't break:

\newglossaryentry{bar}{name={bar}, description={bar description}}
\newglossaryentry{foo}{name={foo}, description={foo and \gls{bar} description}}

This is foo desc: \glsdesc{foo}

The reference is broken, this is the output:

This is foo desc: foo and ``gls-bar`` description

instead of expected:

This is foo desc: foo and bar description
share|improve this question
    
Please, turn the code snippet into a minimal working example (MWE) that illustrates your problem. –  egreg Jul 4 '12 at 12:11
    
I'm facing the exact same problem that you described in your edited post. \glsdesc seems to break nested \gls. Hope that someone knows a workaround or how to fix it. –  christoph Sep 19 '12 at 18:59
    
@christoph: The effect you observe is due to the special ‘sanitization’ applied to the values of the name, description and symbol keys. Hence, try \usepackage[sanitize=none]{glossaries} and then \glsdesc*{foo}. Note that, without sanitization, you have to protect fragile commands in the arguments of \newglossaryentry. But fortunately, \gls is robust. –  mhp Sep 20 '12 at 19:55
    
@mhp: Thank you very much. It's working now. –  christoph Sep 20 '12 at 20:58
    
@mhp: If you change your comment into an answer, I could award the bounty to it (if you are interested). –  christoph Sep 21 '12 at 10:54
show 1 more comment

2 Answers

This command is called \glsdesc{<your key>} Analogous to the symbol commands there are three versions of this command:

\glsdesc{<your key>}
\Glsdesc{<your key>} 
\GLSdesc{<your key>}

And of course the starred versions:

\glsdesc*{<your key>}
\Glsdesc*{<your key>} 
\GLSdesc*{<your key>}

The latter should meet your demands.

share|improve this answer
    
Thanks, that's exactly what I needed. However what If my description contains a reference to another glossary: (...)description = {This item is related to \gls{another} item mentioned earlier}. –  Krzysztof Nowak Jul 4 '12 at 11:55
    
In that case it would be quite helpful if you would add a MWE showing your construction. –  bloodworks Jul 4 '12 at 12:02
add comment

The first part of the above question has already been correctly answered by @bloodworks. So I’m only addressing the second part, as in my original comment.

The situation is the following: To ease the usage of fragile commands in glossary definitions, the glossaries package ‘sanitizes’ the values of the name, description and symbol keys using the LaTeX 2ε kernel command \@onelevel@sanitize. As a result, each of these values is replaced with a character string preserving the respective unexpanded meaning.

Obviously, this procedure is convenient when it comes to writing the values of the name, description and symbol keys to the output glossary file (i.e. the auxiliary file with the filename extension .gls). On the other hand, it possibly fails when one of these values is typeset directly via \glsname, \glsdesc or \glssymbol.

In a nutshell, if you want to reference glossary entries using \glsname, \glsdesc or \glssymbol you might consider completely turning off the sanitization procedure. To this end, load the glossaries package as

\usepackage[sanitize=none]{glossaries}

Alternatively, you can disable the sanitization procedure only for a subset of the three affected keys. Try, for instance,

\usepackage[sanitize={description=false}]{glossaries}

Of course, turning off the sanitization procedure possibly requires adaptations to existing glossary definitions: Fragile commands have to be protected (e.g. by prefixing them with \protect from the LaTeX 2ε kernel) or made robust prior to usage (e.g. by means of \robustify from the etoolbox package).

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.