6

Is it possible to create a key handler with the pgfkeys package that removes a key from a style?

Here's a minimal working example:

\documentclass[preview,margin=10pt,convert]{standalone}
\usepackage{pgfkeys}
\pgfkeys{/a/.code={a#1},
    /b/.code={b#1},
    /c/.code={c#1}}
\pgfkeys{/my style/.style = {/a=1, /b=2, /c=3}}
\begin{document}
\pgfkeys{/my style}\par
%\pgfkeys{/my style/.remove from style = {b}}
\pgfkeys{/my style}
\end{document}

The output is

a1b2c3a1b2c3

The desired output, if the commented line were to be uncommented, would be

a1b2c3
a1c3

Here are a couple of closely related questions. They are not duplicates of this one, but the answers to the second one might be useful in devising an answer to this question.

Unsetting a PGF/TikZ key

How to extract the value from a pgfkeys style element

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.