> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/zh-cn/wen-dang-jie-gou/06-nomenclatures.md).

# 术语表

## 引言

缩写和符号列表在许多科学文档中很常见。这类列表可以使用 LaTeX 通过……来创建 `nomencl` 包。本文解释如何创建符号表，以及如何自定义符号的排序和分组。

术语表条目的工作方式与索引条目非常相似：

```latex
\documentclass{article}
\usepackage{nomencl}
\makenomenclature

\begin{document}
下面是一个示例：
\nomenclature{\(c\)}{真空中的光速}
\nomenclature{\(h\)}{普朗克常数}

\printnomenclature
\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=nomencl+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bnomencl%7D%0A%5Cmakenomenclature%0A%0A%5Cbegin%7Bdocument%7D%0AHere+is+an+example%3A%0A%5Cnomenclature%7B%5C%28c%5C%29%7D%7BSpeed+of+light+in+a+vacuum%7D%0A%5Cnomenclature%7B%5C%28h%5C%29%7D%7BPlanck+constant%7D%0A%0A%5Cprintnomenclature%0A%5Cend%7Bdocument%7D)

![Nomenclatures01OLV2.png](/files/bf6ac9afd887654d924a407b8a9eb7bafb4cab3e)

通常，包会在导言区通过 `\usepackage{nomencl}`。生成符号表的三个基本命令是：

* `\makenomenclature`。通常在导入包后立即放置。
* `\nomenclature`。用于定义符号表条目本身。它接受两个参数：符号及其对应的描述。
* `\printnomenclatures`。该命令将打印符号表列表。

## 基本语法

在导入 `nomencl` 包时还可以使用其他选项。下一个示例展示了如何将符号表加入目录，以及如何更改默认语言：

```latex
\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[intoc, spanish]{nomencl}
\makenomenclature

\begin{document}
\tableofcontents

\section{Primera Sección}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortisfacilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdie...

\nomenclature{\(c\)}{真空中的光速}
\nomenclature{\(h\)}{普朗克常数}

\printnomenclature
\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=nomencl+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Bspanish%5D%7Bbabel%7D%0A%5Cusepackage%5Bintoc%2C+spanish%5D%7Bnomencl%7D%0A%5Cmakenomenclature%0A%0A%5Cbegin%7Bdocument%7D%0A%5Ctableofcontents%0A%0A%5Csection%7BPrimera+Secci%C3%B3n%7D%0A%0ALorem+ipsum+dolor+sit+amet%2C+consectetuer+adipiscing+elit.+Etiam+lobortisfacilisis+sem.+Nullam+nec+mi+et+neque+pharetra+sollicitudin.+Praesent+imperdie...%0A%0A%5Cnomenclature%7B%5C%28c%5C%29%7D%7BSpeed+of+light+in+a+vacuum%7D%0A%5Cnomenclature%7B%5C%28h%5C%29%7D%7BPlanck+constant%7D%0A%0A%5Cprintnomenclature%0A%5Cend%7Bdocument%7D)

![Nomenclatures02OLV2.png](/files/1f15590916f6bbdffd473e86f10fd6b9f63e31b5)

这里在导入包时使用的附加选项是：

* `intoc` 将 **符号表** 添加到目录中。
* `西班牙语` 更改语言，相应地翻译默认标题 *Nomenclatures* 。支持的语言有： `克罗地亚语`, `丹麦语`, `english`, `法语`, `德语`, `意大利语`, `波兰语`, `葡萄牙语`, `russian`, `西班牙语` 和 `乌克兰语`.

该 `nomencl` 包的其他有用功能包括可以手动设置符号表标题，以及添加附加注释。

