2021-10-06 23:10:06 +02:00
|
|
|
__HEADER__(Package for emphasizing vocabulary)
|
|
|
|
%%Provides a \vocab<[name in index]>{vocabulary} command to print vocabulary in bold blue and automatically index it.
|
|
|
|
|
|
|
|
\RequirePackage{xkeyval}
|
|
|
|
|
2021-10-07 10:06:23 +02:00
|
|
|
__LANGUAGE_OPTIONS_X__
|
2021-10-06 23:10:06 +02:00
|
|
|
__NEW_IF__(index,false)
|
|
|
|
|
2021-10-07 10:06:23 +02:00
|
|
|
\DeclareOptionX{index}{__SET_IF__(index,true)}
|
|
|
|
\DeclareOptionX{noindex}{__SET_IF__(index,false)}
|
2021-10-06 23:10:06 +02:00
|
|
|
|
|
|
|
__END_OPTIONS_X__
|
|
|
|
|
|
|
|
%%%%Management of vocabulary and corresponding index
|
|
|
|
\RequirePackage{xparse}
|
|
|
|
\RequirePackage{xcolor}
|
|
|
|
__IF__(index)
|
|
|
|
\RequirePackage{imakeidx}
|
|
|
|
\makeindex[name=vocabindex, columns=2, title=__IF__(english) Index\else Stichwortverzeichnis\fi, intoc]
|
|
|
|
|
|
|
|
%Emphasize \vocabulary
|
|
|
|
\RequirePackage{expl3}
|
|
|
|
\ExplSyntaxOn
|
|
|
|
\NewDocumentCommand{\vocab}{O{} m}{
|
|
|
|
\textbf{\color{blue} #2}%
|
|
|
|
\if\relax\detokenize{#1}\relax%
|
|
|
|
\index[vocabindex]{\text_titlecase_first:n{#2}} % true branch: #1 was empty
|
|
|
|
\else
|
|
|
|
\index[vocabindex]{#1} % false branch: #1 was supplied
|
|
|
|
\fi
|
|
|
|
}
|
|
|
|
\ExplSyntaxOff
|
|
|
|
\newcommand\printvocabindex{
|
|
|
|
\printindex[vocabindex]
|
|
|
|
}
|
|
|
|
\else
|
|
|
|
\NewDocumentCommand{\vocab}{O{} m }{
|
|
|
|
\textbf{\color{blue} #2}
|
|
|
|
}
|
|
|
|
\fi
|
|
|
|
|