Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 949057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:20:38+00:00 2026-05-15T23:20:38+00:00

I would like to modify the glossaryentryfield so that it creates output depending on

  • 0

I would like to modify the glossaryentryfield so that it creates output depending on whether or not user1 (key provided by the package has been defined/set or not. I tried the following:

\renewcommand*{\glossaryentryfield}[5]{\bfseries{\glstarget{##1}{##2}} & ##3 \\
\ifempty{\glsentryuseri{##1}}
    it & is very empty \\
\else
    & \glsentryuseri{##1} \\%
\fi}

which however results in several errormessages like this:

! 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.

(One for every Glossary entry it seems) obviously followed by an unmatched \else and unmatched \fi

As far as i can see, i have to do something with the expansion order, however i am a complete novice to latex.
I can not simply set all user1-keys, since i want to only display that extra row if user1 is defined, the other row is just for debugging purposes.

I also tried to add \expandafter directly before the \if ( \expandafter\ifempty{\glsentryuseri{##1}} ) (resulting in the following output:)

user1value it & is very empty \\ & user1value

since nobody could awnser this i crossposted it at the latex community and added a minimal example there. As soon as it gets awnsered on one site i will crosspost the solution

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:20:38+00:00Added an answer on May 15, 2026 at 11:20 pm

    Nicola Talbot awnsered my question on the latex community, she wrote:

    \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:

    \documentclass{article}
    
    \usepackage{ifmtarg}
    \usepackage[style=long]{glossaries}
    
    \makeglossaries
    
    \makeatletter
    \newcommand*{\ifuseriempty}[3]{%
      \protected@edef\tmp{\glsentryuseri{#1}}%
      \expandafter\@ifmtarg\expandafter{\tmp}{#2}{#3}%
    }
    \makeatother
    
    \renewcommand*{\glossaryentryfield}[5]{\bfseries{\glstarget{#1}{#2}}
    & #3 \\
    \ifuseriempty{#1}%
      {it &is very empty}%
      { &\glsentryuseri{#1}}%
    \\%
    }
    
    \newglossaryentry{sample}{name=sample,%
      description={sample without user 1 key}}
    
    \newglossaryentry{sample2}{name=sample2,%
      description={sample with user 1 key},
      user1={User1 Value}}
    
    \begin{document}
    \gls{sample}, \gls{sample2}.
    
    \printglossaries
    \end{document}
    

    Regards Nicola Talbot

    For my purposes the glossaryentryfield has to look like this:

    \renewcommand*{\glossaryentryfield}[5]{\bfseries{\glstarget{#1}{#2}}
    & #3 \
    \ifuseriempty{#1}%
    {}%
    { &\glsentryuseri{#1}\}%
    }

    Remember to use ## instead of # infront of the parameter numbers if you want to use this in a \newglossarystyle enviornment

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.