6

I have two custom keys: key1, which is boolean; and key2, which accepts a value. The idea is that key1 activates a feature, and key2 customizes the feature. However, if key2 is used, I want key1 set to true automatically. So:

\tikzset{key2=3.5cm)

and

\tikzset{key1=true, key2=3.5cm}

should have the same effect.

All I need help with is making it so that key1 is automatically set to true when key2 is set to any value.

6

Name your original key2 to @key2 or any other internal name and define key2 as follows:

\tikzset{key2/.style={key1=true, @key2={#1}})

This will pass the value to the internal key and also switch the boolean key on.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.