commands in setup
blacheref opened this issue · comments
blacheref commented
Hi,
Does it exist a way to use commands in \xsimsetup
? I would like to achieve things like presented in the following code, because I reuse the \semester
commands in other places.
\newcommand{\semester}{202109}
\newcommand{\printSolutions}{true}
\xsimsetup{
solution/print = \PrintSolutions,
tags={\semester},
}
Thanks by advance.
Yukai Chou commented
You can try fully expanding the key-val list before passing it to \xsimsetup
.
\documentclass{article}
\usepackage{xsim}
\newcommand{\semester}{202109}
\newcommand{\PrintSolutions}{true}
\expandafter\xsimsetup\expanded{{
solution/print = \PrintSolutions,
tags={\semester},
}}
\begin{document}
content
\end{document}
blacheref commented
This is working nicely, thanks !
Yukai Chou commented
Be careful that not every key-val pair (mostly the value) is fully expandable. So you might need to write two \xsimsetup
s.