I added to my colorboxes the option to shift on the x axis.
Nevertheless one problem emerged : the box is doing something symmetrical and when I move it to the right, the left also goes towards the center, making the box really small. How to counter this effect ?
Here is the code (if something is still redundant, please tell me. I'm trying to know how to do MWE).
\documentclass[10pt,a4paper,twoside,openright]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=2.5cm,right=2.5cm,top=4cm,bottom=4cm]{geometry}%réglages des marges du document selon vos préférences ou celles de votre établissemant
\setlength{\headheight}{15pt}% hauteur de l'entête
\usepackage{amsmath,amsfonts,amssymb}%extensions de l'ams pour les mathématiques
\usepackage{fancyhdr}%pour les entêtes et pieds de pages
\usepackage[most]{tcolorbox}
\usepackage[english,french]{babel}%pour un document en français
\definecolor{viol}{RGB}{134,0,175}
\tcbset{
thmbox/.style={
enhanced,
breakable,
sharp corners=all,
fonttitle=\bfseries\normalsize,
fontupper=\normalsize\itshape,
top=0mm,
bottom=0mm,
right=0mm,
%colback=white,
colframe=white,
colbacktitle=white,
%coltitle=red,
before={\vspace{0.1cm}},
after={\vspace{0.3cm}},
attach boxed title to top left={xshift=-.20\linewidth, yshift= -.5 mm},
minipage boxed title=.15\linewidth,
left skip={0.09\linewidth},
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
boxed title style={empty, size=minimal, bottom=1.5mm},
overlay unbroken ={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)|-%
(frame.south east)--(frame.north east);},
overlay first={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
\draw (frame.north east)--(frame.south east);},
overlay middle={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
\draw (frame.north east)--(frame.south east);},
overlay last={
\draw ([xshift=3.5mm]frame.north west)|-%
(frame.south east)--(frame.north east);},
},
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEMONSTRATION
SQ/.style={thmbox, coltitle=viol, colback=white!95!viol, left skip={.12\linewidth},
overlay unbroken ={
\draw[viol][thick] (title.south west)--(title.south east);
\draw[viol][thick] ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
\node[anchor=east] at (frame.south east) {$\square$};},
overlay first={
\draw[viol][thick] (title.south west)--(title.south east);
\draw[viol][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay middle={
\draw[viol][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay last={
\draw[viol][thick] ([xshift=3.5mm]frame.north west)|-([xshift=3.5mm]frame.south west);
\node[anchor=east] at (frame.south east) {$\square$};},
}
}
\newtcbtheorem[auto counter, number within=section]{demo}{Démonstration}{thmbox,SQ}{theo}
\begin{document}
hi !
\begin{demo}{}{}
OH!
\end{demo}
\end{document}
moreover I have a subsidiary question: how can I move a little bit the square (that appears in the pdf document) ? I want it to be in the box and not half outside like it is currently.