I've seen this answer but it didn't answer my question. I'm trying to get rid of all the \\ I have in my document. I initially put them to force break lines or to insert new lines. I have understood I should use \\ only in tabular environment. So please how to still force break lines or insert newlines without using \\? I have tried \medskip or newline with no success. Using \bgroup\obeylines or \begin{parse lines} doesn't fit my needs.
Below is a picture showing what I want to reproduce. Thanks.
\documentclass[11pt]{book}
\usepackage[paperwidth=20cm, paperheight=29cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{amsmath, amsfonts, amsthm, amssymb}
\usepackage{qtree}
\usepackage{xcolor}
\usepackage{caption}
\usepackage{parskip}
\usepackage{hyperref}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, arrows}
\definecolor{light-gray}{gray}{0.9}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}
\newcommand{\phase}[1]{\par\medskip\textbf{#1}\par\nopagebreak}
\usetikzlibrary{arrows.meta,arrows,chains,automata,shapes,matrix,positioning,scopes,calc}
\RequirePackage[framemethod=default]{mdframed} % Required for creating the theorem, definition, exercise and corollary boxes
\definecolor{ocre}{RGB}{70,50,212} % Define the orange color used for highlighting throughout the book
% Exercice box
\newmdenv[skipabove=7pt,
skipbelow=7pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
backgroundcolor=ocre!10,
linecolor=ocre,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=5pt,
innerbottommargin=5pt,
leftmargin=0cm,
rightmargin=0cm,
linewidth=4pt]{eBox}
\renewcommand{\qedsymbol}{$\blacksquare$}
\newtheorem{exerciceT}{Exercice}[chapter]
\newenvironment{exercice}{\begin{eBox}\begin{exerciceT}}{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{exerciceT}\end{eBox}} %%%%%%%%%%
\newtheorem{exempleT}{Exemple}[chapter]
\newenvironment{exemple}{\begin{exempleT}}{\hfill{\tiny\ensuremath{\blacksquare}\par\medskip\par\nopagebreak}\end{exempleT}}
\begin{document}
\begin{exemple}\medskip
Soit l'expression suivante:
\code{nouvelle\_valeur = ancienne\_valeur + 12}
Après avoir lu les symboles issus de l'instruction de l'exemple ci-dessus, l'analyseur va les regrouper en jetons.
\end{exemple}
Ainsi, considérant cette expression:\medskip \code{nouvelle_valeur = ancienne_valeur + fact * 1}, pendant la phase de génération de code intermédiaire, ce code de haut niveau est traduit dans un langage de bas niveau, c'est-à-dire en langage machine ainsi:
\code{$var_1 = $ int en réel(50)} (Conversion du nombre 50 en réel)\medskip
\code{$var_2 = id_3 * var_1$}\medskip
\code{$var_3 = id_2 + var_2$}\medskip
\code{$id_3 = var_3$}
Plusieurs méthodes existent pour rendre déterministe un automate non détermiste. Nous présentons ci-dessous la \textit{méthode dite des sous-ensembles}.
\newline
\newline
Soit \code{A = (Q,$\Sigma,\delta$,s,F)} un automate déterministe et \code{A' = (Q',$\Sigma',\delta'$,s',F')} un automate non déterministe équivalent.
\newline
\newline
La méthode des sous-ensembles comprend 4 étapes.
\medskip
Déterminez la grammaire $G = (V, T, P, S)$ correspondant à l'automate $Z = {Q, \Sigma, T, q_0, F}$.\medskip
\medskip
La grammaire G est définie ainsi qu'il suit:\medskip
\medskip
$V = Q$, $T = \Sigma$, $S = q_0$ \medskip
$P = {\
q_i \rightarrow aq_j$ lorsque l'automate a pour transition $T(q_i, a) = q_j$ et
$q_i \rightarrow \epsilon \quad \forall \quad q_i, q_j \in F }$
\medskip
D'où:\\
\begin{exercice}\medskip
Construisez l'automate à pile pouvant reconnaître le langage $L = \{w|w = a^nb^m| n \geq m\}$ \medskip
\end{exercice}
\begin{enumerate}
\item Pour l'expression régulière $\epsilon$, l'AFD correspondant est:\medskip
\begin{tikzpicture}[>=Stealth, shorten >=1pt, auto, node distance=1cm, initial text = Début]
\node[initial, state](1){1};
\node[state, accepting](2)[right=of 1]{2};
\path[->] (1) edge node {$\epsilon$} (2);
\end{tikzpicture}
\item Pour l'expression régulière \code{a}, l'AFD correspondant est:\medskip
Ceci n'est pas encore défini.
\end{enumerate}
\end{document}

itemizeenvironment? And if you want spacing between paragraph, you can use theparskippackage, etc.. – Rmano Jan 11 '23 at 12:24\\or\newlineshould be understand as no trying to handformat (as you would do with word processors.) Bref, ne pas rendre les choses inutilement compliquées… – gildux Jan 11 '23 at 21:07\par=blank line), not before. e.g.,A \medskip B \par Capply a medium vertical slip after "B", not after "A", but anyway, this is not the right way to insert some space among paragraphs, but\parskip. – Fran Jan 14 '23 at 12:54