我第一次在论文文档中使用词汇表包。一切都适用于简单的符号,例如
\newglossaryentry{Ndist}{name=$\mathcal{N}$, description={normal distribution}}
但是当我尝试像这样定义正态分布时
\newglossaryentry{Ndist}{name=$\mathcal{N}(0,\sigma^2)$, description={normal distribution of mean zero and variance $\sigma^2$}}
我收到错误,包括:
Missing \endcsname inserted. ...ion of mean zero and variance $\sigma^2$}}
Package xkeyval Error: `\sigma ^2)$' undefined in families `glossentry'. ...ion of mean zero and variance $\sigma^2$}}
Missing $ inserted. ...tentrycounter[]{page}\glsnumberformat{20}}}
Missing $ inserted. ...from the normal distribution, \gls{Ndist},
Overriding \printglossary
Overriding `theglossary' environment
...
在这两种情况下我都会收到此警告,但不确定它是否重要:
name{glo:Ndist} has been referenced but does not exist, replaced by a fixed one
答案1
正如您所怀疑的,问题出在名称中的逗号,因为glossaries
它被用作定义字段之间的分隔符。只需将值括name
在花括号中即可解决问题:
\newglossaryentry{Ndist}{
name={$\mathcal{N}(0,\sigma^2)$},
description={normal distribution of mean zero and variance $\sigma^2$}
}