I have both \maketitle \tableofcontents in the root file and child file when using subfiles package. When I compiling the child file, it works OK. But when I compiling the root file, the title and author information and an extra 'Content' are also appeared. I do not know how to erase these informations.
I tried to use macros to control the actions. But it does not work very well.
I have several puzzles.
1.Does the new definition of the variable in child file erased its value transfered from root file?
2.Is there a command to test if a variable here like multiple has already been difnied?
3.When debugging latex, how to output the value you definied in latex?
4.Are there any other graceful ways to achieve my aim?
Thank you!
Here is the root file named root.tex
\documentclass[a4paper, 12pt]{article}
\usepackage{subfiles}
\newif\ifmultiple %\multipletrue means called by main file
\multipletrue
\author{Ct586}
\title{How to use subfiles}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\subfile{child}
\end{document}
Here is the child file named child.tex:
\documentclass[Dynamic.Network.Embryonic.Development.tex]{subfiles}
\newif\ifmultiple %\multipletrue means called by main file
%\multipletrue
\ifmultiple
\begin{document}
\else
\author{Ct586}
\title{How to use subfiles}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\fi
\section{child}
child
\end{document}

standalone packageuseful. The package is more recent and actively maintained. – Brent.Longborough Mar 31 '12 at 15:25standalonelooks very powerful. Thank you. I will try to use it. And also I wonder how to make my way, setting a variable, work? – ct586 Apr 1 '12 at 1:07verbatimpackage has acommentenvironment which will allow you to configure your document according to whether it is called from the master or not. I'm sorry I can't give you a proper answer, but I'm completely overwhelmed by stuff at the moment. – Brent.Longborough Apr 1 '12 at 11:07