I have a number of latex files section1.tex
, section2.tex
, etc. Each of them should be able to be compiled individually to give a normal LaTeX document. I would like to write a file master.tex
that will \include
or \input
these files and combine them into a single document.
Note that I do not want to edit the section1.tex
file. Is there an easy way to do this?
I have heard that the standalone
package can do this, but I am having trouble getting the desired behavior.
My attempted master.tex
file:
\documentclass{article}
\usepackage{standalone}
\title{My Book}
\author{Me}
\begin{document}
\maketitle
\include{Section1.tex}
\end{document}
My attempted Section1.tex
file
\documentclass{standalone}
\standaloneconfig{class=article,crop=false}
\begin{document}
\section{Chapter 1}
Contents of Chapter 1.
\end{document}
The main problems I am having are
- There are errors when compiling
Section1.tex
. It states that this file might be missing an \item . There are also an error about needing to insert a}
and then later an error that there are too many}'
s - The
\section{Chapter 1}
line is being cropped and placed as a second page. The "Contents of Chapter 1" are placed at the top of a full page, with no top margin. - None of the text from
Section1.tex
seems to be included inmaster.tex
.
Thank you for your assistance.
Best Answer
Use this master:
and this Section1
If your files are in different folders relative pathes can be wrong. In this case you can use for example the
import
package.