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

How do I use to insert ifthenelse crop marks in Tikz. I want

ifthenelse{\printcrop=true}{\draw(0,0) -- ++(0,1);}{}

That is, if yes, make a drawing, else but do nothing.

And yet, where I can choose the option true or false?

share|improve this question
up vote 10 down vote accepted

You can define your own if-switch using \newif\ifyourname and then use \yournametrue and \yournamefalse to set it to true or false, respectively. To use the if simply use \ifyourname <true clause> \else <false clause> \fi where the \else clause is optional.

You code example would be written this way:



% other drawing commands
  \draw(0,0) -- ++(0,1);
% other drawing commands

Note that this if-switches are expandable. You shouldn't use \newif inside another \if... clause because this might cause trouble.

share|improve this answer
thanks Martin.......... – Regis da Silva May 7 '11 at 20:59

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.