\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mkessler-vocab}[2021-09-06 - Package for emphasizing vocabulary] %%%%%%%%%%%%%%%%%% %%Provides a \vocab<[name in index]>{vocabulary} command to print vocabulary in bold blue and automatically index it. \newif\ifenglish\englishtrue \DeclareOption{german}{\englishfalse} \DeclareOption{english}{\englishtrue} \DeclareOption*{\PackageWarning{mkessler-vocab}{Unknown '\CurrentOption'}} \ProcessOptions\relax %%%%Management of vocabulary and corresponding index \RequirePackage{imakeidx} \makeindex[columns=2, title=\ifenglish Index\else Stichwortverzeichnis\fi, intoc] %Emphasize \vocabulary \RequirePackage{xparse} \RequirePackage{expl3} \ExplSyntaxOn \NewDocumentCommand{\vocab}{O{} m}{ \textbf{\color{blue} #2} \ifthenelse{\isempty{#1}}{\index{\text_titlecase_first:n{#2}}}{\index{#1}} } \ExplSyntaxOff