LaTeX 术语表 Glossaries
原 文:Glossaries
译 者:Xovee
翻译时间:2021年7月7日
术语表
在撰写科技文章的时候,我们有时候需要一个术语表来将文章中的一些特定领域的概念进行汇总,以方便读者查看。术语表由一系列特定领域的术语和它们的定义所组成。本文介绍如何使用 LaTeX 来创建术语表。
文章目录 术语表介绍术语和缩略语 Terms and Acronyms术语 Terms缩略语 Acronyms改变术语表的标题在目录中显示术语表编译术语表 参考指南介绍
首先来看一个简单的例子:
documentclass{article} usepackage[utf8]{inputenc} usepackage{glossaries} makeglossaries newglossaryentry{latex} { name=latex, description={Is a mark up language specially suited for scientific documents} } newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } title{How to create a glossary} author{ } date{ } begin{document} maketitle The Gls{latex} typesetting markup language is specially suitable for documents that include gls{maths}. clearpage printglossaries end{document}
latex
12345678910111213141516171819202122232425262728293031323334
我们首先在文档的 preamble 引入glossaries包:
usepackage{glossaries}
latex
1命令makeglossaries必须位于第一个术语条目之前。
每一个术语条目由命令newglossaryentry创建,它拥有两个参数。每个条目可以在之后的内容中使用命令gls进行引用。
命令printglossaries会在文档中打印出我们所创建的术语表,它的标题为Glossary。在上面的例子中,它显示在文档的末尾。你可以在文档的任何位置打印术语表。
术语和缩略语 Terms and Acronyms
在术语表中一般有两种类型的条目:
术语(term)和它们的定义缩略语(acronym)和它们的全称这两种类型的条目可以分别地在文档中进行显示。
documentclass{article} usepackage[utf8]{inputenc} usepackage[acronym]{glossaries} makeglossaries newglossaryentry{latex} { name=latex, description={Is a mark up language specially suited for scientific documents} } newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } newglossaryentry{formula} { name=formula, description={A mathematical expression} } newacronym{gcd}{GCD}{Greatest Common Divisor} newacronym{lcm}{LCM}{Least Common Multiple} begin{document} The Gls{latex} typesetting markup language is specially suitable for documents that include gls{maths}. Glspl{formula} are rendered properly an easily once one gets used to the commands. Given a set of numbers, there are elementary methods to compute its acrlong{gcd}, which is abbreviated acrshort{gcd}. This process is similar to that used for the acrfull{lcm}. clearpage printglossary[type=acronymtype] printglossary end{document}
latex
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
下面我们介绍具体的使用方法。
术语 Terms
如我们之前所见,术语由命令newglossaryentry定义:
documentclass{article} usepackage[utf8]{inputenc} usepackage{glossaries} makeglossaries newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } newglossaryentry{latex} { name=latex, description={Is a mark up language specially suited for scientific documents} } newglossaryentry{formula} { name=formula, description={A mathematical expression} } begin{document} The Gls{latex} typesetting markup language is specially suitable for documents that include gls{maths}. Glspl{formula} are rendered properly an easily once one gets used to the commands. clearpage printglossary end{document}
latex
1234567891011121314151617181920212223242526272829303132333435363738
我们接下来介绍它们的语法。第一个定义的术语是mathematics。
maths
第一个参数是该术语的标签,我们可以在之后使用gls命令来引用该术语。
name=mathematics
术语的名字,在这个例子中,术语的名字为mathematics。推荐的写法是小写+单数。
description={Mathematics is what mathematicians do}
术语的定义。
在你定义了术语条目之后,你可以使用下面的命令来引用它:
gls{ }
使用小写字母来打印该术语。例如gls{maths}输出mathematics。
Gls{ }
首字母大写。例如Gls{maths}输出Mathematics。
glspl{ }
复数形式。例如glspl{formula}将会变成formulas。
Glspl{ }
首字母大写的复数形式。例如glspl{formula}将会变成Formulas。
最后,使用printglossary命令来打印术语表。
缩略语 Acronyms
缩略语是词组的首字母大写。下面介绍一个基础的例子:
documentclass{article} usepackage[utf8]{inputenc} usepackage[acronym]{glossaries} makeglossaries newacronym{gcd}{GCD}{Greatest Common Divisor} newacronym{lcm}{LCM}{Least Common Multiple} begin{document} Given a set of numbers, there are elementary methods to compute its acrlong{gcd}, which is abbreviated acrshort{gcd}. This process is similar to that used for the acrfull{lcm}. clearpage printglossary[type=acronymtype] end{document}
latex
1234567891011121314151617181920
为了使用缩略语,你必须在引入glossaries包的时候传递一个参数:
usepackage[acronym]{glossaries}
latex
1然后你可以使用newaronym命令来声明新的缩略语。下面是命令newacronym{gcd}{GCD}{Greatest Common Divisor}的一个解读:
gcd是标签,用于引用缩略语。GCD是缩略语本身。缩略语一般用大写字母表示。Greatest Common Divisor是缩略语原本的词组。当缩略语在文档的 preamble 中进行定义后,你可以使用下面的命令:
acrlong{ }
显示缩略语的原本词组。例如,acrlong{gcd}会打印Greatest Common Divisor。
acrshort{ }
打印缩略语。例如,acrshort{gcd}会打印GCD。
acrfull{ }
打印缩略语及其原本词组。例如,acrfull{lcm}会打印Least Common Multiple (LCM)。
打印缩略语列表请使用下面的命令:
printglossary[type=acronymtype]
latex
1因为缩略语列表需要一个printglossary命令生成的临时文件,所以你必须在printglossary[type=acronymtype]命令之前添加printglossary命令然后编译文档。一旦你成功编译文档之后,你可以删除printglossary命令。
改变术语表的标题
如果你希望改变术语表的默认标题,你只需要在打印术语表的时候额外传递两个参数即可。下面是一个例子:
documentclass{article} usepackage[utf8]{inputenc} usepackage{glossaries} makeglossaries newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } ... [the rest of the example is the one in the sub section "Terms"] printglossary[title=Special Terms, toctitle=List of terms] end{document}
latex
1234567891011121314151617
命令printglossary有两个逗号分割的参数:
在目录中显示术语表
为了让术语表显示在目录之中,添加下面的命令:
usepackage[toc]{glossaries}
latex
1例子:
documentclass{article} usepackage[utf8]{inputenc} usepackage[toc]{glossaries} makeglossaries newglossaryentry{maths} { name=mathematics, description={Mathematics is what mathematicians do} } [...] begin{document} tableofcontents section{First Section} [...] printglossary end{document}
latex
12345678910111213141516171819202122232425
编译术语表
在 Overleaf 中编译术语表不需要额外的操作。如果你在编译文档之后添加了新的术语表,确保你清理了缓存文件(在 logs 选项中点击 Clear cached files)。
如果你在本地编译文档(假设该文档为glossaries.tex),那么你需要使用下面的命令:
pdflatex glossaries.tex makeglossaries glossaries pdflatex glossaries.tex
shell
12345参考指南
可用的术语表样式
命令glossarystyle{style}必须位于命令printglossaries之前。下面是一些可用的样式:
list
定义的术语将显示为黑体
altlist
在术语之后增加新行,并且对术语的描述进行缩进。
listgroup
用首字母对术语进行分组。
listhypergroup
在索引的顶部增加超链接。
相关知识
latex 画图
LaTeX 计数器
《Word排版艺术》读后感,兼谈LaTeX
LaTex图和表之直接在 LaTeX 中绘制图表
Latex安装和基本使用(Mac+MikTex+TexStudio)
LaTeX大冒险:从新手菜鸟到排版大师的奇幻旅程
希腊字母、花体字母的latex形式
LaTeX排版工具与学术论文模板:理工科实验报告的高效解决方案
[latex]希腊字母的花体(异体)与斜体写法
LaTeX技巧838:LaTeX 公式上下花括号的交错
网址: LaTeX 术语表 Glossaries https://www.huajiangbk.com/newsview2599789.html
| 上一篇: 使用 HTML 标签展示专业术语 |
下一篇: 食用花卉标准 |
推荐分享
- 1君子兰什么品种最名贵 十大名 4012
- 2世界上最名贵的10种兰花图片 3364
- 3花圈挽联怎么写? 3286
- 4迷信说家里不能放假花 家里摆 1878
- 5香山红叶什么时候红 1493
- 6花的意思,花的解释,花的拼音 1210
- 7教师节送什么花最合适 1167
- 8勿忘我花图片 1103
- 9橄榄枝的象征意义 1093
- 10洛阳的市花 1039
