en:l_atelier:latex

Ceci est une ancienne révision du document !


LaTeX is a layout programming language used to create scientific and academic documents with precision. Its command-based syntax is reminiscent of the Computer Infrastructure Automation (IAC) approach used by DevOps. Just as IAC enables infrastructure to be described and managed in a reproducible way via code, LaTeX offers similar control over the presentation of documents, enabling complex elements such as mathematical equations and bibliographic references to be managed consistently and efficiently.

Why LaTeX?

As a DevOps we like to master code generation, deployment generation and document generation. That's why LaTeX can be a good replacement for Office or LibreOffice.

Without any particular editor, the code in a LaTeX document is much easier to read than an Office/LibreOffice document, which are saved in the Office Open XML

Personally, although you can write LaTeX documents with an editor such as TeXstudio, you can also use simpler editors such as Nano or Vim. Personally, I use mon my own IDE, based on Vim, which not only lets me edit, reformat, linter and view LaTeX documents, but also, thanks to Nix, download LaTeX packages.

The preamble is used to configure the form of the document and to indicate the additional packages to be downloaded and their configuration. The preamble is inserted between the start of the document and the command \begin{document} commandIt is used to define the document's global configurations, such as the document class, the packages to be used and the metadata.

Here is a simple example

% Define document type and format
% available class :article, report, book, letter, beamer
\documentclass[twocolumn, a4paper, 12pt]{article}
\usepackage[left=0.5in, right=0.5in]{geometry}

% Use french babel
\usepackage{french}

% generate a lipsum paragraph
\usepackage{lipsum}

% Set the title and author
\title{\Huge Document sample}
\author{Bruno Adelé}
\date{5 mai 2024}

%allow underfull vbox (allow empty space at the bottom of the page
\raggedbottom

% Set the space between paragraphs
\parskip=5pt

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

\lipsum[1-2]
\lipsum[6-7]

\end{document}

Sections and subsections in LaTeX are used to organise a document into parts and sub-parts, similar to the way titles are structured in Office. It is also possible to generate a table of contents using the command \tableofcontents. It is also possible to include unnumbered sections in the table of contents by adding an asterisk as a suffix (section*{Title}).

% Define document type and format
% available class :article, report, book, letter, beamer
\documentclass[a4paper, 12pt]{article}

\listfiles

% Use french babel
\usepackage{french}

% generate a lipsum paragraph
\usepackage{lipsum}

% Set the title and author
\title{\Huge Sections list}
\author{Bruno Adelé}
\date{}

%allow underfull vbox
\raggedbottom

% Set the space between paragraphs
\parskip=5pt


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle
\tableofcontents

\section{Section}
\lipsum[1][-2]

\subsection{Subsection}
\lipsum[2][-2]

\subsubsection{Subsubsection}
\lipsum[3][-2]

\subsubsection*{Section without counter}
\addcontentsline{toc}{section}{Section without counter}
\lipsum[4][-2]

\begin{appendix}
    \addtocontents{toc}{\setcounter{tocdepth}{2}}
    \section{Annexes}
    % \addcontentsline{toc}{section}{Annexes}
    \subsection{Liste des ilustrations}
    \listoffigures
    \listoftables
\end{appendix}

\end{document}

Here is a range of text styles.

% Define document type and format
% available class :article, report, book, letter, beamer
\documentclass[a4paper, 12pt]{article}

% Use french babel
\usepackage{french}

% generate a lipsum paragraph
\usepackage{lipsum}

% Set the title and author
\title{\Huge Sections list}
\author{Bruno Adelé}
\date{}

\newcommand{\showsize}[1]{\csname #1 \endcsname $\setminus$#1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\section{Sizes}
\noindent \showsize{tiny}
\showsize{scriptsize}
\showsize{footnotesize}
\showsize{small}
\showsize{normalsize}
\showsize{large}
\showsize{Large}
\showsize{LARGE}
\showsize{huge}
\showsize{Huge}

\section{Styles}
\noindent \textnormal{textnormal} \emph{emph} \textrm{textrm} \textsf{textsf} \texttt{texttt} \textup{textup} \textit{textit} \textsl{textsl} \textsc{textsc} \\
\uppercase{uppercase} \textbf{textbf} \textmd{textmd}

\end{document}

A few tips

draf, showframe

LaTeX is a tool that aims to produce optimal formatting for documents, but when it encounters rules that it cannot apply, it generates warnings or errors. However, these error messages can sometimes be difficult to understand. To resolve these problems, it is possible to activate a debug mode that provides additional information for understanding and correcting errors.

By adding the options draft and showframe options to the \documentclass commandcommand, you can display the borders of the boxes and black out any problem areas.

% Define document type and format
% available class :article, report, book, letter, beamer
\documentclass[draft, showframe, twocolumn, a4paper, 12pt]{article}
\usepackage[left=0.5in, right=0.5in]{geometry}

% Use french babel
\usepackage{french}

% generate a lipsum paragraph
\usepackage{lipsum}

% Set the title and author
\title{\Huge Document sample}
\author{Bruno Adelé}
\date{5 mai 2024}

%allow underfull vbox (allow empty space at the bottom of the page
\raggedbottom

% Set the space between paragraphs
\parskip=5pt

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

\lipsum[3-5]
\lipsum[12]


\end{document}

listfiles

To list installed packages, simply add the command \listfiles in the preamble, at the next compilation via pdflatex you will get the list of files as command output.

*File List*
 article.cls    2023/05/17 v1.4n Standard LaTeX document class
  size12.clo    2023/05/17 v1.4n Standard LaTeX file (size option)
  french.sty    2019/09/06 The e-french package /V6,11/
     msg.sty    2019/01/01 chargement de l'extension de localisation (V0.51).
latexsym.sty    1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
fenglish.sty    2004/06/23 english interface for the french(le/pro) package
  lipsum.sty    2021-09-20 v2.7 150 paragraphs of Lorem Ipsum dummy text
l3keys2e.sty    2024-02-18 LaTeX2e option processing using LaTeX3 keys
   expl3.sty    2024-02-20 L3 programming layer (loader)
l3backend-pdftex.def    2024-02-20 L3 backend support: PDF output (pdfTeX)
  lipsum.ltd
   t1lmr.fd    2015/05/01 v1.6.1 Font defs for Latin Modern
  french.cfg
   ulasy.fd    1998/08/17 v2.2e LaTeX symbol font definitions
 ***********

    • openai
      • Reformulation of sentences
      • Correction of spelling mistakes
  • en/l_atelier/latex.1760184875.txt.gz
  • Dernière modification : 2025/10/11 12:14
  • de badele