将旋转的单元格居中

将旋转的单元格居中

我尝试了很多方法,但都无法使旋转的单元格很好地居中。例如病人稍微靠左一点。

  1. origin=tl没有origin=tc起作用
  2. \centering不工作
  3. \begin{center}Patient\end{center}也不起作用......
    \usepackage{xcolor}
    \usepackage{graphicx}
    \usepackage{tabularray}
    
    
    
    \begin{document}
      \begin{figure}
      \begin{tblr}
        {
          width     = {\textwidth},
          colspec   = { Q[c]Q[c]Q[c]Q[c] },
          rowsep = 1ex,
          rowspec   = { Q[m] },
    %      hlines,
    %      vlines,
          row{1}    = {font=\bfseries, bg=brown9, font=\sffamily},
          cell{1}{1}    = {bg=white},
          cell{2-3}{1}    = {cmd=\rotatebox[{origin=tl}]{90}},
    %      cell{3}{1}    = {cmd=\rotatebox[{origin=tl}]{90}},
        }
    &
    echo-Doppler 
    &
    CT-MRA
    &
    CTA
    \\
    \parbox{1.5cm}{Healthy subject}
    &
    \includegraphics[width=3.0cm,height=2cm]{example-image}
        & 
          \includegraphics[width=3.0cm,height=2cm]{example-image}
            &   
    \includegraphics[width=3.0cm,height=2cm]{example-image}
        \\
    Patient\ \ \ \ \ 
    &
    \includegraphics[width=3.0cm,height=2cm]{example-image}
    &
       \includegraphics[width=3.0cm,height=2cm]{example-image}
    &
       \includegraphics[width=3.0cm,height=2cm]{example-image}
            \end{tblr}
      \end{figure}
\end{document}```

答案1

看看以下解决方案是否可以接受:

\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{xcolor}
\usepackage{tabularray}



\begin{document}
    \begin{figure}
\settowidth\rotheadsize{Healthy}
\adjustboxset{width=3cm, height=2cm,  valign=m}
\renewcommand\cellalign{cc}
\begin{tblr}{colsep=2pt,    
             colspec = {Q[c, m] 
                        Q[m, leftsep=0pt] *{2}{Q[m]} @{} },
             cell{2-Z}{1} = {cmd=\rotcell},
             cell{1}{2-Z} = {bg=brown},
             row{1}  = {c, font=\sffamily},
              }
    & echo-Doppler  & CT-MRA    & CTA   \\
{Healthy\\ subject}
    &   \adjincludegraphics{example-image-a}
        &   \adjincludegraphics{example-image-b}
            &   \adjincludegraphics{example-image-c}   \\
Patient 
    &   \adjincludegraphics{example-image-a}
        &   \adjincludegraphics{example-image-b}
            &   \adjincludegraphics{example-image-c}   \\
\end{tblr}
    \end{figure}
\end{document}

在此处输入图片描述

但是,您可以使用以下figure表格设置使图像稍微大一些:

    \begin{figure}
\settowidth\rotheadsize{Healthy}
\adjustboxset{width=\linewidth,  valign=m}
\renewcommand\cellalign{cc}
\begin{tblr}{colsep=2pt,    
             colspec = {Q[c, m] 
                        Q[m, leftsep=0pt] *{2}{Q[m]} @{} },
             cell{2-Z}{1} = {cmd=\rotcell},
             cell{1}{2-Z} = {bg=brown},
             row{1}  = {c, font=\sffamily},
              }
...
\end{tblr}
    \end{figure}

在此处输入图片描述

相关内容