# LaTeX: Using input command for document organization

📅 2010-May-27 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ latex, organization ⬩ 📚 Archive

Creating and maintaining a large LaTeX document using a single `.tex` file can be painful. It would be wise to organize it as sections, with one or more `.tex` files for each section.

For example, a large `Report.tex` could be broken into 2 smaller sections: `01-Intro.tex` and `02-Results.tex`. These files can be included into the main `Report.tex` using the *** command like this:

``````% Report.tex
\input{01-Intro.tex}
\input{02-Results.tex}``````

If `01-Intro.tex` and `02-Results.tex` include a lot of images, then it might be nice to move them and their respective images/files into their own subdirectories, say `01-IntroDir` and `02-ResultsDir`. In that case, `Report.tex` is changed to:

``````% Report.tex
\input{01-IntroDir/01-Intro.tex}
\input{02-ResultsDir/02-Results.tex}``````

Note that the command just pulls the text from `01-IntroDir/01-Intro.tex` into the main `Report.tex` for compilation. Thus, inside `01-IntroDir/01-Intro.tex` commands like `\includegraphics` still need to provide the full path of their image relative to the main `Report.tex`:

``````% 01-IntroDir/01-Intro.tex

% Image IntroPic.png is in 01-IntroDir

% This does not work:
\includegraphics{IntroPic.png}

% This is how to correctly include:
\includegraphics{01-IntroDir/IntroPic.png}``````