2

The following LaTeX creates a simple table with some rows grouped with a right curly brace:

\usepackage{multirow}
\usepackage{bigdelim}
...
\begin{tabular}{l|l|l|r}
\hline
$a$ &  $b$ & x&\\
\hline
$cccccc$ & $dddddd$ & x& 
\multirow{3}{*}{}
\rdelim\}{3}{1cm}[long text here]\\
$eeeeee$ & $fffffffff$ &x&\\
$gggggg$ & $hhhhhhhhh$ &x&\\
\end{tabular}

How do I rotate long text here 90 degrees so that it renders vertically>

snim2
  • 451

2 Answers2

3

Try \rotatebox from the graphicx package, as suggested in most of the related questions:

\documentclass{article}
\usepackage{multirow}
\usepackage{bigdelim}
\usepackage{graphicx}

\begin{document}
\begin{tabular}{l|l|l|r}
  \hline
  $a$ & $b$ & x&\\
  \hline
  $cccccc$ & $dddddd$ & x& \multirow{3}{*}{}
  \rdelim\}{3}{1cm}[{\rotatebox[origin=c]{90}{\ long text here\ }}]\\[4mm]
  $eeeeee$ & $fffffffff$ &x&\\[4mm]
  $gggggg$ & $hhhhhhhhh$ &x&\\[4mm]
\end{tabular}
\end{document}
Alex
  • 5,362
1

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} 

enter image description here

Bernard
  • 271,350
  • While spacings between the rows are set by the use of optional argument of \\\ command, it still doesn't work properly. Is it a possibility of shorting braces to obtain a 1 mm space between them (while the spacings between the following rows have default width; link)? I am rather interested in use of longtable environment. – forrest Nov 11 '15 at 22:37