詞彙表 newacronym 按短字段排序,即使短字段作為命令給出

詞彙表 newacronym 按短字段排序,即使短字段作為命令給出

對於我的文檔,我喜歡將下標和上標(德語: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 可以嗎?可能會出現哪些意想不到的副作用?

我希望術語表的排序如下所示:

  1. ES thermal energy storage
  2. HT high temperature
  3. I inertia tensor
  4. NT low temperature

答案1

好的,我找到答案了。如果我設定sanitizesort=false為詞彙表包選項,排序鍵將會展開:

\usepackage[
    acronym, toc, nonumberlist, nopostdot, nomain, nogroupskip, 
    sanitizesort=false  % false expands commands
]{glossaries}

一些明確定義的非命令條目似乎仍然存在一些排序問題,但總的來說它工作正常。

編輯:現在我知道乳膠中的“消毒”意味著什麼,因此搜索它,發現了這個問題/回答處理同樣的問題。

相關內容