I am trying to extend the example mentioned in this question to write a macro that takes several arguments (width of the figure, caption, label + N file names) and produces a figure including those N figures. N may be greater than 6, so the approach followed in that post won't work, because it would go beyond the 9 arguments limit.
I was trying instead to use \pgfkeys in the following way
\pgfkeys{/myfigure/.is family, /myfigure,
caption/.store in =\mycaption,
width/.store in =\mywidth,
label/.store in =\mylabel,
figA/.estore in=\figA,
...
figN/.estore in=\figN,
}
\newcommand\myfigure[1]{
\pgfkeys{myfigure,#1}
\begin{figure}
\includegraphics[width=\mywidth]{\figA}
...
\includegraphics[width=\mywidth]{\figN}
\caption{\mycaption}
\label{\mylabel}
\end{figure}
}
And calling it as
\myfigure[width=\textwidth,label=kk,caption=caption,figA={plot_name.pdf}}
However, this won't work because of the underscore in the plot_name.pdf. What I'm I missing here?
Also I would be interested in this macro reading an arbitrary number of figures.
Thanks!
\pgfkeys{/myfigure/.cd,#1}instead of\pgfkeys{myfigure,#1}, i.e. with a/and the/.cdis IMHO cleaner. (Obviously I cannot tell if this solves all problems because you post only fragments.) – May 01 '20 at 17:09