# #ifdef analog for LaTeX

For example there is a simple tex-file with following text:

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (0.4cm);
\end{tikzpicture}
\end{document}


Is it possible to modifiy it so: if I \include it another TeX file it is compiled as a picture in a document, while if it is compiled alone (say:pdflatex myfile.tex) it results in a standalone pdf file as the unmodified file?

-
The standalone package (not class) in the main file should help. –  egreg Feb 12 '13 at 22:09
Does stackoverflow.com/a/2703707 answer the question? –  e-birk Feb 12 '13 at 22:17
You won't be using \include, but \input: the former always adds a page break. –  egreg Feb 12 '13 at 23:42
The standalone package is just what I needed! Thanks :) –  Iohann Feb 13 '13 at 9:45

Working example tex-file using standalone package (based on answer by egreg):

master.tex file:

\documentclass[a4paper,10pt]{scrartcl}
\usepackage{tikz}
\usepackage{standalone}
\begin{document}
\begin{figure}[p!]
\begin{center}
\input{myfile}
\end{center}
\caption{That's it!}
\label{fig:standalone}
\end{figure}
\end{document}


Where myfile.tex contains text from the initial question.

-