假设有一个方程 e = m * c^2 现在我想将每个变量定义为: 其中,e = .. m = ... c = ..... 这可以使用方程环境来实现。但问题是,有没有办法定义 e、m 和 c,以便在我使用 \makeglossary 时它们会自动添加到词汇表中?
问问题
2499 次
1 回答
4
使用词汇表包,我们可以在显示词汇表条目的同时编写一个命令来定义它,如下所示:
\documentclass{report}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries}
\makeglossaries
\newcommand{\mathgloss}[2]{
\newglossaryentry{#1}{name={#1},description={#2}}
\gls{#1} = #2
}
\begin{document}
Consider the equation
\begin{equation}
e = m * c^2
\end{equation}
in which\\
\mathgloss{e}{energy}\\
\mathgloss{m}{mass}\\
\mathgloss{c}{speed of light}
\printglossaries
\end{document}
您可以编辑\mathgloss
命令以匹配您喜欢的格式样式。
于 2011-01-19T22:30:30.303 回答