1

I am a standard user of LaTeX code but I have not used much \tabular. I would like to get a table with vertical text on the left of the table. To do so, I need to merge two cells vertically. For instance, I would like the blue area with the text "Row" being on the whole height of the table. I am stuggeling for one day, I do not think it is hard, but I could not make it, even through many methods. Here is the simplest method I have found. I would be very pleased to get some help. Thank you very much.

\documentclass[9pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage{colortbl}
\usepackage[titletoc,toc,title]{appendix}
\usepackage[export]{adjustbox}
\usepackage{lipsum}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{enumerate}
\usepackage{pbox}
\usepackage{blindtext}

\begin{document}

\begin{tabular}{ c | c | m{60mm} | m{60mm} }

&   & \multicolumn{2}{|c|}{\cellcolor{cyan} Columns} \\ 
&   & \multicolumn{1}{|c|}{\cellcolor{yellow} Column 1} 
& \multicolumn{1}{|c|}{\cellcolor{yellow} Column 2} \\

%%% The following line is related to the merge I would like to get

\multicolumn{1}{c}{\multirow{2}*{\begin{sideways}\cellcolor{cyan}Rows\end{sideways}}}

%%% End of the problem

& \multicolumn{1}{c}{\cellcolor{yellow} \rotatebox{90}{Row 1}}  
& \blindtext & \blindtext \\ \hline
\multicolumn{1}{c}{} & \multicolumn{1}{c}{\cellcolor{yellow
\rotatebox{90}{Row 2}} & \blindtext & \blindtext \\

\end{tabular}

\end{document}

The table I would like to create

1 Answer 1

0

Yes, multirow is part of solution of your problem ... however in its use you need to consider, that right of them is not "two line" text but 38! This means, that \multirow{2}*{...} will not put cell content on the middle of a cell. Another issue, that using coloring multi row cell, the cell should be defined at the last table row with negative number of lines (which it had to span), and cell color should be defined for each cell merged in multi row cell.

So, try, if this work for you:

\documentclass[9pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage[titletoc,toc,title]{appendix}
\usepackage[export]{adjustbox}
\usepackage{lipsum}
\usepackage{rotating}
\usepackage{hhline,multirow}
\usepackage{enumerate}
\usepackage{pbox}
\usepackage{blindtext}

    \begin{document}
    \setlength\arrayrulewidth{3pt}
\begin{tabular}{ c  c  m{60mm}  m{60mm} }
\cellcolor{white}
    &   &   \multicolumn{2}{c}{\cellcolor{cyan} Columns}       \\
\cellcolor{white}
    &   &   \multicolumn{1}{c}{\cellcolor{yellow} Column 1}
            &   \multicolumn{1}{c}{\cellcolor{yellow} Column 2} \\
\cellcolor{cyan}    
    &   \cellcolor{yellow}\rotatebox{90}{Row 1}
        &   \blindtext 
            &   \blindtext                                      \\
\hhline{>{\arrayrulecolor{cyan}}--
        ~~}
\cellcolor{cyan} 
    \multirow{-19}*[1ex]{\rotatebox{90}{Rows}}
    &   \cellcolor{yellow}\rotatebox{90}{Row 2} 
        &   \blindtext 
            &   \blindtext                              
\end{tabular}
    \end{document}

As you can see, I significantly clean-up your code. IN Above MWE design I follow to your provided picture and not to your MWE.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .