使用词汇表包时,希腊字母和数学模式符号的排序不正常

使用词汇表包时,希腊字母和数学模式符号的排序不正常

我正在使用词汇表包来创建符号列表和缩写列表,但遇到了两个问题:

  1. 生成的符号列表的顺序很奇怪(见下图),即 $/mathcal{E}$、希腊小写字母、希腊大写字母、带下标的希腊小写字母、拉丁大写字母、拉丁小写字母(未显示)。理想情况下,这些应该是拉丁字母(\mathcal{E} 包含在 E 中),然后是希腊字母,但我会接受任何有意义的东西。
  2. 当我使用多个包含 \mathcal{E} 的词汇表项(例如 \gls{efield} ($/mathcal{E}$) 和 \gls{EMT1} ($\mathcal{E}_{MT1}$)时,词汇表无法编译,并且我会收到一条错误消息:

    ! Undefined control sequence.
    \GenericError ...
    #4 \errhelp \@err@ ...
    l.37 \printnoidxglossary[type=los]
    The control sequence at the end of the top line
    of your error message was never \def'ed. If you have
    misspelled it (e.g., `\hobx'), type `I' and the correct
    spelling (e.g., `I\hbox'). Otherwise just continue,
    and I'll forget about whatever was undefined.
    

    这就是为什么 \gls{EMT1} 和其他术语在文档中被 % 隐藏的原因。我知道简单的解决方案是不使用 \mathcal,但这是获取我需要的符号的方法。

产生的符号列表如下:

符号列表

文档代码是(为简单起见,省略了缩写列表):

\documentclass[12pt,a4paper]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{gensymb}
\usepackage[top=2cm,bottom=2.4cm, inner=4cm, outer=2.5cm]{geometry}
\usepackage[nogroupskip,nonumberlist,style=super]{glossaries}
\makenoidxglossaries 
\newglossary*{los}{List of Symbols}
\loadglsentries[los]{los}

\begin{document}

\addcontentsline{toc}{section}{List of Symbols}
\printnoidxglossary[type=los]

\section{other}

\subsection{glossary stuff}

\gls{phi}
\gls{L0}
\gls{Delta}
\gls{ecm}
\gls{q}
\gls{ND}
\gls{phibn}
\gls{ly}
\gls{h}
\gls{permittivity}
\gls{relativepermittivity}
\gls{V}
\gls{x}
\gls{y}
\gls{z}
\gls{phin}
\gls{phibi}
\gls{WD}
\gls{efield}
%\gls{emaxthin}
%\gls{emax}
\gls{phiIFL}
\gls{vbr}
%\gls{ebr}
\gls{j}
\gls{richardsonconstant}
\gls{T}
\gls{k}
\gls{dn}
\gls{n}
\gls{NC}
\gls{efn}
\gls{zs}
\gls{I}
\gls{Itot}
\gls{a1}
\gls{a2}
\gls{Isheet}
\gls{Aeff}
\gls{phibeff}
\gls{Iline}
%\gls{EMT1}
%\gls{EMT2}
%\gls{EMTS}

\end{document}

代码加载以下符号列表(los.tex):

\newglossaryentry{ec}
{type=los,
name={$E_C$},
description={Conduction Band Minimum (eV)}
}

\newglossaryentry{L0}
{type=los,
name={$L_0$},
description={Width of Inhomogeneity/low barrier region (nm)}
}

\newglossaryentry{Delta}
{type=los,
name={$\Delta$},
description={Difference between the mean barrier height and the barrier height of the inhomogeneity/low barrier region (V)}
}

\newglossaryentry{ecm}
{type=los,
name={$E_{CM}$},
description={Maximum of $E_C$ beneath the centre of the inhomogeneity/LBR (eV)}
}

\newglossaryentry{phi}
{type=los,
name={$\phi$},
description={Potential (V)}
}

\newglossaryentry{q}
{type=los,
name={$q$},
description={Fundamental charge (C)}
}

\newglossaryentry{ND}
{type=los,
name={$N_D$},
description={ ($\text{cm}^{-3}$)}
}

\newglossaryentry{phibn}
{type=los,
name={$\phi_{Bn}$},
description={Schottky barrier height between a metal and $n$-type semiconductor (V)}
}

\newglossaryentry{ly}
{type=los,
name={$L_y$},
description={Length of the dipole sheet inhomogeneity (nm)}
}

\newglossaryentry{h}
{type=los,
name={$H$},
description={Semiconductor thickness in a Schottky diode (nm)}
}

\newglossaryentry{permittivity}
{type=los,
name={$\epsilon_0$},
description={Permittivity of free space ($8.85 \times 10^{-14}$ (F/cm)}
}

\newglossaryentry{relativepermittivity}
{type=los,
name={$\epsilon_s$},
description={Relative permittivity of the semiconductor}
}


\newglossaryentry{V}
{type=los,
name={$V$},
description={Applied voltage (V)}
}

\newglossaryentry{x}
{type=los,
name={$x$},
description={Distance in the $x$-direction (cm)}
}

\newglossaryentry{y}
{type=los,
name={$y$},
description={Distance in the $y$-direction (cm)}
}


\newglossaryentry{z}
{type=los,
name={$z$},
description={Distance in the $z$-direction (cm)}
}


\newglossaryentry{phin}
{type=los,
name={$\phi_n$},
description={Fermi potential from the conduction band edge in an $n$-type semiconductor $(E_C - E_F)/q$ (V)}
}

\newglossaryentry{phibi}
{type=los,
name={$\phi_{bi}$},
description={Built-in potential of a Schottky junction (V)}
}

\newglossaryentry{WD}
{type=los,
name={$W_D$},
description={Depletion width of a Schottky junction (nm)}
}

\newglossaryentry{efield}
{type=los,
name={$\mathcal{E}$},
description={Electric field (V/cm)}
}

\newglossaryentry{emaxthin}
{type=los,
name={$\mathcal{E}_{MT}$},
description={Maximum electric field in a fully depleted thin-film Schottky diode (V/cm)}
}

\newglossaryentry{emax}
{type=los,
name={$\mathcal{E}_{M}$},
description={Maximum electric field in a Schottky diode under the standard depletion approximation (V/cm)}
}


\newglossaryentry{phiIFL}
{type=los,
name={$\phi_{IFL}$},
description={Potential reduction in barrier height due to image force lowering (V)}
}


\newglossaryentry{vbr}
{type=los,
name={$V_{BR}$},
description={Breakdown voltage of a Schottky diode (V)}
}

\newglossaryentry{ebr}
{type=los,
name={$\mathcal{E}_{BR}$},
description={Breakdown electric field of a Schottky diode (V/cm)}
}

\newglossaryentry{j}
{type=los,
name={$J$},
description={Current density (A $\text{cm}^{-2}$)}
}

\newglossaryentry{richardsonconstant}
{type=los,
name={$A^*$},
description={Richardson Constant (A $\text{cm}^{-2} K^{-2}$)}
}

\newglossaryentry{T}
{type=los,
name={$T$},
description={Temperature (K)}
}

\newglossaryentry{k}
{type=los,
name={$k$},
description={Boltzmann constant $= 1.38 \times 10^{-23}$ (J/K)}
}

\newglossaryentry{dn}
{type=los,
name={$D_n$},
description={Diffusion coefficient for electrons ($\text{cm}^{2} s^{-1}$}
}

\newglossaryentry{n}
{type=los,
name={$n$},
description={Free electron concentration ($\text{cm}^{-3}$)}
}

\newglossaryentry{NC}
{type=los,
name={$N_C$},
description={Effective density of states in the conduction band ($\text{cm}^{-3}$)}
}

\newglossaryentry{efn}
{type=los,
name={$E_{Fn}$},
description={Fermi energy in an $n$-type semiconductor (eV)}
}

\newglossaryentry{zs}
{type=los,
name={$z_s$},
description={Saddle point position (cm)}
}

\newglossaryentry{I}
{type=los,
name={$I$},
description={Current (A)}
}

\newglossaryentry{Itot}
{type=los,
name={$I_{tot}$},
description={Total current (A)}
}

\newglossaryentry{a1}
{type=los,
name={$A_1$},
description={Area of Schottky barrier region with barrier height $\phi^0_{Bn}$ ($\text{cm}^2$)}
}

\newglossaryentry{a2}
{type=los,
name={$A_2$},
description={Area of Schottky barrier region with barrier height $\phi^0_{Bn}-\Delta$ ($\text{cm}^2$)}
}


\newglossaryentry{Isheet}
{type=los,
name={$I_{sheet}$},
description={Current through the low barrier sheet region of the dipole sheet Schottky diode model (A)}
}

\newglossaryentry{Aeff}
{type=los,
name={$A_{eff}$},
description={The effective area of the low barrier region ($\text{cm}^2$)}
}

\newglossaryentry{phibeff}
{type=los,
name={$\phi_{B,eff}$},
description={The effective barrier height of the low barrier region}
}

\newglossaryentry{Iline}
{type=los,
name={$I_{line}$},
description={Current through the low barrier sheet region of the dipole line Schottky diode model (A)}
}

\newglossaryentry{EMT1}
{type=los,
name={$\mathcal{E}_{MT1}$},
description={Maximum electric field in the region of the Schottky diode with barrier height $\phi^0_{Bn}$ (V/cm)}
}

\newglossaryentry{EMT2}
{type=los,
name={$\mathcal{E}_{MT2}$},
description={Maximum electric field in the region of the Schottky diode with barrier height $\phi^0_{Bn}-\Delta$ in the absence of a saddle point (V/cm)}
}

\newglossaryentry{EMTS}
{type=los,
name={$\mathcal{E}_{MTS}$},
description={Maximum electric field in the region of the Schottky diode with barrier height $\phi^0_{Bn}-\Delta$ in the presence of a saddle point (V/cm)}
}

有任何想法吗???

干杯,

乔什

答案1

\makenoidxglossaries方法不适用于name键中包含命令的条目。这是不得已的方法,除非出于某种原因您绝对不能使用外部工具,否则我真的不推荐它。

表 1.1:词汇表选项:优点和缺点用户手册中glossaries比较了每个可用选项。“选项 1”表示“noidx”方法(\makenoidxglossaries\printnoidxglossary),与其他方法相比,它的表现非常差:它没有有效的排序方法,它的排序值和集合有问题sanitizesort=false,这意味着脆弱的命令会导致问题。

如果你确实想使用,那么你必须为所有包含命令的条目\makenoidxglossaries提供一个键sortname。(请参阅词汇表:切换到 \makenoidxglossaries 时没有打印的词汇表

理想情况下,这些应该是按字母顺序排列的拉丁字母(\mathcal{E}包含 E),然后是按字母顺序排列的希腊字母,但我会接受任何有意义的东西。

\makenoidxglossaries必须计算出适当的排序值才能确保这一点。例如,在拉丁值前加上前缀,1.在希腊值前加上前缀2.

\newglossaryentry{L0}
{type=los,
sort={1.L0},
name={$L_0$},
description={Width of Inhomogeneity/low barrier region (nm)}
}

\newglossaryentry{Delta}
{type=los,
sort={2.D},
name={$\Delta$},
description={Difference between the mean barrier height and the barrier height of the inhomogeneity/low barrier region (V)}
}

然而,有了这种程度的干预(并且考虑到你不需要数字列表),你也可以使用选项 5相反,它不执行任何排序,而是按\printunsrtglossary定义顺序显示所有已定义的条目(无论它们是否已在文档中使用)。然后您需要确保以适当的顺序定义所有条目。这让您可以完全控制顺序,但您必须手动执行。

如果你想要一个完全自动化的解决方案,不需要你设置sort,那么你需要选项 4 (bib2gls相反。其他选项(包括makeindexxindy)都无法为名称中包含命令的条目(例如name={$\phi$})提供适当的排序,而无需手动干预。bib2gls识别大多数标准数学符号命令,并支持siunitx和一些其他符号包。对于无法识别的符号,您可以选择根据字段进行排序description(如果没有自然排序,这可能更合适)。

首先,您bib2gls需要将los.tex文件转换为.bib以下格式。例如,

\newglossaryentry{ec}
{type=los,
name={$E_C$},
description={Conduction Band Minimum (eV)}
}

需要更改为

@entry{ec,
  name={$E_C$},
  description={Conduction Band Minimum (eV)}
}

该文件需要一些修改:

\documentclass{article}

\usepackage[top=2cm,bottom=2.4cm, inner=4cm, outer=2.5cm]{geometry}
\usepackage[record,% using bib2gls
  nogroupskip,style=super]{glossaries-extra}

\newglossary*{los}{List of Symbols}

\GlsXtrLoadResources[
  src={los},% entries in the file 'los.bib'
  sort={letter-nocase},
  type={los},% put the entries in the 'los' glossary
  save-locations=false% the location lists aren't required
]

\begin{document}
\printunsrtglossary[type=los]

\section{other}

\subsection{glossary stuff}

\gls{phi}
\gls{L0}
\gls{Delta}
\gls{ecm}
\gls{q}
\gls{ND}
\gls{phibn}
\gls{ly}
\gls{h}
\gls{permittivity}
\gls{relativepermittivity}
\gls{V}
\gls{x}
\gls{y}
\gls{z}
\gls{phin}
\gls{phibi}
\gls{WD}
\gls{efield}
\gls{emaxthin}
\gls{emax}
\gls{phiIFL}
\gls{vbr}
\gls{ebr}
\gls{j}
\gls{richardsonconstant}
\gls{T}
\gls{k}
\gls{dn}
\gls{n}
\gls{NC}
\gls{efn}
\gls{zs}
\gls{I}
\gls{Itot}
\gls{a1}
\gls{a2}
\gls{Isheet}
\gls{Aeff}
\gls{phibeff}
\gls{Iline}
\gls{EMT1}
\gls{EMT2}
\gls{EMTS}

\end{document}

如果调用该文档,myDoc.tex则文档构建为:

pdflatex myDoc
bib2gls myDoc
pdflatex myDoc

第 1 页:

第 1 页图片

第2页:

第 2 页图片

相关内容