我的论文中有一个包含该glossaries-extra
包的符号列表。我想以某种方式对符号列表进行排序,例如,按相应描述的第一个字母排序,或按定义中的顺序排序。目前,它们似乎没有排序,我希望存在一个用于sort=
此目的的选项。
梅威瑟:
\documentclass[12pt]{article}
\usepackage[symbols]{glossaries-extra}
\makeglossaries
\glsxtrnewsymbol
[description = {Penalization power used in the SIMP approach}]
{penalization-power}
{$p$}
\glsxtrnewsymbol
[description = {Filter radius used in the SIMP approach}]
{filter-radius-simp}
{$r$}
\glsxtrnewsymbol
[description = {Force (Load)}]
{force}
{$F$}
\glsxtrnewsymbol
[description = {Young's modulus}]
{elastic-modulus}
{$E$}
\glsxtrnewsymbol
[description = {Young's modulus in element $e$}]
{element-elastic-modulus}
{$E_{e}$}
\glsxtrnewsymbol
[description = {Artificial Young's modulus assigned to void regions (ersatz material)}]
{artificial-elastic-modulus}
{$E_{min}$}
\glsxtrnewsymbol
[description = {mass density}]
{mass-density}
{$\rho$}
\begin{document}
\printglossary[type=symbols,title={List of Symbols}]
\printglossary
\glsaddallunused
\end{document}
答案1
glossaries-extra
glossaries
是包的扩展
参见glossaries-extra
包装文件 P.19,https://mirror.csclub.uwaterloo.ca/CTAN/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.pdf
\glsxtrnewsymbol[〈options〉]{〈label〉}{〈symbol〉}
相当于glossaries
包中的命令
\newglossaryentry{〈label〉}{name={〈symbol〉},
sort={〈label〉},type=symbols,category=symbol,〈options〉}
请注意,排序键设置为 〈label〉 而不是 〈symbol〉,因为符号可能包含命令。
label
当您想在文档中使用符号时,文件就是变量。\gls{label}
因此,您需要用一些容易记住的术语来定义它,例如:
\glsxtrnewsymbol
[sort={1},description = {mass density}]
{md}
{\ensuremath{\rho}}
该symbol
字段定义您调用时符号将如何在文档中显示\gls{label}
(例如将在文档中\gls{md}
输入)。\ensuremath{\rho}
注意:最初该md
术语将表示为排序键,因此排序将取决于首字母的顺序m
。但您可以通过添加sort={1}
选项手动更改它。这样,此条目将首先出现在列表中。因为排序顺序是数字后跟字母。此外,请确保输入\ensuremath{}
符号以使其在数学模式下可用($...$ 不起作用)。并输入automake
包选项,因此每次更改符号定义时,Latex 都会为您更新符号列表。这是它如何工作的示例:
\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[hidelinks]{hyperref}
\usepackage[automake,symbols]{glossaries-extra}
\glsxtrnewsymbol
[sort={f},description = {Penalization power used in the SIMP approach}]
{p}
{\ensuremath{p}}
\glsxtrnewsymbol
[sort={e},description = {Filter radius used in the SIMP approach}]
{Rf}
{\ensuremath{r}}
\glsxtrnewsymbol
[sort={d},description = {Force (Load)}]
{f}
{\ensuremath{F}}
\glsxtrnewsymbol
[sort={c},description = {Young's modulus}]
{E}
{\ensuremath{E}}
\glsxtrnewsymbol
[sort={b},description = {Young's modulus in element $e$}]
{Ee}
{\ensuremath{E_e}}
\glsxtrnewsymbol
[sort={a},description = {Artificial Young's modulus assigned to void regions (ersatz material)}]
{Ea}
{\ensuremath{E_{min}}}
\glsxtrnewsymbol
[sort={1},description = {mass density}]
{md}
{\ensuremath{\rho}}
\makeglossaries
\begin{document}
\glsaddallunused
\printglossary[type=symbols,title={List of Symbols}]
\clearpage
\lipsum[1]
\[\gls{md}=\gls{Ee}\times\gls{f}\times\gls{Ea}\] % equation doesn't make any sense, it is just a example
\end{document}