> 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-tw/wen-jian-jie-gou/06-nomenclatures.md).

# 術語表

## 簡介

縮寫與符號的列表在許多科學文件中很常見。這類列表可透過 LaTeX 使用 `nomencl` 套件建立。本文說明如何建立術語表，並自訂符號的排序與分組。

術語表條目的運作方式與索引條目相當類似：

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

\begin{document}
範例如下：
\nomenclature{\(c\)}{真空中的光速}
\nomenclature{\(h\)}{普朗克常數}

\printnomenclature
\end{document}
```

[在 Overleaf 中開啟這個 `nomencl` 範例](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/4b07247f344d58bbdf52b26b8aae1616b1bc9fcf)

如往常一樣，套件是在導言區透過以下方式匯入： `\usepackage{nomencl}`。產生術語表的三個基本指令是：

* `\makenomenclature`。通常會放在匯入套件之後立即使用。
* `\nomenclature`。用來定義術語表條目本身。接受兩個引數：符號與對應說明。
* `\printnomenclatures`。此指令會列印術語表清單。

## 基本語法

在匯入 `nomencl` 套件時還可以使用其他選項。下一個範例示範如何將術語表加入目錄，以及如何變更預設語言：

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

\begin{document}
\tableofcontents

\section{第一節}

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` 範例](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/3b51b57a1fd32b1326170b8ea92d8eb85805a502)

此處在匯入套件時使用的額外選項為：

* `intoc` 將 **術語表** 加入目錄。
* `西班牙文` 變更語言，將預設標題 *術語表* 相應翻譯。支援的語言有： `克羅埃西亞文`, `丹麥文`, `english`, `french`, `德文`, `義大利文`, `波蘭文`, `葡萄牙文`, `russian`, `西班牙文` 和 `烏克蘭文`.

套件的其他實用功能包括 `nomencl` 手動設定術語表標題，以及新增額外註解的可能性。

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

\renewcommand{\nomname}{符號清單}

\renewcommand{\nompreamble}{下一個清單將描述多個之後會在本文中使用的符號}

\begin{document}
範例如下：

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

\printnomenclature
\end{document}
```

[在 Overleaf 中開啟這個 `nomencl` 範例](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/9482eaf7c7e85de2c16302f63fddf6781e26d9a0)

這一行

```
\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` 範例](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/74f1587ae716294092b87d8f0f71f456ecab5648)

這裡加入了一些額外的群組。這段程式碼沒那麼簡單，它使用了指令 `\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-tw/wen-jian-jie-gou/06-nomenclatures.md)

![Nomcomplex.png](/files/05a6165ba668dbda697e7cfd6bf4643b921a95e5)

## 條目排序

這是預設排序順序：

```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` 範例](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/81b827a8bda7b502bbcce83b11ceaaa0d3b0a4f7)

請注意，由於反斜線的緣故，希臘字元會出現在字母字元之前 `\\` 中插入一個 `\\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` 範例](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/10f398db976a027e92b8eebd547e1b57622f7dd9)

方括號中的數字決定對應符號的列印順序。也可以將分組與手動排序結合：

```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` 範例](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/209ba4058ed77708f2d4733664db115ce4e2fdd0)

請注意，用於分組的大寫字母與上一節範例中的不同，因為該字母是用來排序群組的。

## 延伸閱讀

詳情請見：

* [詞彙表](/latex/zh-tw/wen-jian-jie-gou/05-glossaries.md)
* [多檔案 LaTeX 專案](/latex/zh-tw/wen-jian-jie-gou/08-multi-file-latex-projects.md)
* [文字對齊](/latex/zh-tw/ge-shi-hua/06-text-alignment.md)
* [粗體、斜體與底線](/latex/zh-tw/latex-ji-chu/03-bold-italics-and-underlining.md)
* [數學表達式](/latex/zh-tw/shu-xue/01-mathematical-expressions.md)
* [建立與重新定義巨集](/latex/zh-tw/zhi-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-tw/wen-jian-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.
