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.

Tarass
  • 16,912

1 Answers1

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}
Torbjørn T.
  • 206,688