# LaTeX - Document Organization

October 2016

## The organization of a LaTex document

A number of commands can be used to organize LaTeX documents. Specifically, you can organize the document into parts and subparts with the following commands:

\part{title}, \chapter{title}, \section{title}, \subsection{title}, \subsubsection{title}, \paragraph{title}, \subparagraph{title}.

Not all of these commands are available for all classes and some may differ according to the class being used (different spacing among others). For example, the \chapter command will not taken into account when use with the article class!

In addition to the creation of titles for each part, these commands can be used by LaTeX to create table of contents. However, if you do not want to display a particular title in the table of contents, simply use an asterisk in front of the tirle name. For example:

\subsection*{title}

To view the table of contents in the final LaTeX document, just enter the \tableofcontents command after the \begin{document} command.

## Using multiple LaTeX files

Another convenient method for organizing a LaTeX document is to make use of several LaTeX files to create one final document. To do this, simply create a main document, containing the header, the annexed .tex files (which will be included in the final document).

Only the main file will contain header, the \begin{document} and \end{document} commands. The main file will take care of the layout settings, change of extensions ...etc

Example:
\documentclass[a4paper,11pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[normalem]{ulem}
\usepackage[french]{babel}
\usepackage{verbatim}
\usepackage{graphicx}

\title{Test}
\author{Luc LACHENY et Dominique Pillou}
\date{}

\begin{document}

\maketitle \clearpage
\tableofcontents \clearpage
\input{test1}
\input{test2}
\end{document}

Code for first annexed file test1.tex :

\section{Pourvu que ça marche}
Ah oui, vraiment !
\clearpage

Code for second annexed file test2.tex :

\section{Et si ça ne marche pas, c'est que c'est pas ça !}
Ah oui, vraiment !
\clearpage

You can use references to (previously defined) objects. The label{name of reference} command sets the reference.
The \ref{name of reference} command allows you to make use of the number of the reference.
The \pageref{name of reference} can be used to call the page number of the reference.

To use numbering and tables, the reference name must be written as follows:
• {fig:name of the figure} : for a figure
• {tab:name of the table} : for a table
• {section:name of the section} : for a section
• {subsection:name of the subsection} : for a subsection

etc.

Original document published on CommentcaMarche.net

Related :