sorry cause I know it's a current trouble but I cannot find a reliable source to solve my problem: I'm using LaTeX and my figures are going all over the place even when I'm using [h], it looks like LaTeX is trying to use efficiently the place of the pages but it's not what I want at the end.
here the packages I'm using:
\usepackage[francais]{babel}
\usepackage{multirow}
\usepackage{titling}
\usepackage{titlesec}
\usepackage[colorlinks, urlcolor=blue]{hyperref}
\usepackage{xcolor}
\usepackage{bbding}
\usepackage{enumitem}
\usepackage{geometry}
\usepackage{graphicx}
\graphicspath{{LaTeX/Chap4/}}
\definecolor{rose_saumon}{RGB}{255,134,106}
\definecolor{beige}{RGB}{255,239,213} % Définir une couleur orange clair% Définir une couleur rose saumon
\usepackage{tabularx}
\usepackage{tcolorbox}
\usepackage{pifont}
\titleformat{\section}{\normalfont\Large\bfseries\raggedright}{Chapitre \thesection}{1em}{}
\geometry{hmargin=2.5cm,vmargin=2cm}
and then, in my code we have:
\section{Protocol}
\begin{tcolorbox}[colback=beige,colframe=rose_saumon,sharp corners,title=\textbf{Exercice 4.1 (A Rendre)}]
Enoncé de mon exercice\
\begin{enumerate}[label=\PencilRightDown] % PencilRightDown symbol
\item Indication
\end{enumerate}
\end{tcolorbox}
Juste un texte encore lambda.\
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{machine.png}
\caption{Machine}
\end{figure}
Suite de phrases après laquelle commence mon illustration.\
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{machine.png}
\caption{Machine}
\end{figure}
\begin{tcolorbox}[colback=beige,colframe=rose_saumon,sharp corners,title=\textbf{Exercice 4.2 (A )}]
Texte lambda
\end{enumerate}
\end{tcolorbox}
\end document
So I have my section, I entered some text then I insert an image followed by another text and then an image again after that I would like to have my color box. But here is what happens, my colorbox is small and my second image cannot occupy the rest of the page where my first image is, so LaTeX sets my colorbox before my second image even when I'm precising [h] for that second figure!
I tried what ChatGPT advised me, I used the option [h], [!h], [ht]. It's not working even when I'm using this option on my colorbox. I also tried using subsection even if I don't want the numbers of the subsection to appear. And unfortunately, this option only works if I let LaTeX display the numbers of the subsections but once I remove them the problem comes back. I also read about the package float but I'm really unsure with this option cause I fear it'll cause me problem later, this is why I need so much of your advices cause it's gonna be a very long document so it's important I manage properly the position of my items. Thanks for your help!
[h]is very restrictive and normally generates a warning that latex is changing it to[ht]but the only reason to include an image infigureis to allow it to be moved, so what you describe sounds like expected behaviour. – David Carlisle Dec 11 '23 at 17:23\\like this:Juste un texte encore lambda.\\you must get a warning from latex about that? – David Carlisle Dec 11 '23 at 17:24\\does not end the paragraph, you get a single paragraph with a line break. use a blank line in the source to end a paragraph. the form you used will give a badness 10000 message with standard settings – David Carlisle Dec 14 '23 at 08:09[H]for non floating figures or usecapt-ofpackage and\captionof{figure}{abc ...}– David Carlisle Dec 14 '23 at 09:38