Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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

share|improve this answer
    
Would you mind giving an example with two levels? That is what I am searching for. Thanks anyway for the solution given above –  louis cypher Nov 1 '12 at 0:17
    
@louiscypher see the edit. Does that help you? –  cgnieder Nov 1 '12 at 14:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.