假设有一个方程 e = m * c^2 现在我想将每个变量定义为: 其中,e = .. m = ... c = ..... 这可以使用方程环境来实现。但问题是,有没有办法定义 e、m 和 c,以便当我使用 \makeglossary 时它们会自动添加到术语表中?
使用词汇表包,我们可以编写一个命令来定义词汇表条目,同时显示它,如下所示:
\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}
Run Code Online (Sandbox Code Playgroud)
您可以编辑该\mathgloss命令以匹配您喜欢的格式样式。
| 归档时间: |
|
| 查看次数: |
2693 次 |
| 最近记录: |