% Preamble of a LaTeX document
\documentclass[12pt,a4paper]{article}

% Declaration of packages
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[a4paper, margin=25mm]{geometry}
\usepackage{amsmath}
\usepackage{siunitx}

% Title and author information
\title{\textbf{A First \latex Document}}
\author{\textbf{Mathieu BONGRAND}\\Subatech, Nantes, France}
\date{\today}

% Declare new commands
\newcommand{\latex}{\LaTeX~}

% Start of the document
\begin{document}

% Generate the title page
%\maketitle

% A custom title page
\input{titlepage.tex}

% Abstract of the document
\begin{abstract}
This is the abstract of the document.
It provides a brief summary of the content and purpose of the document.
If you want you can clear the page after the abstract with the commands
 \texttt{\textbackslash clearpage} or \texttt{\textbackslash newpage}.
Before the table of contents, for example.
\end{abstract}

\newpage

% Table of contents
\tableofcontents

\clearpage

% Introduction
\section*{Introduction}
\addcontentsline{toc}{section}{Introduction}

This is the introduction section of the document.
It provides an overview of the topic and sets the context for the rest of the document.

% Section
\section{\latex editors}
\label{sec:editors}

\subsection{Overleaf editor}

To get started with \latex you can use an online editor like \href{https://www.overleaf.com/}{Overleaf}, 
which allows you to easily create and share LaTeX documents.\\

To start writting your first document, you can refer to the following guide:\\
\href{https://www.overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes}{Learn LaTeX in 30 minutes}

\subsection{PLM \latex}

With your Nantes Université Account, you can also access the PLM \latex resources,
which provide templates and guides for creating \latex documents.
You can find these resources at the following link:\\
\href{https://plmlatex.math.cnrs.fr/}{PLM \latex resources}\\

Be carefull to save all your documents at the end of the year, because they will be erased at the end of each year.

\subsection{Other editors}

You can also use other \latex editors such as TeXMaker, TeXstudio, TeXworks, or LyX, 
which are available for download and installation on your computer.
Visual Studio Code with the LaTeX Workshop extension is also a popular choice for \latex editing.

% Section
\section{Structure of a \latex document}
\label{sec:structure}

A LaTeX document typically consists of the following structure:
\begin{itemize}
    \item \textbf{Preamble:} to declare the document class, load packages and create custom commands.
    \item \textbf{Document:} to write the actual content of your document.
    \begin{itemize}
        \item \textbf{Title page:} to introduce your document.
        \item \textbf{Abstract:} to provide a brief summary of your document.
        \item \textbf{Table of contents:} table of contents, list of figures, and list of tables - to organize your document.
        \item \textbf{Introduction:} to introduce the topic and set the context for your document.
        \item \textbf{Sections:} sections, subsections, and subsubsections to organize your content.
        \item \textbf{Figures and tables:} to include scientific elements in your document.
        \item \textbf{Conclusion:} to wrap up your document and summarize your findings.
        \item \textbf{Bibliography:} to cite sources and references.
    \end{itemize}
\end{itemize}

You can navigate and reference different sections of your document using the \texttt{\textbackslash label} 
and \texttt{\textbackslash ref} commands,
which allow you to create cross-references within your document.
\latex will automatically manage the numbering and references for you, making it easy to keep your document organized and consistent.
For example, I can jumpt to a section (section~\ref{sec:tables}), a table (table~\ref{tab:example})
or a figure (figure~\ref{fig:particles}) from here or just reference them.\\

You can also decide not to number some sections by using the \texttt{\textbackslash section*}.
This works also for figures and tables with the \texttt{\textbackslash caption*}
and equations with the \texttt{\textbackslash equation*}.

% Section
\section{Simple commands}
\label{sec:commands}

Here are some simple LaTeX commands to get you started:
\begin{itemize}
    \item \textbf{Bold text:} \texttt{\textbackslash textbf\{Your text here\}} produces \textbf{Your text here}.
    \item \textit{Italic text:} \texttt{\textbackslash textit\{Your text here\}} produces \textit{Your text here}.
    \item \underline{Underlined text:} \texttt{\textbackslash underline\{Your text here\}} produces \underline{Your text here}.
    \item \texttt{Monospaced text:} \texttt{\textbackslash texttt\{Your text here\}} produces \texttt{Your text here}.
    \item To create a new paragraph, simply leave a blank line in your LaTeX code.
    \item To create a new line without starting a new paragraph, use the command \texttt{\textbackslash\textbackslash}.
\end{itemize}

% Section
\section{Lists and enumerations}
\label{sec:lists}

\subsection{Lists}
\noindent You can create an unordered list in \latex using the \texttt{itemize} environment:
\begin{itemize}
    \item This is an item in an unordered list.
    \item This is another item in an unordered list.
    \item[$\circ$] You can also use custom symbols for list items, like this one \texttt{$\circ$}
    with the command \verb|\item[$\circ$]|.
\end{itemize}

I have uploaded another document which I found on the web, with a more complete list of symbols that you can use in \latex.

\subsection{Enumerations}
You can create an ordered list in \latex using the \texttt{enumerate} environment:
\begin{enumerate}
    \item This is an item in an ordered list.
    \item This is another item in an ordered list.
\end{enumerate}

% Section
\section{Tables}
\label{sec:tables}

Here is an example of a simple table in \latex:
\begin{table}[hhh!]
\centering
\begin{tabular}{|c|c|c|}
\hline
\textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} \\
\hline
\hline
Row 1 & Data 1 & Data 2 \\
\hline
Row 2 & Data 3 & Data 4 \\
\hline
\end{tabular}
\caption{Example of a simple table}
\label{tab:example}
\end{table}

% Section
\section{Figures}
\label{sec:figures}

Here is an example of how to include a figure in your \latex document:\\

\begin{figure}[htb]
\centering
\includegraphics[width=0.5\textwidth]{figures/particles.jpeg}
\caption{Example of a simple figure}
\label{fig:particles}
\end{figure}

Be careful with the size of your figures, to make sure they are not too small for the reader (once printed).
You can adjust the size of your figures using the \texttt{width} or \texttt{height} options in the \texttt{\textbackslash includegraphics} command.
\latex manage the numbering, the placement and references automatically.
You have to use the reference \ref{fig:particles} to see the figure,
 thanks to \texttt{\textbackslash label\{fig:particles\}}.

% Section
\section{Mathematical equations}
\label{sec:equations}

You can include mathematical equations in your \latex document using the \texttt{\textbackslash equation} environment for numbered equations
 or the \texttt{\textbackslash eqnarray} environment for equations resolution.
 You can use shorthand notation for the equation environment: \verb|$equation$| or \verb|$$equation$$|.\\

Here is an example of a simple equation using the \texttt{\textbackslash equation} environment:
\begin{equation}
E = mc^2
\end{equation}

The equation environment is the major advantage of \latex for scientific documents,
as it allows you to write complex mathematical equations with ease and precision.\\

The greek letters are also available in math mode, for example:
\begin{equation}
\alpha + \beta = \gamma
\end{equation}

An example sum with a fraction:
\begin{equation}
S = \sum_{k=1}^{n} \frac{k^2}{k+1}
\end{equation}

A new complex equation with integrals:
\begin{equation*}
I = \int_{0}^{\infty} e^{-x^2} dx
\end{equation*}

The famous Schrodinger equation:
\begin{equation}
i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = -\frac{\hbar^2}{2m} \nabla^2 \Psi(\mathbf{r}, t) + V(\mathbf{r}) \Psi(\mathbf{r}, t)
\end{equation}

An example of a matrix with vectors:
\begin{equation}
\begin{pmatrix}
x_1 \\
x_2 \\
x_3
\end{pmatrix}
=
\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pmatrix}\cdot
\begin{pmatrix}
b_1 \\
b_2 \\
b_3
\end{pmatrix}
\end{equation}

A neutrino oscillation probability:
\begin{equation}
P (\overline{\nu}^{}_e \rightarrow \overline{\nu}^{}_e) 
= 1 - \hspace{0.05cm} \sin^2 2\theta_{12}\, c_{13}^4\, \sin^2 \Delta_{21}
-  \sin^2 2\theta_{13}
\left( c_{12}^2\sin^2 \Delta_{31} + s_{12}^2 \sin^2 \Delta_{32}\right)
\end{equation}
(notation $c_{ij} \equiv \cos \theta_{ij}$ et $s_{ij} \equiv \sin \theta_{ij}$)\\

And here is an example of a resolution of an equation using the \texttt{\textbackslash eqnarray} environment,
representing the energy released in the fusion of two protons with electron capture in the Sun 
($p + e^- + p \rightarrow {}^2H^+ + \nu_e$):
\begin{eqnarray*}
Q & = & m_p + m_e + m_p - [M(2,1) - m_e] - m_\nu\\
 & = & 2 \times 1.007\,276 + 0.000\,548\,6~u - 2.014\,102 + 0.000\,548\,6~u\\
 & = & 0.001\,547\ u \times 931.494\ \text{MeV}\\
 & = & 1.441~\text{MeV}\\
\end{eqnarray*}

An example document \texttt{LaTeX\_Symbols.pdf} has been added to provide you with a longer list of mathematical 
symbols and their corresponding \latex commands.

% Section
\section{Physical units and uncertainties}

Sometimes, you will have to present results with their physical units in text, 
for example the mass of the muon $m_\mu = \SI{105.658}{MeV/c^2}$
or the mass of the tau lepton $m_\tau = 1776.93 \pm 0.09\ \si{MeV/c^2}$,
but the space between the number and its unit (or its uncertainty) can be cut at the end of the line.
This is not really nice to read.

To prevent this, you should use an unbreakable space $\sim$ between the number and the unit,
for example you should write: \verb|$m_\tau = 1776.93~MeV/c^2$| to obtain:\\
$m_\tau = 1776.93~MeV/c^2 $.\\

Sometimes, the units are not written correctly, like the formula just above or in this example $\tau = 2.20\ \mu s$,
while we should read $\tau = \SI{2.20}{\micro\second}$.\\

To prevent this issue, you can include physical units in your \latex document using the \texttt{siunitx} package, 
which provides a convenient way to format and typeset physical quantities with their associated units.\\

You can write a result with \texttt{siunitx} using the following syntax:
\begin{verbatim}
$\SI{number}{unit}$
or $\SI{number \pm uncertainty}{unit}$
or $number \pm uncertainty$ \si{unit}
\end{verbatim}

For example, you can write the mass of the muon as $m_\mu = \SI{105.658}{MeV/c^2}$.
and the mass of the tau lepton as $m_\tau = \SI{1776.93 \pm 0.09}{MeV/c^2}$ 
or $m_\tau = 1776.93 \pm 0.09\ \si{MeV/c^2}$.\\

You can also write results with complex units like:
\begin{itemize}
    \item \si{\kilo\gram\metre\per\square\second}
    \item \si{\metre\squared\per\gray\cubic\lux}
    \item \si{\mole\per\cubic\centi\metre\per\second}
    \item \si{\giga\becquerel\per\second}
    \item \si{\joule\per\mole\per\kelvin}
\end{itemize}

% Section
\section{Bibliography}

You must include a bibliography in your document to cite your sources and references.
You can use the \texttt{\textbackslash thebibliography} environment to create a bibliography manually,
or you can use a bibliography management tool like BibTeX or BibLaTeX to manage your references more efficiently.

For example, from \href{https://arxiv.org}{arXiv} or \href{https://inspirehep.net}{Inspire HEP} you can export the bibliography of a paper in BibTeX format
and then include it in your document using the \texttt{\textbackslash cite} command.  

Then, you can cite the paper in your document like this: \cite{JUNO:2025gmd} or this \cite{JUNO:2025fpc}.

% Conclusion
\section*{Conclusion}
\addcontentsline{toc}{section}{Conclusion}

I hope this tutorial has provided you with a good starting point for creating your first \latex document 
and convinced you to use \latex for your future documents (internship reports, PhD thesis...).

% Bibliography
\bibliographystyle{unsrt} 
\bibliography{references.bib}

% End of the document
\end{document}