```latex
\documentclass{article}
\usepackage{nomencl}
\makenomenclature

\renewcommand{\nomname}{符号列表}

\renewcommand{\nompreamble}{下一列表将描述若干符号，这些符号稍后会在文档正文中使用}

\begin{document}
下面是一个示例：

\nomenclature{\(c\)}{真空中的光速}
\nomenclature{\(h\)}{普朗克常数}

\printnomenclature
\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=nomencl+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bnomencl%7D%0A%5Cmakenomenclature%0A%0A%5Crenewcommand%7B%5Cnomname%7D%7BList+of+Symbols%7D%0A%0A%5Crenewcommand%7B%5Cnompreamble%7D%7BThe+next+list+describes+several+symbols+that+will+be+later+used+within+the+body+of+the+document%7D%0A%0A%5Cbegin%7Bdocument%7D%0AHere+is+an+example%3A%0A%0A%5Cnomenclature%7B%5C%28c%5C%29%7D%7BSpeed+of+light+in+a+vacuum%7D%0A%5Cnomenclature%7B%5C%28h%5C%29%7D%7BPlanck+constant%7D%0A%0A%5Cprintnomenclature%0A%5Cend%7Bdocument%7D)

![Nomenclatures03verbOLV2.png](/files/091c2125df087aef6d262a8755c8924601152c94)

这一行

```
\renewcommand{\nomname}{符号列表}
```

更改默认标题。

命令

```
\renewcommand{\nompreamble}{下一列表...}
```

在标题和符号列表之间插入一些文字。

## 分组

要根据类型对符号进行分组，还需要做一些额外工作。我们给每个符号添加一个前缀，并使用 `etoolbox` 包来比较这些前缀。

```latex
\documentclass{article}
\usepackage{amssymb}
\usepackage{nomencl}
\makenomenclature

%% 这段代码创建这些组
% -----------------------------------------
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{P}{物理常数}{%
  \ifstrequal{#1}{N}{数集}{%
  \ifstrequal{#1}{O}{其他符号}{}}}%
]}
% -----------------------------------------

\begin{document}
下面是一个示例：

\nomenclature[P]{\(c\)}{真空中的光速}
\nomenclature[P]{\(h\)}{普朗克常数}
\nomenclature[P]{\(G\)}{万有引力常数}
\nomenclature[N]{\(\mathbb{R}\)}{实数}
\nomenclature[N]{\(\mathbb{C}\)}{复数}
\nomenclature[N]{\(\mathbb{H}\)}{四元数}
\nomenclature[O]{\(V\)}{恒定体积}
\nomenclature[O]{\(\rho\)}{摩擦指数}

\printnomenclature
\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=nomencl+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamssymb%7D%0A%5Cusepackage%7Bnomencl%7D%0A%5Cmakenomenclature%0A%0A%25%25+This+code+creates+the+groups%0A%25+-----------------------------------------%0A%5Cusepackage%7Betoolbox%7D%0A%5Crenewcommand%5Cnomgroup%5B1%5D%7B%25%0A++%5Citem%5B%5Cbfseries%0A++%5Cifstrequal%7B%231%7D%7BP%7D%7BPhysics+constants%7D%7B%25%0A++%5Cifstrequal%7B%231%7D%7BN%7D%7BNumber+sets%7D%7B%25%0A++%5Cifstrequal%7B%231%7D%7BO%7D%7BOther+symbols%7D%7B%7D%7D%7D%25%0A%5D%7D%0A%25+-----------------------------------------%0A%0A%5Cbegin%7Bdocument%7D%0AHere+is+an+example%3A%0A%0A%5Cnomenclature%5BP%5D%7B%5C%28c%5C%29%7D%7BSpeed+of+light+in+a+vacuum%7D%0A%5Cnomenclature%5BP%5D%7B%5C%28h%5C%29%7D%7BPlanck+constant%7D%0A%5Cnomenclature%5BP%5D%7B%5C%28G%5C%29%7D%7BGravitational+constant%7D%0A%5Cnomenclature%5BN%5D%7B%5C%28%5Cmathbb%7BR%7D%5C%29%7D%7BReal+numbers%7D%0A%5Cnomenclature%5BN%5D%7B%5C%28%5Cmathbb%7BC%7D%5C%29%7D%7BComplex+numbers%7D%0A%5Cnomenclature%5BN%5D%7B%5C%28%5Cmathbb%7BH%7D%5C%29%7D%7BQuaternions%7D%0A%5Cnomenclature%5BO%5D%7B%5C%28V%5C%29%7D%7BConstant+volume%7D%0A%5Cnomenclature%5BO%5D%7B%5C%28%5Crho%5C%29%7D%7BFriction+index%7D%0A%0A%5Cprintnomenclature%0A%5Cend%7Bdocument%7D)

