Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
3  
The standalone package (not class) in the main file should help. –  egreg Feb 12 '13 at 22:09
1  
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
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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