I would like to use \usepackage{filecontents} to write another version of my document to a file later with \write18 and compile it.
My question is: How do I create a custom \begin{document} to handle the writing of the file in my template1.tex and including it later?
I would like to have something like this:
\documentclass{beamer}
\begin{customdocument}
//frames
\end{customdocument}
Intention: My custom document environment writes the content of customdocument into a second tex file and compile it with different options.
Output: Two files (one with notes and one without) but ONE working file.
I tried creating a new environment but then got the error of missing \begin{document}
Minimal example:
\documentclass{beamer}
\usepackage{filecontents}
\usepackage{docmute}
\begin{filecontents*}{template1.tex}
\documentclass{beamer}
\begin{document}
\begin{frame}{A frame}
Foo
\end{frame}
\end{document}
\end{filecontents*}
\immediate\write18{pdflatex -jobname=\jobname _notes\space template1}
\begin{document}
\input{template1}
\end{document}
pdfpages. If not, please explain it better. – Ignasi Apr 08 '16 at 10:46