LaTeX增加术语表(符号解释)Nomenclatures

比如在论文写作中我们想要在手稿中增加以上图片类似的术语解释,可以使用以下步骤:

1. 在导言区加入:

\usepackage{nomencl}

\makenomenclature

2.在你想放置术语表的地方加入:

\printnomenclature
\nomenclature{\(c\)}{Speed of light in a vacuum}
\nomenclature{\(h\)}{Planck constant} 
\nomenclature{\(c\)}{Speed of light in a vacuum}
\nomenclature{\(h\)}{Planck constant}
\nomenclature{\(c\)}{Speed of light in a vacuum}
\nomenclature{\(h\)}{Planck constant}

注:\printnomenclature是把术语表打印出来,而\nomenclature的使用方法就是\nomenclature{你的符号}{你的解释}

但是这个时候编译pdf并无任何效果!

3.编译后在文章根目录会发现出现.nlo的文件

4.打开cmd命令窗口(快捷键:win+R),使用cmd命令切换到文章的目录下(具体搜索cmd命令教程)

5.然后输入命令:makeindex AE.nlo -s nomencl.ist -o AE.nls (AE需要替换你文件的名字)

6.重新编译LateX发现已生成术语表

7.导言区加入命令:\usepackage{tcolorbox}

8.把之前的用以下命令套起来(begin和end前别忘了加个\,我在这里加了会显示不出这里的代码)

begin{tcolorbox}[colback=white,colframe=black]
        之前的命令(第二步的那些命令)
end{tcolorbox}

9.重新编译,大功告成!

完整代码:       
9.1 导言区所需宏包:

\usepackage{nomencl}
\usepackage{tcolorbox}
\usepackage{multicol}
\makenomenclature

9.2 (begin和end前别忘了加个\)

begin{tcolorbox}[colback=white,colframe=black]
    begin{multicols}{2}
    \printnomenclature
    end{multicols}
    \nomenclature[001]{A}{Speed of light in a vacuum}
    \nomenclature[002]{B}{Planck constant} 
    \nomenclature[003]{C}{Speed of light in a vacuum}
    \nomenclature[004]{D}{Planck constant}
    \nomenclature[005]{E}{Speed of light in a vacuum}
    \nomenclature[006]{F}{Planck constant}
end{tcolorbox}

其他操作1:如果单栏环境中使用双列术语表怎么办呢?

(1)在导言区加入命令:\usepackage{multicol}

(2)然后使用以下命令把\printnomenclature套起来即可(\printnomenclature是把术语表打印出来,之前提过)。此外,2可以改成3,4等等,改成几就是几列 (begin和end前别忘了加个\,我在这里加了会显示不出这里的代码)

begin{multicols}{2}
\printnomenclature
end{multicols}

其他操作2:术语表中的符号是乱排的没有按照列出的顺序排列怎么办?

(1)删除已生成的部分文件(不要乱删,按修改日期排一下顺序,删除最新生成的,不要删.tex文件)

(2)然后在之前的命令前加序号,如:

\nomenclature[001]{\(c\)}{Speed of light in a vacuum}
\nomenclature[002]{\(h\)}{Planck constant} 
\nomenclature[003]{\(c\)}{Speed of light in a vacuum}
\nomenclature[004]{\(h\)}{Planck constant}
\nomenclature[005]{\(c\)}{Speed of light in a vacuum}
\nomenclature[006]{\(h\)}{Planck constant}

(3)编译tex文件

(4)执行第5步(cmd命令那一步)

(5)再编译tex文件即可

注:每次对术语表的更改都需要重新编译手稿来生成新的.nlo文件,然后进行第5步(不然术语表不会改变)

### 解决 LaTeX术语表 (Nomenclatures) 文字不显示的问题 在使用 `nomencl` 宏包创建术语表时,如果发现术语表中的文字未正常显示,则可能是由于以下几个常见原因引起的。 #### 1. 配置文件设置错误 确保文档类和宏包已正确定义。通常需要加载 `nomencl` 宏包并激活它。例如,在导言区应有如下配置: ```latex \usepackage[intoc]{nomencl} % 将术语表加入目录 \makenomenclature % 初始化术语表功能 ``` 上述命令用于引入 `nomencl` 并初始化其功能[^1]。 #### 2. 编译流程问题 为了生成术语表,必须按照特定顺序执行编译操作。标准的编译过程通常是: - 运行一次 PDFLaTeX 或 XeLaTeX; - 执行 `makeindex` 命令来处理 `.nlo` 文件并生成 `.nls` 文件; - 再次运行两次 PDFLaTeX 或 XeLaTeX 来更新交叉引用和术语表内容。 具体命令可以是: ```bash pdflatex yourfile.tex makeindex yourfile.nlo -s nomencl.ist -o yourfile.nls pdflatex yourfile.tex pdflatex yourfile.tex ``` 如果没有正确遵循此流程,可能会导致术语表无法显示或仅部分显示[^2]。 #### 3. 添加条目方式不当 当向术语表中添加新条目时,需使用 `\nomenclature{符号}{描述}` 的形式定义每个条目,并通过 `\printnomenclature` 输出整个列表。例如: ```latex \nomenclature{$c$}{Speed of light in a vacuum, $299,\!792,\!458~\mathrm{m/s}$} ... \printnomenclature ``` 如果遗漏了这些调用或者拼写错误,也可能造成术语表为空[^3]。 #### 4. 字体编码冲突 某些情况下,字体编码可能影响特殊字符的表现效果。建议检查是否设置了合适的输入法支持以及对应的 T1 字体编码选项: ```latex \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} ``` 这一步有助于避免因字符集差异而导致的内容丢失现象[^4]。 --- ### 示例代码片段 下面提供了一个完整的最小工作示例(MWE),展示如何正确实现带术语表的文档结构: ```latex \documentclass[a4paper,10pt]{article} % 导入必要的宏包 \usepackage[intoc]{nomencl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} % 初始化术语表环境 \makenomenclature \begin{document} \section*{Introduction} This is an example document demonstrating the use of \texttt{nomencl}. We define some terms here: \nomenclature{$a$}{Constant used in equation (\ref{eq:example})} The speed of light \( c \approx 299,\!792,\!458~\mathrm{m/s}\). \nomenclature{$c$}{Speed of light in a vacuum} Here's our main formula: \begin{equation} E=mc^2 \label{eq:example} \end{equation} Finally, we generate and display the nomenclature. \printnomenclature \end{document} ``` ---
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值