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.

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
add comment

1 Answer

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:

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

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

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.