1

Does anyone know how to change the format of the entry names in a tree-like style glossary, as the indexhypergroup style?

There, the default seems to be bold, serif font. I'd like to keep the bold, but sans serif, also for the sub-entry and subsubentry names.

As found in the Glossaries-user Manual, I've tried it with

\renewcommand{\glsnamefont}[1]{\textsf{\mdseries #1}} as well as with

\renewcommand{\glstreenamefmt}[1]{\textsf{\textbf{\mdseries #1}}}

however, without success. The sans serif works, but the entries are no longer in bold. What am I doing wrong?

MWE:


\begin{filecontents}{myglossary.tex}
\longnewglossaryentry{Nervoussystem}{
name={Nervous system},
text={nervous system},
description={no description needed for parent entry}
}

\longnewglossaryentry{central}{
parent={Nervoussystem},
name={central (CNS)},
text={central nervous system (CNS)},
description={Multi-paragraph explanation of central nervous system, with small indentation between paragraphs. Multi-paragraph explanation of central nervous system.

Multi-paragraph explanation of central nervous system, with small indentation between paragraphs. Multi-paragraph explanation of central nervous system.}
}

\longnewglossaryentry{peripheral}{
parent={Nervoussystem},
name={peripheral (PNS)},
text={peripheral nervous system (PNS)},
description={Multi-paragraph explanation of peripheral nervous system, with small indentation between paragraphs. Multi-paragraph explanation of peripheral nervous system.

Multi-paragraph explanation of peripheral nervous system, with small indentation between paragraphs. Multi-paragraph explanation of peripheral nervous system.}
}

\longnewglossaryentry{gls:Muscle}{
name={Muscle},
description={Description of a Muscle}
}
 
\newacronym{N}{N.}{Nervus}%<<<<<<<<<<<<<<<< acronyms added
\newacronym[see={[see Glossary:]{gls:Muscle}}]{M}{M.}{Musculus\glsadd{gls:Muscle}}

\end{filecontents}

\documentclass[ngerman]{scrbook}
\usepackage[inner=2.5cm,outer=2.5cm,tmargin=3cm,bmargin=4cm]{geometry}
\usepackage{hyperref} 
\hypersetup{colorlinks,citecolor=cyan,linkcolor=black}
\usepackage[toc,acronym,xindy,nopostdot]{glossaries} %edited by Daniela:style=deleted,title= deleted

% to increase space btw glossary entry using index style:
\renewcommand*{\glspostdescription}{\medskip}

% indent adjustments
\renewcommand{\glstreeitem}{% for parent entry
\parindent0pt\par\hangindent20pt
\everypar{\parindent50pt\hangindent20pt}}

\renewcommand{\glstreesubitem}{% for child entry
\parindent30pt\par\hangindent50pt
\everypar{\parindent50pt\hangindent40pt}}

\renewcommand{\glstreesubsubitem}{% for child entry
\parindent50pt\par\hangindent70pt
\everypar{\parindent50pt\hangindent40pt}}

\renewcommand{\glstreepredesc}{\par\glstreeitem\parindent\hangindent}

\makeglossaries

\loadglsentries{myglossary}
\usepackage[xindy]{imakeidx}
\makeindex% added
\setacronymstyle{long-short}

\begin{document}

I'd like the entry names as \gls{gls:Muscle}, \gls{Nervoussystem}, as well as the sub entry names as \gls{central} and \gls{peripheral} to appear in bold, sans serif font. \gls{N} and \gls{M} in the list of acronyms, currently looks fine (acronym is shown in bold and sans serif, and on the same line as the description.

\printglossary[type=\acronymtype,title={Acronyms},toctitle={Acronyms}]%<<<<<<<<<<<<<<<<<<<< added

\printglossary[type=main,style=indexhypergroup,title={Glossary},toctitle={Glossary}]% changed by Daniela

\end{document}

1 Answer 1

1

UPDATE After follow-up

With updated MWE add

\renewcommand*{\glstreenamefmt}[1]{{\sffamily \bfseries #1}}

before \begin{document}

The Acronyms page will not be modified.

d

This is the complete code.

\begin{filecontents}[overwrite]{myglossary.tex}
\longnewglossaryentry{Nervoussystem}{% USE here % <<<<<<<<<<<<<<<<<<<<<<
name={Nervous system},
text={nervous system},
description={no description needed for parent entry}
}

\longnewglossaryentry{central}{%
parent={Nervoussystem},
name={central (CNS)},
text={central nervous system (CNS)},
description={Multi-paragraph explanation of central nervous system, with small indentation between paragraphs. Multi-paragraph explanation of central nervous system.

Multi-paragraph explanation of central nervous system, with small indentation between paragraphs. Multi-paragraph explanation of central nervous system.}
}

\longnewglossaryentry{peripheral}{%
parent={Nervoussystem},
name={peripheral (PNS)},
text={peripheral nervous system (PNS)},
description={Multi-paragraph explanation of peripheral nervous system, with small indentation between paragraphs. Multi-paragraph explanation of peripheral nervous system.

Multi-paragraph explanation of peripheral nervous system, with small indentation between paragraphs. Multi-paragraph explanation of peripheral nervous system.}
}

\longnewglossaryentry{gls:Muscle}{%
name={Muscle},
description={Description of a Muscle}
}
 
\newacronym{N}{N.}{Nervus}%<<<<<<<<<<<<<<<< acronyms added
\newacronym[see={[see Glossary:]{gls:Muscle}}]{M}{M.}{Musculus\glsadd{gls:Muscle}}

\end{filecontents}

\documentclass[ngerman]{scrbook}
\usepackage[inner=2.5cm,outer=2.5cm,tmargin=3cm,bmargin=4cm]{geometry}
\usepackage{hyperref} 
\hypersetup{colorlinks,citecolor=cyan,linkcolor=black}
\usepackage[toc,acronym,xindy,nopostdot]{glossaries} %edited by Daniela:style=deleted,title= deleted

\usepackage{xcolor}

% to increase space btw glossary entry using index style:
\renewcommand*{\glspostdescription}{\medskip}

% indent adjustments
\renewcommand{\glstreeitem}{% for parent entry
\parindent0pt\par\hangindent20pt
\everypar{\parindent50pt\hangindent20pt}}

\renewcommand{\glstreesubitem}{% for child entry
\parindent30pt\par\hangindent50pt
\everypar{\parindent50pt\hangindent40pt}}

\renewcommand{\glstreesubsubitem}{% for child entry
\parindent50pt\par\hangindent70pt
\everypar{\parindent50pt\hangindent40pt}}

\renewcommand{\glstreepredesc}{\par\glstreeitem\parindent\hangindent}

\makeglossaries

\loadglsentries{myglossary}

\usepackage[xindy]{imakeidx}
\makeindex% added
\setacronymstyle{long-short}


\renewcommand*{\glstreenamefmt}[1]{{\sffamily \bfseries#1}} % added <<<<<<<<<<<<

\begin{document}

I'd like the entry names as \gls{gls:Muscle}, \gls{Nervoussystem}, as well as the sub entry names as \gls{central} and \gls{peripheral} to appear in bold, sans serif font. \gls{N} and \gls{M} in the list of acronyms, currently looks fine (acronym is shown in bold and sans serif, and on the same line as the description.

\printglossary[type=\acronymtype,title={Acronyms},toctitle={Acronyms}]%<<<<<<<<<<<<<<<<<<<< added

\printglossary[type=main,style=indexhypergroup,title={Glossary},toctitle={Glossary}]% changed by Daniela

\end{document}
7
  • Dear @Simon Dispa, many thanks for your help, I really appreciate! Unfortunately, it didn't work in my document. Your solution changed the way my \acronymtype glossary looks like, but not my main glossary I'm sorry, you couln't know. In fact, I work with an external file myglossary where I store both the main glossary entries and the acronym entries. I didn't mention it in the first place, as I didn't know how to make the MWE work with the external file. Is your solution anyhow doable for my main glossary, without changing the acronym glossary? I tried to change the MWE accordingly.
    – Daniela
    Commented Mar 17, 2022 at 10:05
  • @Please add a sample of some acronym entries from your external file and check that your MWE gives the right answer for you, except for the font issue. Commented Mar 17, 2022 at 12:11
  • Thanks @Simon Dispa for this second chance :-) I think I now got my head around this 'external file in MWE-issue' with the filecontents environment - which I added in the original MWE.
    – Daniela
    Commented Mar 17, 2022 at 18:04
  • @Daniela A step forward but still no acronyms ... It does not matter if the definitions are in an external file or in the main document. You need to put a code that prints the acronyms list and the glossaries list the way you like. Then we can start looking to the font issue. Commented Mar 17, 2022 at 18:41
  • Yes @Simon Dispa thanks, though I think I've done so. I've added it in my original MWE. There are now 2 acronyms defined \newacronym{N}{N.}{Nervus}, \newacronym[see={[see Glossary:]{gls:Muscle}}]{M}{M.}{Musculus\glsadd{gls:Muscle}} plus the \printglossary[type=\acronymtype,title={Acronyms},toctitle={Acronyms}] command a bit further down.
    – Daniela
    Commented Mar 17, 2022 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .