我该如何解决这个问题?两个列表上都有重复的定义:
以下是我的 packages.tex 中的内容:
\usepackage[abbreviations,style=alttreegroup,record,nomain,symbols]{glossaries-extra}
\renewcommand\glstreegroupheaderfmt[1]{\begingroup\centering \textbf{#1}\par\endgroup}
\glsxtrsetgrouptitle{segundo}{Conjuntos}
\glsxtrsetgrouptitle{tercero}{Indexación}
\glsxtrsetgrouptitle{cuarto}{C\'alculo}
\glsxtrsetgrouptitle{quinto}{Probabilidad}
\glsxtrsetgrouptitle{sexto}{Funciones}
\glsxtrsetgrouptitle{sep}{Conjuntos de datos y distrubuciones}
\renewcommand{\glossarypreamble}{The following list describes various notations and symbols that will later be used within the body of the document, unless we redefine the notations based on context.}
这就是我在 main.tex 文件中的内容:
\glsfindwidesttoplevelname
\printunsrtglossary[type=symbols, title = List of Symbols ]
\printunsrtglossary[type=abbreviations,title = List of Abbreviations]
MWE(鸣谢利安德里斯)
\documentclass{report}
\usepackage[colorlinks]{hyperref}
\usepackage[record,style=alttreegroup,nomain,symbols]{glossaries-extra}
\glsxtrnewsymbol[description={position}, group={first}]{x}{\ensuremath{x}}
\glsxtrnewsymbol[description={velocity}, group={first}]{v}{\ensuremath{v}}
\glsxtrnewsymbol[description={acceleration}, group={second}]{a}{\ensuremath{a}}
\glsxtrnewsymbol[description={time}, group={second}]{t}{\ensuremath{t}}
\glsxtrnewsymbol[description={force}, group={second}]{F}{\ensuremath{F}}
\renewcommand\glstreegroupheaderfmt[1]{\begingroup\centering \textbf{#1}\par\endgroup}
\glsfindwidesttoplevelname
\glsxtrsetgrouptitle{first}{Numbers and Arrays}
\glsxtrsetgrouptitle{second}{Sets}
\begin{document}
\tableofcontents
\printunsrtglossaries
\chapter{Sample}
Reference symbols: $\gls{x}$, $\gls{v}$, $\gls{a}$, $\gls{t}$,
$\gls{F}$.
\end{document}
答案1
来自glossaries
用户手册:
因此,如果您只希望序言文本仅显示在符号列表中,则可以使用
\setglossarypreamble[symbols]{The following list describes various notations and symbols that will later be used within the body of the document, unless we redefine the notations based on context.}
代替\renewcommand{\glossarypreamble}{The...}
。
如果您还想在缩写列表中使用不同的非空文本,请添加\setglossarypreamble[abbreviations]{...}
。