Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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