是否有人知道如何将树状风格词汇表中的条目名称格式更改为 indexhypergroup 风格?
那里的默认字体似乎是粗体、衬线字体。我想保留粗体,但无衬线,也用于子条目和子子条目名称。
正如在词汇表-用户手册,我已经尝试过了
\renewcommand{\glsnamefont}[1]{\textsf{\mdseries #1}}
以及
\renewcommand{\glstreenamefmt}[1]{\textsf{\textbf{\mdseries #1}}}
然而,没有成功。无衬线字体可以工作,但条目不再是粗体。我做错了什么?
梅威瑟:
\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
更新后续跟进
使用更新的 MWE 添加
\renewcommand*{\glstreenamefmt}[1]{{\sffamily \bfseries #1}}
前\begin{document}
缩略词页面将不会被修改。
这是完整的代码。
\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}