2

the following code:

\documentclass{article}
\usepackage{mwe}
\usepackage{multirow,makecell}
\usepackage{graphbox} %loads graphicx package
\begin{document}
\begin{tabular}{c|c|c|c}
\multirow{3}{*}{\rotatebox[origin=c]{90}{Text}} 
    & ro1 1 & \includegraphics[align=c,scale=0.25]{example-image} & text\\ 
    & row 2 & \includegraphics[align=c,scale=0.1]{example-image} & text\\
    & row 3 & \includegraphics[align=c,scale=0.4]{example-image} & text\\ 
\end{tabular}

\vspace{1cm}

\begin{tabular}{c|c|c|c}
    \multirow{3}{*}{\rotatebox[origin=c]{90}{Text}} 
    & row 1 & without example-image & text\\ 
    & row 2 & without example-image & text\\
    & row 3 & without example-image & text\\ 
\end{tabular}
\end{document}

gives me the following output:

enter image description here

Is it possible to center the rotated text?

2
1

enter image description here

\documentclass{article}
%\usepackage{mwe}
\usepackage{multirow,makecell}
\usepackage[demo]{graphicx} %loads graphicx package
\begin{document}
    \begin{tabular}{c|c|c|c}
        \multirow{10}{*}{\rotatebox[origin=c]{90}{Text}} 
        & ro1 1 & \includegraphics[scale=0.25]{example-image} & text\\ 
        & row 2 & \includegraphics[scale=0.1]{example-image} & text\\
        & row 3 & \includegraphics[scale=0.4]{example-image} & text\\ 
    \end{tabular}
    
    \vspace{1cm}
    
    \begin{tabular}{c|c|c|c}
        \multirow{8}{*}{\rotatebox[origin=l]{90}{Text}} 
        & row 1 & \makecell[l]{without example-image  \\ without example-image \\ without example-image}& text\\ 
        & row 2 & \makecell[l]{without example-image  \\ without example-image \\ without example-image}& text\\
        & row 3 & \makecell[l]{without example-image  \\ without example-image \\ without example-image} & text\\ 
    \end{tabular}
\end{document}
1
  • Hello and thanks for your answer. I was able to get the desired result after tinkering with the multirow option for the number of lines (as you have suggested). Since the NiceTabular command don't work on my system (unfortunately) your solution is the one I will use. – rogr Feb 18 at 12:17
2

Have a nice welcome here! :)

Some weeks ago, I had a very similar problem, according to this thread. A decent solution is to use a NiceTabular from the nicematrix package by F. Patigny (see documentation). That provides some block logic, thus you don't need multirow and makecell anymore.

\documentclass{article}
\usepackage{mwe}
\usepackage{nicematrix}
\usepackage{graphbox} %loads graphicx package

\begin{document}

\begin{NiceTabular}{c|c|c|c}
  \Block{*-1}{\rotate{Text}}
  & row 1 & \includegraphics[align=c,scale=0.25]{example-image} & text\\ 
  & row 2 & \includegraphics[align=c,scale=0.1]{example-image} & text\\
  & row 3 & \includegraphics[align=c,scale=0.4]{example-image} & text\\ 
\end{NiceTabular}

\vspace{1cm}

\begin{NiceTabular}{c|c|c|c}
  \Block{*-1}{\rotate{Text}}
  & row 1 & without example-image & text\\ 
  & row 2 & without example-image & text\\
  & row 3 & without example-image & text\\ 
\end{NiceTabular}

\end{document}

(You probably have to compile the document twice.)

Result:

enter image description here

3
  • Thanks for the answer. Your output is exactly what i asked for. Unfortunately my editor couldn’t compile the code due to an issue with the NiceTabular Environment i wasn’t able resolve ("undefinded Environment"). I don’t know how to troubleshoot package issues as I never see them, so it’s possible your code doesn’t work just on my system. – rogr Feb 18 at 12:08
  • 2
    @rogr: You have not the latest version of nicematrix. You should update your TeX installation. – F. Pantigny Feb 18 at 12:40
  • 2
    @F.Pantigny Yes, you were right. I use LaTeX primarily Ubuntu and updating the TeX packages is a whole nother issue for itself. After switching to Windows I updated all the installed TeX packages via MikTeX Console and the code provided by Max16hr worked. Thank you all. – rogr Feb 18 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.