Researa LogoReseara
Start free
Learn Hub/GUIDE 01 / 13Foundations
Quick syntax:\documentclass{article} \begin{document} \section{Introduction}

Learn LaTeX

LaTeX turns a plain text file into a typeset PDF. You write the content and mark its structure, and LaTeX takes care of the layout, the numbering and the references. This guide covers what you need for a report: structure, text, math, figures, tables and citations.

What LaTeX is

LaTeX (say "LAY-tek" or "LAH-tek") is a typesetting system used across science and engineering. You write a .tex file with commands such as \section{Introduction}, then compile it into a PDF. You never drag a heading into place or renumber a figure by hand: you say what each part is, and LaTeX decides how it looks.

Why people write reports in it

  • Equations: math looks the way it does in textbooks, with no equation editor.
  • Numbering: chapters, figures, tables and equations number themselves, and every reference to them updates.
  • Citations: keep your sources in one file and LaTeX builds the bibliography in the style you pick.
  • Consistency: the class and packages set the styling once, so page 80 looks like page 3.
  • Plain text: the source works with Git, diffs cleanly and never gets corrupted.

Your first document

A LaTeX file has two parts. The preamble, before \begin{document}, picks the document class and loads packages. The body, between \begin{document} and \end{document}, holds what you actually write.

\documentclass{article}
\usepackage{amsmath}

\title{My First Document}
\author{Your Name}
\date{\today}

\begin{document}

\maketitle

\section{Introduction}
Hello, LaTeX! This is my first document.

\section{Mathematics}
Here is an equation in the text: $E = mc^2$.

And one on its own line:
\[
  \int_0^\infty e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
\]

\end{document}

Compile it and you get a PDF with a title block, two numbered sections and both equations. Lines starting with % are comments and never appear in the output.

Document classes

The first line chooses the class, which sets the overall layout:

  • article: short documents and papers. Sections, no chapters.
  • report: longer documents with chapters. Most PFE reports and theses use it.
  • book: like report, with front matter and pages laid out for printing on both sides.
  • beamer: slides.
  • letter: formal letters.

A report with chapters

A report adds \chapter above \section. This skeleton sets A4 paper, 12 pt text, French headings and a table of contents:

\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}   % "Chapitre", "Table des matières", ...

\begin{document}

\tableofcontents

\chapter{Introduction générale}
\section{Contexte du projet}
Ce rapport présente ...

\chapter{État de l'art}
\section{Solutions existantes}

\end{document}

The table of contents fills in on the second compile, because LaTeX first has to see where each chapter lands. Researa runs the extra passes for you.

Packages

Packages add features. Load them in the preamble with \usepackage. These cover most reports:

\usepackage{amsmath}    % Multi-line equations, \eqref, \text
\usepackage{graphicx}   % \includegraphics for images
\usepackage{booktabs}   % \toprule, \midrule, \bottomrule in tables
\usepackage{geometry}   % Page size and margins
\usepackage{listings}   % Source code listings
\usepackage{hyperref}   % Clickable references and links (load it last)

Text formatting

CommandResult
\textbf{bold}bold
\textit{italic}italic
\emph{emphasis}emphasis
\underline{underline}underline
\texttt{monospace}monospace

Prefer \emph for stressing a word: it switches to upright text when the surrounding text is already italic. More in Bold, Italics and Underline.

Lists

% Bullets
\begin{itemize}
  \item First item
  \item Second item
\end{itemize}

% Numbers
\begin{enumerate}
  \item First step
  \item Second step
\end{enumerate}

Lists nest by putting one inside an \item. Custom labels and spacing are in the lists guide.

Math

Put math inside $...$ for an inline formula, or \[...\] for a formula on its own line. Use align from amsmath for several lines lined up on &:

The theorem $a^2 + b^2 = c^2$ holds for right triangles.

\[
  \sum_{i=1}^{n} i = \frac{n(n+1)}{2}
\]

\begin{align}
  f(x) &= x^2 + 2x + 1 \\
       &= (x + 1)^2
\end{align}

align numbers every line; align* numbers none. The math guide goes further.

Figures

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{architecture.png}
  \caption{Overall architecture of the solution}
  \label{fig:architecture}
\end{figure}

This needs graphicx. [htbp] lets LaTeX place the figure here, at the top or bottom of a page, or on a page of its own, whichever fits best. Always put \label after \caption, or the reference picks up the wrong number.

Tables

\begin{table}[htbp]
  \centering
  \caption{Comparison of the tested models}
  \label{tab:models}
  \begin{tabular}{lcc}
    \toprule
    Model & Accuracy & Time (s) \\
    \midrule
    Baseline & 0.81 & 12 \\
    Ours     & 0.89 & 9  \\
    \bottomrule
  \end{tabular}
\end{table}

lcc sets three columns: left, centre, centre. & separates cells and \\ ends a row. Table captions usually go above the table. The rules come from booktabs; the tables guide covers merged cells and long tables.

Cross-references

Anything with a \label can be referenced by its number, and the number stays right when you reorder chapters:

As Figure~\ref{fig:architecture} shows, ...
The results are in Table~\ref{tab:models}.
Chapter~\ref{chap:intro} sets out the context.
Equation~\eqref{eq:energy} gives the total energy.

The ~ is a space that never breaks, so "Figure" and its number stay on the same line. \eqref (from amsmath) adds the parentheses around equation numbers.

Citations and bibliography

Keep your sources in a separate file, for example references.bib:

@article{einstein1905,
  author  = {Einstein, Albert},
  title   = {On the Electrodynamics of Moving Bodies},
  journal = {Annalen der Physik},
  year    = {1905},
  volume  = {17},
  pages   = {891--921}
}

Then cite by key and print the list where it belongs, usually at the end:

As Einstein showed~\cite{einstein1905}, ...

\bibliographystyle{plain}
\bibliography{references}   % the file name, without .bib

Only cited entries appear in the list. plain sorts it alphabetically and numbers it; your school or journal may ask for another style. Most reference managers, Zotero included, export straight to .bib.

When it will not compile

Three errors account for most beginner trouble:

  • Undefined control sequence: a command is misspelled, or comes from a package you have not loaded.
  • Missing $ inserted: a math symbol such as _ or ^ is used outside math. Wrap it in $...$, or write \_ if you meant the character.
  • Special characters: # $ % & _ { } mean something to LaTeX. Write \%, \& and so on to print them.

The log gives the line number, so start there. In Researa, the AI reads the log and proposes a fix.

Where to go next

For your PFE report

READY TO WRITE YOUR REPORT OR THESIS?

Write in Researa. Present in Researa Slides.

Draft your LaTeX manuscript with AI assistance and verified citations, then turn your finished PDF into a defense slide deck in minutes.