# Using ifthenelse for crop marks with tikz

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?

-

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:

\documentclass{article}
\usepackage{tikz}

\newif\ifprintcrop
\printcroptrue
%\printcropfalse

\begin{document}
\begin{tikzpicture}
% other drawing commands
\ifprintcrop
\draw(0,0) -- ++(0,1);
\fi
% other drawing commands
\end{tikzpicture}
\end{document}


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

-
 thanks Martin.......... – Regis da Silva May 7 '11 at 20:59