To write the handouts I use a command called \exo which displays in bold and automatically increments the exercise numbers.
It has an optional parameter which is the grade obtained for the exercise during an evaluation.
I improved it thanks to @egreg's answer here so that there is always a little bit of white space to write the grade next to the scale and it works very well.
But now the next line is fully justified instead of left aligned (which is what I want to achieve). For example the sentence "Compléter le tableau suivant et indiquez vos calculs:" is not left justified.
What is my mistake?
Translated with www.DeepL.com/Translator (free version)
\documentclass[a5paper,12pt,french]{article} % Présentation générale et mise en page
% Marges de la page
\usepackage[left=0.3cm, right=0.3cm, top=1cm, bottom=0cm]{geometry}
% pas de retrait de paragraphe
\setlength{\parindent}{0mm}
\usepackage{array}
\usepackage[output-decimal-marker={,}]{siunitx}
\sisetup{locale=FR}
% --------------------------------------
% Nouvelle commande \exo pour numéroter les exercices
% --------------------------------------
\usepackage{ifthen}
\newcounter {EX} \setcounter{EX}{0}%compteur pour numéroter avant le \newcommand {\exo} ce sont des entiers (et non des décimaux)
\newcommand {\exo}[2][]{ %barème optionnel
\stepcounter{EX} %
\par \vspace{1em} %
\underline{\textbf{Exercice,\theEX,:}}\textbf{ #2}%
\ifthenelse{\equal{#1}{}} %
{\par} %
{\newdimen \p%
\p=#1cm %
\ifdim \p<2cm
% egreg solution https://tex.stackexchange.com/a/91564/138900
\nobreak\hfill\penalty50\hskip1em\null\nobreak
\hfill\makebox[5mm]{}/\num{#1}~point \parfillskip=0pt \finalhyphendemerits=0 \par
\else
\nobreak\hfill\penalty50\hskip1em\null\nobreak
\hfill\makebox[5mm]{}/\num{#1}~points \parfillskip=0pt \finalhyphendemerits=0 \par
\fi} %
}
\begin{document}
\thispagestyle{empty}
\pagestyle{empty}
\exo[3]{On agrandit une pièce triangulaire d'un puzzle tel que le côté qui mesure \SI{4}{cm} mesure \SI{4.8}{cm} sur le triangle agrandi}
Compléter le tableau suivant et indiquez vos calculs:
\exo[2,5]{Lors de sa construction en 1889, la tour Eiffel mesurait \SI{300}{m} de haut.}
Un modèle réduit en bois de la tour Eiffel mesure \SI{0,12}{m} de haut.
La largeur de ce modèle réduit est de \SI{0,05}{m}. Quelle est la largeur de la tour Eiffel?
\exo[2.5]{Lors de sa construction en 1889, la tour Eiffel }
\end{document}



\newdimen \poutside the definition, you are allocating a new register each time. – David Carlisle Apr 16 '21 at 16:22%at end of line doesn't suppress space if you leave space before it.\stepcounter{EX} %should be\stepcounter{EX}%(and all similar lines) – David Carlisle Apr 16 '21 at 16:26