I've created a custom class with key-value options using pgfopts. So far this is working fine. Now I would like to create a key which can take a random string including equal sign and comma.
The below example will illustrate my needs.
\begin{filecontents}{\jobname.cls}
\ProvidesClass{\jobname}[2018-11-20 v1.0 SE Test package]
\RequirePackage{pgfopts}
\pgfkeys{
testproj/.cd,
mystuff/.store in = \myValue,
mystuff = {} % <-- Set default to empty
}
\ProcessPgfOptions{/testproj}
\LoadClass[\myValue]{article}
\endinput
\end{filecontents}
% ------------------
\documentclass[mystuff = {hello=SE,test=1}]{\jobname}
%\pgfkeys{/testproj/mystuff = {hello=SE}} % <-- working as aspected
\begin{document}
myValue: \myValue
\end{document}
The key mystuff should take any string and should be passed as class option. The problem is that mystuff will only take "hello" as argument instead of the whole content inside the parenthesis "hello=SE,test=1".
How can I manage to pass a random string as class option including a equal sign and a comma using pgfopts?
pgfopts, but it's a consequence of how the option parser is implemented in LaTeX. The option passes through LaTeX's parser before being passed topgfopts. Thekvoptions-patchpackage fixes this. You have to load it before the\documentclass. I gave an explanation in the post I linked. The situation is different, but the issue boils down to the same. The problem is not with the=inside the braces, but with the space around the first=sign. – Phelype Oleinik Nov 20 '18 at 18:58