feat(documentclass): enhance keywords macro for abstract to support alphabetical sorting
This commit is contained in:
@@ -416,16 +416,69 @@
|
||||
|
||||
% Keywords command for abstract (polyglossia-compatible)
|
||||
% --- Track main language vs. current language ---
|
||||
% Thanks to https://tex.stackexchange.com/a/333659
|
||||
\def\listterminator{;}
|
||||
\makeatletter
|
||||
\newcommand\alphabubblesort[1]{\def\presorted{}\def\sortedlist{}%
|
||||
\sortlist#1,\listterminator,\relax}
|
||||
\def\sortlist#1#2,#3#4,#5\relax{%
|
||||
\if\listterminator#3#4\relax%
|
||||
\expandafter\def\expandafter\sortedlist\expandafter{\sortedlist#1#2}%
|
||||
\else
|
||||
\ifnum\the\lccode`#1<\the\lccode`#3\relax%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter%
|
||||
\expandafter\sortedlist\expandafter\expandafter\expandafter{%
|
||||
\expandafter\sortedlist\presorted#1#2, }%
|
||||
\expandafter\def\expandafter\svfirst\expandafter{\presorted#3#4}%
|
||||
\def\presorted{}%
|
||||
\expandafter\sortlist\svfirst,#5\relax%
|
||||
\else%
|
||||
\ifnum`#1=`#3\relax%
|
||||
\ifx\relax#2\relax%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter%
|
||||
\expandafter\sortedlist\expandafter\expandafter\expandafter{%
|
||||
\expandafter\sortedlist\presorted#1#2, }%
|
||||
\expandafter\def\expandafter\svfirst\expandafter{\presorted#3#4}%
|
||||
\def\presorted{}%
|
||||
\expandafter\sortlist\svfirst,#5\relax%
|
||||
\else%
|
||||
\ifx\relax#4\relax%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter%
|
||||
\expandafter\sortedlist\expandafter\expandafter\expandafter{%
|
||||
\expandafter\sortedlist\presorted#3#4, }%
|
||||
\expandafter\def\expandafter\svfirst\expandafter{\presorted#1#2}%
|
||||
\def\presorted{}%
|
||||
\expandafter\sortlist\svfirst,#5\relax%
|
||||
\else
|
||||
\g@addto@macro\presorted{#1}%
|
||||
\sortlist#2,#4,#5\relax%
|
||||
\fi%
|
||||
\fi%
|
||||
\else%
|
||||
\let\tmp\sortedlist%
|
||||
\def\sortedlist{}%
|
||||
\expandafter\def\expandafter\svfirst\expandafter{\presorted#3#4}%
|
||||
\expandafter\def\expandafter\svsecond\expandafter{\presorted#1#2}%
|
||||
\def\presorted{}%
|
||||
\expandafter\expandafter\expandafter\expandafter\expandafter%
|
||||
\expandafter\expandafter\sortlist\expandafter\expandafter%
|
||||
\expandafter\tmp\expandafter\svfirst\expandafter,\svsecond,#5\relax%
|
||||
\fi%
|
||||
\fi%
|
||||
\fi%
|
||||
}
|
||||
\makeatother
|
||||
|
||||
\newcommand{\keywords}[1]{%
|
||||
% \vspace{1em}%
|
||||
\bigskip
|
||||
\noindent%
|
||||
\ifnum\strcmp{\languagename}{malay}=0
|
||||
Kata Kunci: #1%
|
||||
\else
|
||||
\textit{Keywords:} #1%
|
||||
\fi
|
||||
}
|
||||
\bigskip
|
||||
\noindent%
|
||||
\ifnum\strcmp{\languagename}{malay}=0
|
||||
Kata Kunci: \alphabubblesort{#1}\sortedlist%
|
||||
\else
|
||||
\textit{Keywords:} \alphabubblesort{#1}\sortedlist%
|
||||
\fi
|
||||
}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Change the text of the cross-reference links to the Slovene long version.
|
||||
|
||||
Reference in New Issue
Block a user