Unfortunately, the solution with the bigdelim
package doesn't seem to work in case \arraystretch
or any rowspacing modifier (\extrarowheight
or the \cellspace
package) is used.
I have a solution with the blkarray
package that seems to works well (the last image below). The three methods are illustrated below. They use \rotatebox
+ \raisebox
; this one helps placing the rotated tex correctly, and makes latex believe it has 0pt width and 0pt height:
\documentclass[12pt]{article}
\usepackage{graphicx, mathtools}
\usepackage{array, multirow, bigdelim}%
\usepackage{blkarray}
\begin{document}
\begin{tabular}{|l|l|l|@{}r}
\cline{1-3}line
$a$ & $b$ & x&\\
\cline{1-3}
$cccccc$ & $dddddd$ & x&
\multirow{3}{*}{}
\rdelim\}{3}{0.4cm}\raisebox{\dimexpr -0.5\totalheight +0.5ex\relax}[0pt][0pt]{\rotatebox{90}{\footnotesize long text here}}
\\%
$eeeeee$ & $fffffffff$ &x&\\
$gggggg$ & $hhhhhhhhh$ &x&\\
\cline{1-3}
\end{tabular}
\\[1cm]
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|l|l|l|@{}r}
\cline{1-3}line
$a$ & $b$ & x&\\
\cline{1-3}
$cccccc$ & $dddddd$ & x&
\multirow{3}{*}{}
\rdelim\}{3}{0.4cm}\raisebox{\dimexpr -0.5\totalheight +0.5ex\relax}[0pt][0pt]{\rotatebox{90}{\footnotesize long text here}}
\\%
$eeeeee$ & $fffffffff$ &x&\\
$gggggg$ & $hhhhhhhhh$ &x&\\
\cline{1-3}
\end{tabular}
\\[1cm]
\begin{blockarray}{|l|l|l|@{}r}%
\cline{1-3}\text{line}
$a$ & $b$ & x&\\
\cline{1-3}
\begin{block}{|l|l|l|r\Right{\}}{\raisebox{\dimexpr -0.5\totalheight +0.5ex\relax}[0pt][0pt]{\rotatebox{90}{\footnotesize long text here}}}}
$cccccc$ & $dddddd$ & x&
\\%
$eeeeee$ & $fffffffff$ &x&\\
$gggggg$ & $hhhhhhhhh$ &x&
\\
\end{block}
\cline{1-3}
\end{blockarray}
\end{document}
