2

I have a file with two types of glossaries and want the symbols to be bold within the glossary (which they are as currently in the code) but when I use them with \gls{xx) in the text or a table, I do not want them to appear bold. I hope someone can help me with this.

\documentclass[12pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{abstract}
\usepackage[nohyperlinks]{acronym}

\usepackage[footskip=2cm, hmargin=2.5cm,vmargin=3cm,bindingoffset=0.5cm]    {geometry}
\usepackage{setspace}                   %enable     onehalfspacing
    \onehalfspacing         
\usepackage[hidelinks,breaklinks]{hyperref}     %hyperlinks are hidden,     hyperref draufklicken und zum punkt im report 
\usepackage[numbered,framed]{matlab-prettifier} %integration matlab     files, required for glossary
\usepackage{multicol}                               %enable multicolumn
\usepackage[acronym, nonumberlist, nopostdot, nogroupskip]{glossaries}
\usepackage{glossary-mcols}

\renewcommand{\glsclearpage}{}

\setglossarysection{section}
\newglossary*{symbols}{List of Symbols}
\makenoidxglossaries
\glsnoexpandfields

\newacronym{pvt}{PVT}{Pressure Volume Temperature}
\newglossaryentry{ng}{type=symbols,name=$\boldsymbol n\raisebox{-.4ex}{\tiny G}$,sort=ng,description={Degree at k\raisebox{-.4ex}{\tiny{{rG}}}}}

\begin{document}
\pagenumbering{roman}

\gls{pvt} and \gls{ng}


\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Nomenclature}
%\twocolumn
\singlespacing
\chapter*{Nomenclature}
\begin{multicols}{2}
\printnoidxglossaries
\end{multicols}

\end{document}
  • Welcome to TeX.SE! Good first question, it is very helpful that you have included an MWE (Minimal Working Example) with your code that I could use for my answer. Maybe for your next question you can try to make the MWE even more minimal? There were a lot of packages and other code that was not necessary for reproducing the issue, they could be removed as well. – Marijn Aug 15 at 15:00
  • @Marijn Thank you very much, your answer helped a lot! Will try to minimize it as much as possible next time – Lucky Aug 19 at 7:45
1

It is possible to define the format of a glossary entry in the main text using the command \defglsentryfmt. This command has an optional argument for the glossary type, so you can define it only for terms of type symbols.

The idea is to use this command to switch off \boldsymbol in the main text. One way to do that is to store the original definition of \boldsymbol to another macro (for example \origboldsym), then temporarily redefine \boldsymbol to mean nothing (i.e., \relax), print the glossary entry, and restore the original definition. Redefining the entry format only affects the main text, so in the List of Symbols the original definition of \boldsymbol is used.

MWE:

\documentclass[12pt]{scrreprt}
\usepackage[acronym, nonumberlist, nopostdot, nogroupskip]{glossaries}

\setglossarysection{section}
\newglossary*{symbols}{List of Symbols}
\makenoidxglossaries
\glsnoexpandfields
\defglsentryfmt[symbols]{%
\let\origboldsym\boldsymbol%
\let\boldsymbol\relax%
\glsgenentryfmt%
\let\boldsymbol\origboldsym%
}
\newacronym{pvt}{PVT}{Pressure Volume Temperature}
\newglossaryentry{ng}{type=symbols,name=$\boldsymbol n\raisebox{-.4ex}{\tiny G}$,sort=ng,description={Degree at k\raisebox{-.4ex}{\tiny{{rG}}}}}

\begin{document}
\gls{pvt} and \gls{ng}

\printnoidxglossaries

\end{document}

Result:

enter image description here

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.