![Nomenclatures04OLV2.png](/files/04343844d490d1f56c43455624e715ddb7e72587)

这里添加了一些额外的组。实现这部分的代码并不那么简单，它使用了命令 `\ifstrequal{}{}{}{}`，前两个参数是要比较的字符串；如果它们相等，则将该术语添加到该组，否则检查下一个嵌套条件。

请注意，现在每个 `\nomenclature` 命令都有一个附加参数，即方括号中的前缀；它用于分组代码中。

如果 `etoolbox` 如果不可用，可以改用 `ifthen` 包，它提供条件语句 `\ifthenelse{}{}{}`，但语法稍微复杂一些：

```latex
\usepackage{ifthen}
  \renewcommand{\nomgroup}[1]{%
  \item[\bfseries
  \ifthenelse{\equal{#1}{P}}{物理常数}{%
  \ifthenelse{\equal{#1}{O}}{其他符号}{%
  \ifthenelse{\equal{#1}{N}}{数集}{}}}%
  ]}
```

这样会生成相同的符号表分组。

## 为物理常数添加单位

另一个有趣的功能是使用 `siunitx` 包添加单位，并将它们对齐到对应条目的右侧。为此，需要定义 `nomunit` 宏，如下例所示：

```latex
\documentclass{article}
\usepackage{amssymb}
\usepackage{nomencl}
\usepackage{siunitx}
\usepackage{hyperref}
\makenomenclature
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
}
%% 这将添加子组
%----------------------------------------------
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{A}{物理常数}{%
  \ifstrequal{#1}{B}{数集}{%
  \ifstrequal{#1}{C}{其他符号}{}}}%
]}
%----------------------------------------------

%% 这将添加单位
%----------------------------------------------
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
%----------------------------------------------

\title{符号表示例}
\author{Overleaf 团队}
\date{\today}

\begin{document}
\maketitle

\noindent 这是一个示例，用来展示 \texttt{nomencl} 包如何工作，单位通过 \texttt{siunitx} 包排版。参考了 \href{https://www.nist.gov/pml/fundamental-physical-constants}{NIST} 提供的物理常数数值及其对应单位——链接通过 \texttt{hyperref} 包给出：

\nomenclature[A, 02]{\(c\)}{\href{https://physics.nist.gov/cgi-bin/cuu/Value?c}
{真空中的光速}
\nomunit{\SI{299792458}{\meter\per\second}}}
\nomenclature[A, 03]{\(h\)}{\href{https://physics.nist.gov/cgi-bin/cuu/Value?h}
{普朗克常数}
\nomunit{\SI[group-digits=false]{6.62607015e-34}{\joule\per\hertz}}}
\nomenclature[A, 01]{\(G\)}{\href{https://physics.nist.gov/cgi-bin/cuu/Value?bg}
{万有引力常数}
\nomunit{\SI[group-digits=false]{6.67430e-11}{\meter\cubed\per\kilogram\per\second\squared}}}
\nomenclature[B, 03]{\(\mathbb{R}\)}{实数}
\nomenclature[B, 02]{\(\mathbb{C}\)}{复数}
\nomenclature[B, 01]{\(\mathbb{H}\)}{四元数}
\nomenclature[C]{\(V\)}{恒定体积}
\nomenclature[C]{\(\rho\)}{摩擦指数}

\printnomenclature

\end{document}
```

[在 Overleaf 中打开（使用 `nomencl` 和 `siunitx` 包的示例）。](/latex/zh-cn/wen-dang-jie-gou/06-nomenclatures.md)

![Nomcomplex.png](/files/32f510788cf158bedc1855f6d41bd55a78dccac2)

## 条目排序

