[Tex/LaTex] \input and \include for a thesis

includeinput

I'm writing a thesis but not modular style. I simply write everything in one big document and want to change it. But there is a problem.

For sections must not I start with \begin{document} again? Otherwise, it can't be compiled, but if I do it, for this time my document will have lots of begin command.

What can I do to continue with one document?

Best Answer

You should input your .tex files in this way:

\documentclass[options]{theclass}

%preamble

\begin{document}
\section{section1name}
\input{sec1} %the file is sec1.tex 

\section{section2name}
\input{sec2} %the file is sec2.tex
.
.
.
\end{document}

So latex will paste the text where you call \input{}

include works quite the same but it starts a new page when you call \include{}

That would be the best strategy.


If you want just one file, then write the document in this way:

\documentclass[options]{article}

    %preamble

    \begin{document}
    \section{section1name}

    Write your text as 
    I am writing 
    write your text...

    \section{section2name}

    Same way 
    .
    .
    .
    \end{document}

As you can see, both cases have just one begin-end document.

If you want to avoid numbered sections use the starred command

\section*{}