[Tex/LaTex] How to have each slide in a separate file, each compilable, then combine them

beamer

I would like to write each slide of a presentation into its own file,
so that I can compile and view each slide, one at a time.
But, I still need to combine all of them to make my presentation.
What's is the way to do that?
I try the following, but it doesn't compile.
includedoc doesn't seems to be there in Beamer.

file: 1.tex

\documentclass{beamer}
\begin{document}
    \begin{frame}
        Content
    \end{frame}
\end{document}

file: slide.tex

\documentclass{beamer}
\begin{document}
    \includedoc{1}
\end{document}

Best Answer

Method 1

The structure of LATEX documents doesn't allow one standalone document to be included as a part of another. docmutepackage tries to remedy this limitation and enables standalone documents to be imported with the standard \input and \include commands just as if they had no preamble.

Use docmute package in the main input file. docmute package will import everything between \begin{document} and \end{document} of the imported file (child.tex in the following example). You can still compile the child.tex as a standalone presentation.

\documentclass{beamer}
\usepackage{filecontents}
\begin{filecontents*}{child.tex}
\documentclass{beamer}
\begin{document}
    \begin{frame}
        Content
    \end{frame}
\end{document}
\end{filecontents*}

\usepackage{docmute}
\begin{document}
    \input{child}
\end{document}

Method 2

Using standalone document class with option beamer for the child (imported) input file and using package standalone in the main input file.

\documentclass{beamer}
\usepackage{filecontents}
\begin{filecontents*}{child.tex}
\documentclass[beamer]{standalone}
\begin{document}
    \begin{frame}
        Content
    \end{frame}
\end{document}
\end{filecontents*}

\usepackage{standalone}
\begin{document}
    \input{child}
\end{document}

Note: using the first method seems to be simpler!

Related Question