将带有图像的表格中多行单元格中的旋转文本居中

将带有图像的表格中多行单元格中的旋转文本居中

以下代码:

\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}

给出以下输出:

在此处输入图片描述

可以让旋转的文本居中吗?

答案1

在此处输入图片描述

\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}

答案2

欢迎大家来这里!:)

几周前,我遇到了一个非常类似的问题,根据这个线一个不错的解决方案是使用F. Patigny 包NiceTabular中的nicematrix(参见文档)。这提供了一些块逻辑,因此您不再需要multirowand makecell

\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}

(您可能需要编译该文档两次。)

结果:

在此处输入图片描述

相关内容