![詞彙表 newacronym 按短字段排序,即使短字段作為命令給出](https://rvso.com/image/420753/%E8%A9%9E%E5%BD%99%E8%A1%A8%20newacronym%20%E6%8C%89%E7%9F%AD%E5%AD%97%E6%AE%B5%E6%8E%92%E5%BA%8F%EF%BC%8C%E5%8D%B3%E4%BD%BF%E7%9F%AD%E5%AD%97%E6%AE%B5%E4%BD%9C%E7%82%BA%E5%91%BD%E4%BB%A4%E7%B5%A6%E5%87%BA.png)
對於我的文檔,我喜歡將下標和上標(德語:Indizes)定義為命令,以便\newcommand{}{}
為常用縮寫建立快捷方式的級聯結構。這樣做有一個巨大的優勢,我可以輕鬆地用一行更改所有相關的縮寫和下標。例如:
- 熱能儲存的縮寫 TES
\newcommand{\TES}{TES}
- 也定義為下標或數學變量,具有
\newcommand{\TESi}{\mathit{\TES}}
漂亮的數學文字格式 - 在文本中使用
\TES{}
- 用於數學。
$V_{\TESi}$
TES 體積的符號 - 加入下標和上標詞彙表中
\newacronym[type=indizes]{tes}{$\TESi$}{thermal energy storage}
最後一步引起了一些麻煩:對條目進行排序時,glossaries
似乎是按命令的名稱而不是命令生成的字串。
這意味著如果我將初始縮寫從newcommand{\TES}{TES}
to重命名newcommand{\TES}{ES}
,詞彙表將按 排序\TES
而不是ES
。當縮寫出現時,情況會變得更糟未由 newcommand 定義添加(在相當一些非常明確的情況下,根本沒有其他有用的縮寫),排序完全關閉。
添加\newacronym[type=indizes,sort=ES]
作品,但我還是更喜歡隱式解為了靈活性,例如\newacronym[type=indizes,sort=\TES]
,它再次按TES
而不是排序ES
...
我的最小工作範例是(是的,我可以刪除術語表樣式定義,但這樣讀起來更容易:)):
\documentclass[a4paper,oneside,11pt,parskip=half]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[acronym, toc, nonumberlist, nopostdot, nomain, nogroupskip]{glossaries}
\newglossary[ilg]{indizes}{iyi}{iyg}{Indizes}
\setlength{\glsdescwidth}{12cm}
\makeglossaries
\glsnoexpandfields
% Stil für Indizes und Abkürzungen
\newglossarystyle{fixedglslong}{%
\setglossarystyle{long}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{p{2cm}p{14.5cm}}}%
{\end{longtable}}%
%
\renewcommand*{\glossentry}[2]{% Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1} \tabularnewline
}
}
%% abbreviations
\newcommand{\TES}{ES}
\newcommand{\HT}{HT}
\newcommand{\NT}{NT}
%% sub- and superscripts
\newcommand{\TESi}{\mathit{\TES}}
\newcommand{\HTi}{\mathit{\HT}}
\newcommand{\NTi}{\mathit{\NT}}
\newcommand{\IT}{I}
% glossary for sub- and superscripts:
\newacronym[type=indizes]{TES}{$\TESi$}{thermal energy storage}
\newacronym[type=indizes]{HT}{$\HTi$}{high temperature}
\newacronym[type=indizes]{NT}{$\NTi$}{low temperature}
\newacronym[type=indizes]{itens}{$I$}{inertia tensor}
\begin{document}
\glsaddall
\printglossary[type=indizes, style=fixedglslong]
\end{document}
有什麼方法可以正確排序項目,這意味著透過文件中實際列印的字串?或者我可以newacronym
以某種方式為 提供額外的排序鍵嗎\newglossaryentry
?我檢查了術語表文檔並嘗試了各種變體,但它似乎不起作用。
改用xindy 可以嗎?可能會出現哪些意想不到的副作用?
我希望術語表的排序如下所示:
ES thermal energy storage
HT high temperature
I inertia tensor
NT low temperature