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{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.

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .