[Tex/LaTex] How to change glossaries alttree: no bold font for second level

formattingglossaries

How can I modify the glossaries e.g. alttree style to not use bold fonts for the entries in second level. First level should remain bold.

I'd like to do it like

\newglossarystyle{mylist}{%
\glossarystyle{list}% base this style on the list style
\renewcommand{\glsgroupskip}{}% make nothing happen between groups
}

but I do not know the command to "renew"

P.S.: Using the longragged style would fit even better. In that case I'd like to change the identication of the first column and make first level entries bold.

Best Answer

If you take a look into glossaries.pdf or glossary-longragged.sty you will find the following definition of the glossary style longragged:

\newglossarystyle{longragged}{%
  \renewenvironment{theglossary}%
     {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}%
     {\end{longtable}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5%
    \tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4\glspostdescription\space ##6%
    \tabularnewline}%
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else & \tabularnewline\fi}%
}

Now what you need to do is change the definitions that you want differently in your style:

\documentclass{article}
\usepackage{glossaries,glossary-longragged}
\usepackage{tabu}

\makeglossaries

\newglossaryentry{test}{name={test},description={some description text}}
\newglossaryentry{test2}{name={another test},description={some description text}}
\newglossaryentry{test3}{name={a third test},description={some description text}}
\newglossaryentry{parent}{name={parent},description={\nopostdesc}}
\newglossaryentry{child1}
  {name={child 1},description={some description text},parent={parent}}
\newglossaryentry{child2}
  {name={child 2},description={some description text},parent={parent}}

\newglossarystyle{mylongragged}{%
  \glossarystyle{longragged}
  % with ``I'd like to change the identication of the first column''
  % you presumably mean you want the table to fill the line width?
  \renewenvironment{theglossary}%
     {\begin{longtabu} to \linewidth {X[2l]X[8p]}}%
     {\end{longtabu}}%
  % renew the entry field to make the entries bold by adding \bfseries:
  \renewcommand*{\glossaryentryfield}[5]{%
    \bfseries\glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5%
    \tabularnewline}%
  % renew the entry field for sub entries; make them non bold indented
  % versions of the main entries:
  \renewcommand*{\glossarysubentryfield}[6]{%
    \quad\glssubentryitem{##2}\glstarget{##2}{##3} & ##4\glspostdescription\space ##6%
    \tabularnewline}%
}
\glossarystyle{mylongragged}

\begin{document}

\glsaddall
\printglossary

\end{document}

enter image description here

Related Question