0

Ho-ho-hi, so I have this glossary entry:

\newglossaryentry{fermiconstant}{
name={Fermi Coupling Constant},
description={coupling associated to the effective four point interaction of the electroweak interactions},
symbol={\ensuremath{G_F}},
user1={${1.1663787(6)\times 10^{−5}~\text{GeV}^{-2}}$}
}

But it does not display the value stored in user1. Is there a particular setting needed to show the value, or does anybody have a better way of displaying a glossary constant

Thanks!

1

1 Answer 1

1

You can define your own glossary style where the user1 value is printed. The value is displayed using the macro \glsuseri.

You can define the glossary style any way you like, for example as a table. The example below shows a simple list style (basically \item[label] definition). The manual (section 27 and 28) has some more examples of glossary style definitions, and the package also provides sample files with style definitions.

MWE:

\documentclass{article}
\usepackage[symbols,nomain]{glossaries}
\makenoidxglossaries

\newglossarystyle
{symval}% style name
{% based on list style
  \setglossarystyle{list}%
    \renewcommand{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \ifglshassymbol{##1}{\glossentrysymbol{##1}\space}{}%
          \glstarget{##1}{\glossentryname{##1}}]
       \ifglshasfield{useri}{##1}{(\glsuseri{##1})}{}%
       \glspar\glossentrydesc{##1}\space(page\space##2)%
       }%
}

\newglossaryentry{fermiconstant}{
name={Fermi Coupling Constant},
description={coupling associated to the effective four point interaction of the electroweak interactions},
symbol={\ensuremath{G_F}},
user1={${1.1663787(6)\times 10^{−5}~\text{GeV}^{-2}}$}
}
\begin{document}
We use \glssymbol{fermiconstant} which is the \gls{fermiconstant}.

\printnoidxglossary[type=symbols,style=symval]
\end{document}

Result:

enter image description here

7
  • Wow, that's beautiful! I'm going to give it a shot - Thanks!
    – MKF
    Dec 18, 2020 at 16:00
  • And Happy Holidays!
    – MKF
    Dec 18, 2020 at 16:01
  • @MKF thanks, happy holidays to you too :)
    – Marijn
    Dec 18, 2020 at 16:06
  • Can I ask a quick question Marjin? What if you have other entries without this style? Can you combine them into one glossary?
    – MKF
    Dec 18, 2020 at 16:14
  • 1
    I'm not fully sure but I think the style is per glossary - which makes some sense, it would be strange if there are different layouts in a list of symbols for example. However, as you may have seen from the example code, there are macros like \ifglshasfield{user1} that do a different thing if the field is found for an entry (i.e., print the field) or when a field is not found (do nothing in this example, i.e., {}, but it could also be some default text for example). So you may be able to use this to combine different types of entries nicely in one glossary.
    – Marijn
    Dec 18, 2020 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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