如何用图像和标签创建拼贴画?

如何用图像和标签创建拼贴画?

我正在尝试制作拼贴画。可以创建图像,但还不能在图像的左侧和上方添加文本。

在此处输入图片描述

\documentclass{article}

\usepackage{tabularx}
\usepackage{graphicx}


    \begin{document}
    \begin{figure}
\begin{tabularx}{\textwidth}{CCC}
\includegraphics[width=3.0cm,height=2cm]{example-image}
    &   \includegraphics[width=3.0cm,height=2cm]{example-image}
        &   \includegraphics[width=3.0cm,height=2cm]{example-image}
    \\[3ex]
\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{tabularx}
    \end{figure}

    \end{document}

答案1

使用tabularray包:

表格数组

平均能量损失

\documentclass{article}
\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}

附录

通过使用 es 将文本和图像全部置于基线上的中心来对其进行排列\parbox,然后使用 option 旋转文本origin=c,即可得到所需的结果。

定心

平均能量损失

\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{tabularray}

\newcommand{\iw}{2.8cm}
\newcommand{\iwp}{2.8cm}


\begin{document}
  \begin{figure}
  \begin{tblr}
    {
      width     = {\textwidth},
      colspec   = { Q[c]Q[c]Q[c]Q[c] },
%      hlines,
%      vlines,
      row{1}  = {font=\bfseries, bg=brown9, font=\sffamily},
      cell{1}{1}    = {bg=white},
      cell{2-3}{1}    = {cmd=\rotatebox[{origin=c}]{90}},
    }
&
echo-Doppler 
&
CT-MRA
&
CTA
\\
\parbox{\iwp}{\centering Healthy \\subject}
&
\parbox[c]{\iwp}{\includegraphics[width=\iw]{example-image}}
& 
\parbox[c]{\iwp}{\includegraphics[width=\iw]{example-image}}
&   
\parbox[c]{\iwp}{\includegraphics[width=\iw]{example-image}}
\\
\parbox{\iwp}{\centering Patient}
&
\parbox[c]{\iwp}{\includegraphics[width=\iw]{example-image}}
&
\parbox[c]{\iwp}{\includegraphics[width=\iw]{example-image}}
&
\parbox[c]{\iwp}{\includegraphics[width=\iw]{example-image}}
\end{tblr}
\end{figure}

\end{document}

相关内容