如何创建忽略重复项的自定义、自排序的词汇表?

如何创建忽略重复项的自定义、自排序的词汇表?

我想使用下面的 MWE 代码,但调整定义,\GlsList以便列表中的条目按其排序,sort key并忽略重复项。

这是基于@Andrew 针对这个问题提供的答案使用词汇表列出每个等式下方的符号。下面的代码是那里提供的有效 MWE。

\documentclass[12pt,twoside,booktabs,a4paper]{book}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[acronym,toc,shortcuts]{glossaries}
\usepackage{amsmath}

\newglossary[ch1]{formel}{ch2}{ch3}{Symbols}

\makenoidxglossaries
\setacronymstyle{long-short}

\newglossarystyle{formel_altlong4colheader}{%
\setglossarystyle{altlong4colheader}%
%
\renewcommand*{\glossaryheader}{%
    \bfseries Symbol
   & \bfseries Description
   & \bfseries Unit\\
   \hline
   \\\endhead}%
 \renewcommand{\glossentry}[2]{%
 \glstarget{##1}{\glossentryname{##1}}%
 & \glossentrydesc{##1}%
 & \glossentrysymbol{##1}%
 \tabularnewline % end of row
 }%
}

\setlength{\glsdescwidth}{3in}

\include{glossar}

\usepackage{etoolbox}
\newcommand\GlsList[1]{% generate list of glossary entries
  \def\gswith{with}% for inserting "with" on the first line
  \renewcommand*{\do}[1]{%
     \glsadd{##1}% add glossary entry to index
     \gswith&\glossentryname{##1}:&\glossentrydesc{##1}&[\glossentrysymbol{##1}]\\%
     \global\let\gswith\relax% reset "with" for later lines
  }
  \begin{tabular}{@{}llll}
    \docsvlist{#1}
  \end{tabular}
}

%-----Formel---
\newglossaryentry{CDDLimit}
{%
name={$CDD_{Limit}$},
description={Cooling Degree Day Limit},
symbol={$-$},
sort=abc,
type=formel
}
\newglossaryentry{CDD}
{%
name={$CDD$},
description={Cooling Degree Day},
symbol={$\frac{W}{kg K}$},
sort=abc,
type=formel
}

\begin{document}

\printnoidxglossary[type=formel,  style=formel_altlong4colheader]

\begin{equation}
  CDD_{Limit} = Max(CDD)
\end{equation}
\GlsList{CDDLimit,CDD}

\end{document}

感谢您的帮助!

相关内容