Im developing a package an use keyreader to define it’s options, but I fail to set a font as an option.
\begin{filecontents}{myfonts.sty}
\ProvidesPackage{myfonts}
\usepackage{keyreader}
\krddefinekeys[TW]{fam}[my]{%
cmd/font/\sffamily/;
}
\krdProcessOptions*[TW]<fam>\relax
\end{filecontents}
\documentclass{article}
% works
\newcommand{\mymacro}{xx}% [L1]
% doesn’t work
\newcommand{\mymacro}{\ttfamily}% [L2]
\usepackage[font=\mymacro]{myfonts}% [L1,2]
% doesn’t work
\usepackage[font=\ttfamily]{myfonts}% [L3]
% works
%\krdsetkeys[TW]{fam}{font=\ttfamily}% [L4]
\begin{document}
\myfont Test
\end{document}
I can change the font with \setkeys [L4] but not as a package option [L3]. In general giving macros as values work [L1] but not if theses macros are or contain font switches [L2]. How can I fix this?
If I try to set the font as option pdflatex hangs. In the real package I get the TeX capacity exceeds error.
BTW: \krdProcessOptions drops an error if i omit the prefix [TW] in all macros …