I've got a number of separate .tex
files that are all \documentclass{article}
. I'm inputting these into a \documentclass{book}
file as chapters. In the book.tex
file, then, I've got inputs like this:
\chapter{Chapter One!}
\input{article}
But I want to be able to compile article.tex
separately when I need to. So in article.tex
, I've kept the \begin{spacing}{1.5}
, \end{spacing}
, and \maketitle
commands.
Is there any way to have these commands ignored when I compile book.tex
? The \standaloneignore
command seems to work only for ignoring things above the \documentclass
declaration.
Best Answer
The subfile can use either
\documentclass{article}
, or\documentclass[preview=false]{standalone}
. The class option[preview=false]
for thestandalone
package is only there as you want thearticle.tex
to compile by itself as it normally would. You could also use\documentclass{article}
in the subfile, but the should also add\usepackage{standalone} \standalonetrue
or\newif\ifstandlone \standalonetrue
.If there is specfic code
\begin{document}
inarticle.tex
that you don't want processed use the\ifstandalone
switch as shown belowIn
article.tex
:In
book.tex: