TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 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


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.