如何更改词汇表 alttree:第二级无粗体字体

如何更改词汇表 alttree:第二级无粗体字体

我如何修改词汇表,例如alttree样式,使第二级条目不使用粗体字体。第一级应保持粗体。

我想这样做

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

但我不知道“更新”的命令

PS:使用longragged样式会更合适。在这种情况下,我想更改第一列的标识,并将第一级条目设为粗体。

答案1

如果你看一下词汇表.pdf或者glossary-longragged.sty你会发现以下词汇表样式的定义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}%
}

现在您需要做的是以不同的方式更改您想要的定义:

\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}

在此处输入图片描述

相关内容