这是默认的排序顺序：

```latex
\documentclass{article}
\usepackage{nomencl}

\makenomenclature

\begin{document}
下面是一个示例：

\nomenclature{\(+a\)}{运算符}
\nomenclature{\(2a\)}{数字}
\nomenclature{\(:a\)}{标点符号}
\nomenclature{\(Aa\)}{大写字母}
\nomenclature{\(aa\)}{小写字母}
\nomenclature{\(\alpha\)}{希腊字符}

\printnomenclature

\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=nomencl+default+sort+order\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bnomencl%7D%0A%0A%5Cmakenomenclature%0A%0A%5Cbegin%7Bdocument%7D%0AHere+is+an+example%3A%0A%0A%5Cnomenclature%7B%5C%28%2Ba%5C%29%7D%7BOperator%7D%0A%5Cnomenclature%7B%5C%282a%5C%29%7D%7BNumber%7D%0A%5Cnomenclature%7B%5C%28%3Aa%5C%29%7D%7BPunctuation+symbol%7D%0A%5Cnomenclature%7B%5C%28Aa%5C%29%7D%7BUppercase+letter%7D%0A%5Cnomenclature%7B%5C%28aa%5C%29%7D%7BLowercase+letter%7D%0A%5Cnomenclature%7B%5C%28%5Calpha%5C%29%7D%7BGreek+character%7D%0A%0A%5Cprintnomenclature%0A%0A%5Cend%7Bdocument%7D)

![Nomenclatures05OLV2.png](/files/6e82213ace2bf14dbe05a01d07024808e076f971)

请注意，由于反斜杠，希腊字符出现在字母字符之前 `\` 在 `\alpha`.

和分组一样，也可以使用前缀手动对符号表条目排序：

```latex
\documentclass{article}
\usepackage{nomencl}

\makenomenclature

\begin{document}
下面是一个示例：

\nomenclature[06]{\(+a\)}{运算符}
\nomenclature[03]{\(2a\)}{数字}
\nomenclature[05]{\(:a\)}{标点符号}
\nomenclature[04]{\(Aa\)}{大写字母}
\nomenclature[01]{\(aa\)}{小写字母}
\nomenclature[02]{\(\alpha\)}{希腊字符}

\printnomenclature

\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Sorting+nomencl+entries\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bnomencl%7D%0A%0A%5Cmakenomenclature%0A%0A%5Cbegin%7Bdocument%7D%0AHere+is+an+example%3A%0A%0A%5Cnomenclature%5B06%5D%7B%5C%28%2Ba%5C%29%7D%7BOperator%7D%0A%5Cnomenclature%5B03%5D%7B%5C%282a%5C%29%7D%7BNumber%7D%0A%5Cnomenclature%5B05%5D%7B%5C%28%3Aa%5C%29%7D%7BPunctuation+symbol%7D%0A%5Cnomenclature%5B04%5D%7B%5C%28Aa%5C%29%7D%7BUppercase+letter%7D%0A%5Cnomenclature%5B01%5D%7B%5C%28aa%5C%29%7D%7BLowercase+letter%7D%0A%5Cnomenclature%5B02%5D%7B%5C%28%5Calpha%5C%29%7D%7BGreek+character%7D%0A%0A%5Cprintnomenclature%0A%0A%5Cend%7Bdocument%7D)

![Nomenclatures06OLV2.png](/files/39e329280bebcad2cc18d40cc8984d656f400c4e)

方括号中的数字决定相应符号的打印顺序。也可以将分组与手动排序结合起来：

```latex
\documentclass{article}
\usepackage{amssymb}
\usepackage{nomencl}
\makenomenclature

\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{A}{物理常数}{%
  \ifstrequal{#1}{B}{数集}{%
  \ifstrequal{#1}{C}{其他符号}{}}}%
]}

\begin{document}
下面是一个示例：

\nomenclature[A, 02]{\(c\)}{真空中的光速}
\nomenclature[A, 03]{\(h\)}{普朗克常数}
\nomenclature[A, 01]{\(G\)}{万有引力常数}
\nomenclature[B, 03]{\(\mathbb{R}\)}{实数}
\nomenclature[B, 02]{\(\mathbb{C}\)}{复数}
\nomenclature[B, 01]{\(\mathbb{H}\)}{八元数}
\nomenclature[C]{\(V\)}{恒定体积}
\nomenclature[C]{\(\rho\)}{摩擦指数}

\printnomenclature

\end{document}
```

