# Making Tikz shapes/surfaces that don't appear in the PDF

I want that my tex-editor shows me the 2-holes of a A4 sheet, but don't appear in the output PDF.

Note: I don't want to use % and comment the circle's out and compile it again. The reason is, that I will have thousands of .tex files and it wouldn't be efficient to compile every time twice.

If i make a circle with tikz, then the output PDF will have the 2 holes:

    \documentclass[11pt,twoside,german]{article}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,condensed,light]{roboto}
\usepackage[utf8]{inputenc}
\usepackage[paperwidth=210 mm,paperheight=297 mm,left=0mm,right=0mm,top=0mm,bottom=0mm]{geometry}
\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{scrextend}

\begin{document}
\ClearShipoutPicture
\AtPageLowerLeft{%
\begin{tikzpicture}%[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(0,0) rectangle (21,29.7);
\draw [fill=black!10!] (1.2,10.85) circle (3mm);
\draw [fill=black!10!] (1.2,18.85) circle (3mm);
\end{tikzpicture}
}
}

some text

\vspace*{10cm}

some times i need this part

\vspace*{2cm}

\end{document}


How can I hide these 2 holes at the output PDF, but see them in the tex-editor? Thanks for helping!

• HI ! What do you mean by editor ? – flav Feb 10 at 8:35
• TexStudio, TeXShop etc.... – Bilal Yilmaz Feb 10 at 8:37
• Nice trick, I'd comment out the part which creates the holes and compile it again – TVL Feb 10 at 8:41
• Yes i did this first. But i will have thousends of .tex files. And going everytime inside the .tex file and compiling it 2 times will not be efficient. And also i could forget it to comment it at the end, which is not good – Bilal Yilmaz Feb 10 at 8:43
• Good point and I got your point in showing them in the editor. I've never seen that somewhere in the setting of TeXStudio, at least. – TVL Feb 10 at 8:45

You can put the holes on a separate OCG layer, that is not printed:

 \documentclass[11pt,twoside,german]{article}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,condensed,light]{roboto}
\usepackage[utf8]{inputenc}
\usepackage[paperwidth=210 mm,paperheight=297 mm,left=0mm,right=0mm,top=0mm,bottom=0mm]{geometry}
\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{ocgx2}
\usepackage{scrextend}

\begin{document}
\ClearShipoutPicture
\AtPageLowerLeft{%
\begin{ocg}[printocg=never]{holes}{holes}{1}
\begin{tikzpicture}%[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(0,0) rectangle (21,29.7);
\draw [fill=black!10!] (1.2,10.85) circle (3mm);
\draw [fill=black!10!] (1.2,18.85) circle (3mm);
\end{tikzpicture}
\end{ocg}
}
}

some text

\vspace*{10cm}

some times i need this part

\vspace*{2cm}