I would like to adjust the position of a box created with tcolorbox by respecting the values of the horizontal margin on each of the two sides. For instance : I would like to avoid the box to appear like this :
I have specified width = \textwidth but I don't understand why the result appears like this...
Here is my code :
\documentclass{article}
\usepackage{geometry}
\geometry{hmargin=1cm,vmargin=1.5cm}
\usepackage{pgf, tikz, adjustbox}
\usepackage{tcolorbox}
\begin{document}
\tcbset{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, width = \textwidth}
\begin{tcolorbox}[before=\adjustbox{valign=t}\bgroup, after=\egroup]
\textbf{A retenir}
Bla-bla-bla
\end{tcolorbox}
\end{document}
I have specified the margin size with the line \geometry{hmargin=1cm,vmargin=1.5cm} but it seems like it's not respected by the box adjustment.
Thank you for your help,
Best regards.




\layoutshows different dimensions but what is\geometry{hmargin=1cm,vmargin=1.5cm}really fixing ? Is it n°3\oddsidemarginor something else ? Also what is\parindentplease ? – Waxler May 21 '22 at 18:28\parindentis the space (indent) on the first line in the paragraph. I guess hmargin is the horisontal margin (on both sides, total horisontal margin) and vmargin is the vertical margin (on top and bottom). I useleft=andright=to fix the margins. – Vebjorn May 21 '22 at 18:37\noindentbefore the box. See this question: https://tex.stackexchange.com/questions/337771/remove-indent-space-left-of-tcolorbox-box – Vebjorn May 21 '22 at 18:49