TransWikia.com

How to print glossary math symbol in bold?

TeX - LaTeX Asked by Corbie on January 1, 2021

I would like to print the first usage of a math symbol defined in my glossary in bold without defining a new glossary entry.

Using the text environment textbf{glssymbol{T1}} has no effect, because the symbol is in math mode.

Using the symbol in math mode does not work either: $glssymbol{T1}$.

How do I print the math symbol in bold?

documentclass{article}

usepackage{glossaries}
usepackage{bm}
makeglossaries

newglossaryentry{T1}{name={T1}, symbol={ensuremath{T_1}}, description={longitudinal relaxation time}}
newglossaryentry{T1bold}{name={T1}, symbol={ensuremath{bm{T_1}}}, description={longitudinal relaxation time (bold entry)}}

begin{document}
This is the first time I use textbf{glssymbol{T1}} (should be textbf{bold} like glssymbol{T1bold}) and this the second time: glssymbol{T1} (not bold).

Defining another symbol in the glossary leads to a second entry:
printglossaries
end{document}

2 Answers

One possible solution is to use the text environment in a bold math (bm) mode.

As a new command, this looks like:

newcommand{glssymbold}[1]{ensuremath{bm{text{glssymbol{#1}}}}}

that can be used like this:

glssymbold{T1}

Answered by Corbie on January 1, 2021

Simply use the optional user fields to declare your bold variable. Its much easier to handle than to define a new command. Tip: you could also define a new gls field (say 'glsBoldVar', compare your problem to my answer here)

documentclass{article}

usepackage{glossaries}
usepackage{bm}
makeglossaries

newglossaryentry{T1}{name={T1}, 
    symbol={ensuremath{T_1}},
    user1={ensuremath{bm{T_1}}},
    description={longitudinal relaxation time}
}
 description={longitudinal relaxation time (bold entry)}}

begin{document}
    This is the first time I use textbf{glssymbol{T1}} (should be textbf{bold} like glsuseri{T1}) and this the second time: glssymbol{T1} (not bold).

    Defining another symbol in the glossary leads to a second entry:
    printglossaries
end{document}

Answered by Venez on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP