### Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 19 guests

## [glossaries] output depending on definition of a userkey

Add tags LaTeX specific issues not fitting into one of the other forums of this category.

### [glossaries] output depending on definition of a userkey

edited:Added minimal example and desired output vs generated output

Hi,
since i have not found a more suiting subforum i'll post this in general.

I use the glossaries package and would like to have different output in the glossarie depending on wether the user1-key (key the package provides as options for the entries) has been defined or not.

I am trying to do this by putting the following into a style definition (for a tabular style thats why there are ampersands and double backslashes):
Code: Select all  •  Open in writeLaTeX
\renewcommand*{\glossaryentryfield}[5]{\bfseries{\glstarget{##1}{##2}} & ##3 \\\ifempty{\glsentryuseri{##1}}    it & is very empty \\\else    & \glsentryuseri{##1} \\%\fi}

which however results in the following error(s):
Code: Select all  •  Open in writeLaTeX
! Undefined control sequence. \ifempty l.49 \setentrycounter{page}\glsnumberformat{a}}} % The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

I assume it has something to do with the order of the expansion/evaluation.

Greetings ted

P.S.: This is a Crosspost from here (were it has not been answered for 2 days) : http://stackoverflow.com/questions/3245 ... -userkey-h

Minimal example (almost), the part with "\renewcommand*{\glossaryentryfield}" is the important one:

Code: Select all  •  Open in writeLaTeX
Attachments
minimalExample.pdf
Sample of output (top) and desired output (bottom)
I am aware that i have to remove the line "it & is very empty \\" in the if-branch, however this line is for debugging to show that both parts of the if seem to be evaluated
Last edited by redted on Wed Jul 21st, 2010, edited 1 time in total.
redted

Posts: 5
Joined: Sat Jul 17th, 2010

### Re: [glossaries] output depending on definition of a userkey

\ifempty isn't defined in standard LaTeX, which is what's causing the error message. You can use the ifmtarg package, which provides the internal command \@ifmtarg. For example:
Code: Select all  •  Open in writeLaTeX

Regards
Nicola Talbot

nlct

Posts: 258
Joined: Thu Nov 6th, 2008

### Re: [glossaries] output depending on definition of a userkey

Thank you very much Nicola, the solution works just fine. I stumbled briefly over the fact that i have to use two '#' instead of one '#' if I want too use that in the definition of a new \newglossarystyle enviornment

For my purposes the glossaryentryfield has to look like this:

Code: Select all  •  Open in writeLaTeX
\renewcommand*{\glossaryentryfield}[5]{\bfseries{\glstarget{#1}{#2}}& #3 \\\ifuseriempty{#1}%  {}%  { &\glsentryuseri{#1}\\}%}`

thus only creating rows if the field has been defined.

Thanks again ted
redted

Posts: 5
Joined: Sat Jul 17th, 2010