根据描述而不是名称对词汇表进行排序

根据描述而不是名称对词汇表进行排序

我想在工作结束时添加荷兰语-英语和英语-荷兰语的翻译列表,在每个列表中,还应引用该词汇表条目在文档中第一次使用的情况。为此,我将词汇表条目定义为

\newglossaryentry{label}{name=<English Translation>, description={<Dutch Translation>}}

对于英语-荷兰语列表,这很好用。但是对于荷兰语-英语列表,我稍微改变了英语-荷兰语列表的词汇表样式,首先显示描述,然后显示名称。但是,词汇表仍然根据名称排序(因此是第二列)。我怎样才能使词汇表根据描述排序(这样做时,根据荷兰语翻译排序)。

这是 MWE`

\documentclass[11pt,a4paper,openany,dutch,english,titlepage]{article}
\usepackage{lipsum}
\usepackage{glossaries-extra}

\makenoidxglossaries

% Definition of english-dutch style
\newglossarystyle{ReinfConcENGNL}
{%
    
    % longtable with three columns:
    \renewenvironment{theglossary}%
    {\begin{longtable}{|p{0.45\textwidth}|p{0.45\textwidth}|c|}}%
        {\end{longtable}}%
    % no header:
    \renewcommand*{\glossaryheader}{\hline \textbf{English/Engels} & \textbf{Dutch/Nederlands} & \textbf{p.} \tabularnewline \hline}%
    % no group headings:
    \renewcommand*{\glsgroupheading}[1]{}%
    % main (level 0) entries displayed in a row
    \renewcommand{\glossentry}[2]{%
        % name in bold: \hline
        \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
                % description in italic
        \textit{\glossentrydesc{##1}} &
        % Page number
        ##2 \tabularnewline \hline

    }%
    % sub-entries (same as main)
    \renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
    % blank row between groups if nogroupskip=false
    \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
    \else
    \renewcommand*{\glsgroupskip}{ & & \tabularnewline}%
    \fi
    \renewcommand{\glsgroupskip}{}
}

%Definition of dutch-english style (i.e. just switching the description and name columns in the table environment)
\newglossarystyle{ReinfConcNLENG}
{%
    
    % longtable with three columns:
    \renewenvironment{theglossary}%
    {\begin{longtable}{|p{0.45\textwidth}|p{0.45\textwidth}|c|}}%
        {\end{longtable}}%
    % no header:
    \renewcommand*{\glossaryheader}{\hline \textbf{Dutch/Nederlands} & \textbf{English/Engels} & \textbf{p.} \tabularnewline \hline}%
    % no group headings:
    \renewcommand*{\glsgroupheading}[1]{}%
    % main (level 0) entries displayed in a row
    \renewcommand{\glossentry}[2]{%
        % name in bold: \hline
        \glsentryitem{##1}\glstarget{##1}{\glossentrydesc{##1}} &
        % description in italic
        \textit{\glossentryname{##1}} &
        % Page number
        ##2 \tabularnewline \hline
        
    }%
    % sub-entries (same as main)
    \renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
    % blank row between groups if nogroupskip=false
    \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
    \else
    \renewcommand*{\glsgroupskip}{ & & \tabularnewline}%
    \fi
    \renewcommand{\glsgroupskip}{}
}

\newglossaryentry{Adhesion}{name=Adhesion, description={Adhesie/aanhechting}}
\newglossaryentry{Building}{name=Building, description={Gebouw}}
\newglossaryentry{Effective}{name=Effective, description={Effectief}}

\begin{document}
\section{Test}
\gls{Adhesion}
    \gls{Effective}
    \gls{Building}
    \setglossarystyle{ReinfConcENGNL}
    \printnoidxglossary[title=Translation English-Dutch]
    \setglossarystyle{ReinfConcNLENG}
    \printnoidxglossary[title = Translation Dutch-English]
\end{document}

相关内容