Summary
Why and how to modularize a LaTeX project: folder structure,
\inputvs\include, and centralizing metadata.
Prerequisite: Lessons 01β03 (setup, basics, templates).
Why modularize?
Easier to maintain long documents, reuse content/styles across projects, and isolate errors by compiling specific parts.
Recommended project structure
project/
βββ build/ # output (PDF, logs, aux files)
βββ bib/ # bibliography (.bib)
βββ img/ # figures and images
βββ tex/ # chapters and preamble
β βββ metadata.tex
β βββ preamble.tex
β βββ chap1.tex
β βββ chap2.tex
βββ main.tex # main file
βββ Makefile # (optional) build scripts
\input vs \include
\input{file}inserts the content as if it were in the same file.\include{file}creates auxiliary files (.aux) and is great for chapters.
% main.tex
\documentclass{report}
\begin{document}
\include{tex/chap1}
\include{tex/chap2}
\end{document}Metadata (centralize your workβs info)
% tex/metadata.tex
\def\thetitle{Work Title}
\def\theauthor{Full Name}
\def\advisor{Prof. Dr. So-and-so}
\def\theyear{2026}% main.tex
\input{tex/metadata}
\title{\thetitle}
\author{\theauthor}
\date{\theyear}