[在 Overleaf 中打开此 `nomencl` Overleaf 中的示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Grouping+and+sorting+with+nomencl\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamssymb%7D%0A%5Cusepackage%7Bnomencl%7D%0A%5Cmakenomenclature%0A%0A%5Cusepackage%7Betoolbox%7D%0A%5Crenewcommand%5Cnomgroup%5B1%5D%7B%25%0A++%5Citem%5B%5Cbfseries%0A++%5Cifstrequal%7B%231%7D%7BA%7D%7BPhysics+Constants%7D%7B%25%0A++%5Cifstrequal%7B%231%7D%7BB%7D%7BNumber+Sets%7D%7B%25%0A++%5Cifstrequal%7B%231%7D%7BC%7D%7BOther+Symbols%7D%7B%7D%7D%7D%25%0A%5D%7D%0A%0A%5Cbegin%7Bdocument%7D%0AHere+is+an+example%3A%0A%0A%5Cnomenclature%5BA%2C+02%5D%7B%5C%28c%5C%29%7D%7BSpeed+of+light+in+a+vacuum%7D%0A%5Cnomenclature%5BA%2C+03%5D%7B%5C%28h%5C%29%7D%7BPlanck+constant%7D%0A%5Cnomenclature%5BA%2C+01%5D%7B%5C%28G%5C%29%7D%7BGravitational+constant%7D%0A%5Cnomenclature%5BB%2C+03%5D%7B%5C%28%5Cmathbb%7BR%7D%5C%29%7D%7BReal+numbers%7D%0A%5Cnomenclature%5BB%2C+02%5D%7B%5C%28%5Cmathbb%7BC%7D%5C%29%7D%7BComplex+numbers%7D%0A%5Cnomenclature%5BB%2C+01%5D%7B%5C%28%5Cmathbb%7BH%7D%5C%29%7D%7BOctonions%7D%0A%5Cnomenclature%5BC%5D%7B%5C%28V%5C%29%7D%7BConstant+volume%7D%0A%5Cnomenclature%5BC%5D%7B%5C%28%5Crho%5C%29%7D%7BFriction+index%7D%0A%0A%5Cprintnomenclature%0A%0A%5Cend%7Bdocument%7D)

![Nomenclatures07OLV2.png](/files/facc37ce9c669802d2eef94e72a06c32450f3ba8)

请注意，用于分组的大写字母与上一节示例中使用的不同，因为该字母用于对各组进行排序。

## 延伸阅读

更多信息请参见：

* [术语表](/latex/zh-cn/wen-dang-jie-gou/05-glossaries.md)
* [多文件 LaTeX 项目](/latex/zh-cn/wen-dang-jie-gou/08-multi-file-latex-projects.md)
* [文本对齐](/latex/zh-cn/ge-shi-hua/06-text-alignment.md)
* [加粗、斜体和下划线](/latex/zh-cn/latex-ji-chu/03-bold-italics-and-underlining.md)
* [数学表达式](/latex/zh-cn/shu-xue/01-mathematical-expressions.md)
* [创建和重新定义宏](/latex/zh-cn/ming-ling/01-commands.md)
* [`nomencl` 包文档](http://mirror.jmu.edu/pub/CTAN/macros/latex/contrib/nomencl/nomencl.pdf)
* [`ifthen` 包文档](http://texdoc.net/texmf-dist/doc/latex/base/ifthen.pdf)
* [`etoolbox` 包文档](http://mirror.math.ku.edu/tex-archive/macros/latex/contrib/etoolbox/etoolbox.pdf)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/zh-cn/wen-dang-jie-gou/06-nomenclatures.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
