[Tex/LaTex] tcolorbox with title on the left side

boxespositioningtcolorbox

How can I put the title of a box (with tcolorbox) on the left side (text rotated by 90°), like this?

 _______________________________
|   |                           |
| T | Lorem ipsum               |
| I | blah blah                 |
| T |                           |
| L |                           |
| E |                           |
|___|___________________________|

TITLE is rotated by 90°, not like in the ASCII pic. It's just me or this is not specified at all in the manual?

Best Answer

You could use a detached title and add it to an enlarged margin:

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\tcbset{%
    enhanced,
    coltitle=black, 
    detach title,
    left=10mm,
    overlay={
        \node[rotate=90, minimum width=1cm, anchor=south,yshift=-0.8cm] at (frame.west) {\tcbtitle};
    }
}

\begin{document}

\begin{tcolorbox}[title=test]
\lipsum[1]
\end{tcolorbox}

\end{document}

enter image description here

Or if you prefer a separation line between the title and the text:

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{mybox}[2][]{
    enhanced,
    coltitle=black, 
    title={#2},
    sidebyside,
    detach title,
    attach title to upper={\tcblower},
    lefthand width=0.3cm,
    #1
}

\makeatletter
\renewcommand\tcbtitle{\ifx\tcbtitletext\@empty\else%
  \leavevmode{\rotatebox{90}{\color{tcbcol@title}\kvtcb@fonttitle\kvtcb@haligntitle\kvtcb@before@title\tcbtitletext\kvtcb@after@title}}\fi}
\makeatother

\begin{document}

\begin{mybox}{Title}
\lipsum[2]
\end{mybox}

\end{document}

enter image description here