mdframed
always creates bad breaks, I tried to solve this and read about people saying it is not supported anymore and that tcolorbox
is a better solution. I recreated my theorem boxes with tcolorbox
but now I'm facing a text alignment issue: when the title gets too long, the alignment changes. I did a comparison between mdframed
with a short title, mdframed
with a long title, tcolorbox
with a short title and tcolorbox
with a long title.
Here is my code :
\begin{boiterouge}[\textbf{\textsc{The-rem} -- title some title mdframed}]
This is some random text
\end{boiterouge}
\begin{boiterouge}[\textbf{\textsc{The-rem}}]
This is some random text
\end{boiterouge}
\begin{tcolorbox}[enhanced,title=\textbf{\textsc{The-rem} -- title some title tcolorbox} ,colframe=rougestyle,coltitle=rougestyle,colback=white,
attach boxed title to top left=
{yshift=-3mm,xshift=4mm},left=2.5mm,top=2mm,bottom=0.5mm,
boxed title style={opacityback=0,colframe=white,size=fbox,arc=0mm},sharp corners]
This is some random text
\end{tcolorbox}
\begin{tcolorbox}[enhanced,title=\textbf{\textsc{The-rem}} ,colframe=rougestyle,coltitle=rougestyle,colback=white,
attach boxed title to top left=
{yshift=-2.5mm,xshift=4mm},
boxed title style={opacityback=0,colframe=white,size=fbox,arc=0mm},sharp corners]
This is some random text
\end{tcolorbox}
Best Answer
My comment is no good! If there is a letter with a depth (g, j, p, q) in the title, the alignment changes
With \vphantom{p}, a letter with a depth, the alignment will be the same. Surely there is better to do.