1

I want to print a document without the figures. I know it can be done with 'draft' option of documentclass but this does not work for the figures made with circuitikz. Is there a way to accomplish this?

Tash
  • 433
  • BTW, I forgot to mention that all my circuitikz images are defined/made inside the \begin{figure}..\end{figure} environment. – Tash Apr 05 '20 at 22:39
  • I am not aware of a general way. You can try to put \tikzset{opacity=0} at the begin of the document. This will fail if the opacity is set somewhere explicitly. –  Apr 05 '20 at 22:50
  • 2
    Please explain a bit more what you want to achieve. If you wish to blacken out all tikzpictures, just add \tikzset{every picture/.append style={execute at end picture={ \fill[black] (current bounding box.south west) rectangle (current bounding box.north east);}}} at the begin of the document. If you want to suppress all figures completely, this is also possible, but you'd need to explain your goals in a bit more detail. –  Apr 06 '20 at 00:00
  • @Schrödinger'scat: I have a document with images made in circuitikz package. However, in one of my pdf versions, I want all the images to be removed from my pdf (but not from the document). I want to do a similar thing which 'draft' option does it for figures that are included as .jgp, .png etc. But this option does not work on my images made with circuitikz. Please note that I don't want to make them 'Black', i just don't want them to show up. Can you please tell me what specific thing you want to know? – Tash Apr 06 '20 at 03:57
  • If I compile \documentclass[draft]{article} \usepackage{graphicx} \begin{document} \includegraphics{example-image-duck} \end{document} then I get a box with the title of the external graphics. The circuitikz pictures are not external, so they have no file name. What do you want instead? Also, do you have "tikz only" tikzpictures in your document, and if so, what should happen to those? –  Apr 06 '20 at 04:04
  • @Schrödinger'scat: I just want EXACTLY the same thing which [draft] option did for your 'example-image-duck' picture. But I want it for the images created using circuitikz. – Tash Apr 06 '20 at 04:25
  • But the pictures created with circuitikz do not have a filename. What do you want instead of the filename? –  Apr 06 '20 at 04:28
  • The endfloat package can be used to remove all figures and/or tables. – John Kormylo Apr 06 '20 at 17:32
  • @Schrödinger'scat: I just don't care about filenames. I just want as if those images were not there at all. – Tash Apr 08 '20 at 03:21

1 Answers1

4

I just copied some circuitikz code from here and added a key tikzpicture draft. If you

\documentclass[12pt,a4paper]{article}
\usepackage[RPvoltages]{circuitikz}
\newcounter{tikzdraftpicture}
\tikzset{tikzpicture draft/.code={\tikzset{%
every picture/.append style={execute at end picture={\stepcounter{tikzdraftpicture}
\draw[fill=white] (current bounding box.south west) rectangle (current bounding
box.north east);
\path(current bounding box.west) node[right,font=\ttfamily]
{tikzpicture~\number\value{tikzdraftpicture}}; }}}}}
%\tikzset{tikzpicture draft}
\begin{document}
\begin{figure}[h]
\centering
\begin{circuitikz}[scale = 0.5,european]
            % start points
            \coordinate[label=above:B] (B) at (0,0);
            \coordinate[label=above:A] (A) at (0,5);
            \foreach \i in {A,B} {
                \fill (\i) circle (2pt);
            }
            % name the node, and...
            \draw (B) to (4,0) to (4,-1) to[R, name=R1] (8,-1) to (8,0);
            % add the thing
            \node  at (R1.center) {$R$};
            \draw (4,0) to (4,1) to[R, label={$2R$}] (8,1) to (8,0) to (12,0) to[R, l_={$R$}] (12,5) to[] (11,5);
            \draw (A) to[] (1,5) to (1,3) to[R, label={$2R$}] (11,3) to[] (11,5);
            \draw (1,5) to[R, label={$R$}] (6,5) to[R, label={$R$}] (11,5);
\end{circuitikz}
\caption{A circuit.}
\end{figure}

\begin{figure}[h]
\centering
\begin{circuitikz}[scale = 0.5,european]
            % start points
            \coordinate[label=above:B] (B) at (0,0);
            \coordinate[label=above:A] (A) at (0,5);
            \foreach \i in {A,B} {
                \fill (\i) circle (2pt);
            }
            % name the node, and...
            \draw (B) to (4,0) to (4,-1) to[R, name=R1] (8,-1) to (8,0);
            % add the thing
            \node  at (R1.center) {$R$};
            \draw (4,0) to (4,1) to[R, label={$2R$}] (8,1) to (8,0) to (12,0) to[R, l_={$R$}] (12,5) to[] (11,5);
            \draw (A) to[] (1,5) to (1,3) to[R, label={$2R$}] (11,3) to[] (11,5);
            \draw (1,5) to[R, label={$R$}] (6,5) to[R, label={$R$}] (11,5);
\end{circuitikz}
\caption{Another circuit.}
\end{figure}
\end{document}

enter image description here

If you uncomment \tikzset{tikzpicture draft} by removing the % in front of it you will get

enter image description here

  • Thanks you. It actually worked for me. My preference is not to have anything in the place of the picture. I want nothing at all in place of pictures. The main reason is that I want to convert my pdf to .txt and pictures or even placeholders of pictures produce extra symbol which I don't want. So I will keep your solution as a second best if I don't get any other solution where nothing prints in place of pictures. Thanks again for a detailed solution. – Tash Apr 08 '20 at 03:39
  • 1
    @Tash For this you can use this solution. –  Apr 08 '20 at 03:50
  • The solution that you pointed to is perfect...almost. Why I wrote 'almost' is because it still leaves the caption (Figure 1. ABC etc). What if I want to remove that too (as I don't want ANYTHING related to images). I have posted this question to the forum as well ( that you pointed to). BTW, the only change I had to make in that solution is to replace 'tikz' environment with 'circuitikz'. – Tash Apr 08 '20 at 16:26
  • @Tash Then you may want to try out John Kormylo's comment. –  Apr 08 '20 at 19:13