0

How can I forced the Symbol to be printed in capitalized or uppercase form in the glossary only (with non capitalized form declared in the field "symbol") depending on the item level of the entry?

Here a MWE :

\documentclass{article}
\usepackage[style=tree]{glossaries-extra}
\makenoidxglossaries

\newglossaryentry{subsytem}{name={Subssytems},description={\glspar},sort={4}} \newglossaryentry{compressor} { name={Compressor}, text={compressor}, sort={compressor}, description={Air Compressor}, symbol={cp}, parent=subsytem } \newglossaryentry{compressor_motor} { name={Compressor Motor}, sort={compressor motor}, text={compressor motor}, description={Motor of the \Gls{compressor}}, symbol={cm}, parent=compressor }

\begin{document} \gls{compressor_motor} \printnoidxglossary \end{document}

Instead of this result : enter image description here

I would like something like that (subitem "Compressor (Cp)" instead of "Compressor (cp)" and subsubitem "Compressor Motor (CM)" instead of "Compressor Motor (cm)") :

enter image description here

But I would like the symbol to be declared in lowercase in the symbol field (cp or cm) as shown in the MWE.

zetyty
  • 779
  • I answered your first question (symbols printed in capital letters). But I don't fully understand the second one (in bold). Could you give an example of what input - output you want to achieve? – Simon Dispa Jan 25 '22 at 18:03
  • Sorry for that. My second question give an hypotetic solition to the first question. Indeed, when declaring a new glossary entry, if I could use a field (like "symbolname) to declare the symbol only printed in the glossary and possibly different from the one declared in the field "symbol". In other words, the same result when I use the "name" field and the "text" field, which permits to dissociate the use in glossery print from the use in text... I hope is cleared, if not, please tell me. – zetyty Jan 25 '22 at 19:31

1 Answers1

2

Try this code.

UPDATE For a more comprehensive response look in How to Capitalize a Symbol in Glossary Print

a

\documentclass{article}
\usepackage[style=tree]{glossaries-extra}

% ******************************************added <<<<<<<<<<< \newcommand{\GLOSSentrysymbol}[1]{% \glsdoifexistsorwarn{#1}% {% \GLSentrysymbol{#1}% }% } \makeatletter \newcommand*{\GLSentrysymbol}[1]{% see https://tex.stackexchange.com/a/199801/161015 \begingroup\edef\tmpx{\endgroup\uppercase{@gls@entry@field{#1}{symbol}}}\tmpx
} \makeatother

\renewcommand{\subglossentry}[3]{%
\ifcase#1\relax \item \or \subitem \glstreenamefmt{\glstarget{#2}{\glossentryname{#2}}}% \ifglshassymbol{#2}{\space(\Glossentrysymbol{#2})}{}% \glstreechildpredesc\glossentrydesc{#2}\glspostdescription\space #3% \else \subsubitem \glstreenamefmt{\glstarget{#2}{\glossentryname{#2}}}% \ifglshassymbol{#2}{\space(\GLOSSentrysymbol{#2})}{}% \glstreechildpredesc\glossentrydesc{#2}\glspostdescription\space #3% \fi\par }%

% *******************************************

\makenoidxglossaries

\newglossaryentry{subsytem}{name={Subssytems},description={\glspar},sort={4}} \newglossaryentry{compressor} { name={Compressor}, text={compressor}, sort={compressor}, description={Air Compressor}, symbol={cp}, parent=subsytem } \newglossaryentry{compressor_motor} { name={Compressor Motor}, sort={compressor motor}, text={compressor motor}, description={Motor of the \Gls{compressor}}, symbol={cm}, parent=compressor }

\begin{document}
\gls{compressor_motor} \printnoidxglossary \end{document}

Simon Dispa
  • 39,141
  • Thanks a lot for your answer. It works thank you but to be sure I well understand, do you confirm that only parent entries have only first caracter capitalized (like in "Cp") and the "second level" entries have all caracters in capital ("CM") ? – zetyty Jan 25 '22 at 19:51
  • @Sylvain Rigal To the best of my knowledge ... Only valid for the tree style. – Simon Dispa Jan 25 '22 at 19:55
  • @Sylvain Rigal What you call parent entry (it is not) -- compresor--- is a subitem (a child of parent entry subsystem) and compresor_motor in turn is a subsubitem, being a child of compresor. There are three levels at play. – Simon Dispa Jan 25 '22 at 20:03
  • Thnaks for the precision. So it's definitely not what I needed... I don't want the Capitalization driven by the subitem level... It shows that my question was not clear. So I will change a bit my question in order to suit your response (which can be usefull) and after I will ask another clearer question. Thanks again and sorry... – zetyty Jan 26 '22 at 07:14
  • @Sylvain Rigal Thank you for your feedback!. For your new question, if you are looking for a particular implementation (instead of an output), explain the why this is important to you. It helps to narrow the possibilities. – Simon Dispa Jan 26 '22 at 13:20
  • Ok I will do my best next Time... Thanks a lot! – zetyty Jan 26 '22 at 18:13