I would like to define options for a package using pgfopts. So far it works quite well, but I can't figure out how to execute default options. This is described here: How do you define a default choice in pgfkeys but for some reason it does not work in my test package.
Let the package be
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{testpack}[2019/10/01 v0.1]
\RequirePackage{pgfopts}
\pgfkeys{
/testpack/.cd,
lastword/.is choice,
lastword/yes/.code=\AtEndDocument{\par Yes last word.},
lastword/no/.code=\AtEndDocument{\par No last word.},
lastword/.default=no
}
\ProcessPgfPackageOptions*
and the test document
\documentclass{article}
%\usepackage[lastword=yes]{testpack}
%\usepackage[lastword=no]{testpack}
\usepackage{testpack}
\begin{document}
Here is the text.
\end{document}
then the first two load options give the desired behavior. However, when loading testpack
without any options no code is executed at all. I assumed that the .default
statement does this trick, but apparently it does not.
Any ideas?