[Tex/LaTex] tcolorbox: raster of equal height and a minimum height

tcolorbox

I would like to make a tcolorbox raster, where every box in a row has the same height (easy). But I would also like to use the height from key to set a minimum height for the boxes. But as soon as I do it, I loose the equal height feature. Is there a way to combine both?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[many]{tcolorbox}
\begin{document}

\tcbset{enhanced,left=1cm}
\tcbset{marktext/.style={overlay={\node[rotate=90,text=black,anchor=north east] at (frame.north west){#1};}}}
\begin{tcbraster}[raster columns=3,raster equal height=rows]
\begin{tcolorbox}[marktext=shorter]
blbllb
\end{tcolorbox}
\begin{tcolorbox}[%height from=3cm to 30cm,
                  marktext=somelonger text]
blbllb\\blblb\\blblb\\blblb
\end{tcolorbox}
\begin{tcolorbox}[marktext=short]
blbllb
\end{tcolorbox}
\begin{tcolorbox}[marktext=x]
blbllb
\end{tcolorbox}

\end{tcbraster}
\end{document}

Result (with equal heights in the row but too small minimum height):

enter image description here

Result when the height from is used (middle box is large enough, but equal height is lost):

enter image description here

Best Answer

With minimum for equal height group, a lower minimal height can be given to an equal height group. Inside a raster, the name of the current equal height group is generated automatically or can be set by raster equal height group.

In my proposed solution, I use \tcb@ehgid, the internal name of the current equal height group. The minimum for equal height group is called with this name and the width of the side text plus some additional space:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[many]{tcolorbox}
\begin{document}

\tcbset{enhanced,left=1cm}

\makeatletter
\tcbset{marktext/.style={%
  overlay={\node[rotate=90,text=black,anchor=north east] at (frame.north west){#1};},
  code={\setbox\z@=\color@hbox#1\color@endbox\tcbdimto\myheight{\wd\z@+3mm}},
  minimum for equal height group=\tcb@ehgid:\myheight,
  }}

\makeatother

\begin{tcbraster}[raster columns=3,raster equal height=rows]
\begin{tcolorbox}[marktext=shorter]
blbllb
\end{tcolorbox}
\makeatletter
\begin{tcolorbox}[marktext=somelonger text]
blbllb\\blblb\\blblb\\blblb
\end{tcolorbox}
\makeatother
\begin{tcolorbox}[marktext=short]
blbllb
\end{tcolorbox}
\begin{tcolorbox}[marktext=x]
blbllb
\end{tcolorbox}

\end{tcbraster}
\end{document}

This gives:

enter image description here

Note that this tweaked marktext will raise an error, if no equal height group is set.

Related Question