I am trying to define a pgf key handler name/.unquote and store in=\command
so that {name="quoted string"}
or {name=unquotedstring}
both work. That is, the net effect of .unquote and store in
is to remove an optional outer string marks from the argument.
So far, I have been unable. From what I tried, everything breaks apart when using \@ifnextchar
in the MWE below [I also tried to \expandafter
at several stages, to no avail].
Can you help?
\documentclass{article}
\usepackage{pgfkeys}
\usepackage{fontawesome5}
\begin{document}
\makeatletter
\def\remove@quotes@eov"#1"#2\pgfeov{#1}
\def\remove@eov#1\pgfeov{#1}
\def\maybe@remove@quotes#1\pgfeov{\@ifnextchar"%
{\let\@next=\remove@quotes@eov}{\let\@next=\remove@eov}%
\@next#1\pgfeov}
\pgfkeys{/handlers/.unquote and store in/.code=%
{%
\pgfkeysalso{%
\pgfkeyscurrentpath/.code=%
{%
\edef#1{\maybe@remove@quotes##1\pgfeov}%
}%
}%
}%
}%
\pgfkeys{/faicon/.is family, /faicon/.cd,
name/.unquote and store in=\shtcIconName,
style/.unquote and store in=\shtcIconStyle,
}
\newcommand\shortcodefaicon[1][]{\pgfkeys{/faicon/.cd,#1}\faIcon[\shtcIconStyle]{\shtcIconName}}
\shortcodefaicon[name="apple", style=regular]
\end{document}
\@next
and never the first character of#1
.