3

I try to hide a tikzpicture :

Depending on a boolean, I want to see or not the tikzpicures of a document (show them on display, but hide them on paper) in order to students draw them. The hidden tikzpicture as to leave its blank space.

\vpanthom or \hphantom don't work.

5

You can combine the every picture style and execute at end picture:

\documentclass{article}
\usepackage{tikz}
\newif\ifhidepics
\hidepicsfalse
%\hidepicstrue % uncomment to hide tikzpicture

\ifhidepics
\tikzset{every picture/.append style={
execute at end picture={
\fill [white] (current bounding box.south west) rectangle (current bounding box.north east);
}}}
\fi

\begin{document}
Something here.

\begin{tikzpicture}
\node at (0,0) {A};
\node at (2,5) {B};
\end{tikzpicture}

More text.

\begin{tikzpicture}
\node at (0,0) {A};
\node at (2,2) {B};
\end{tikzpicture}

Test.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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