16

我想制作以下内容:

      a       b
    xxxxx   xxxxx
 1  xxxxx   xxxxx
    xxxxx   xxxxx

    xxxxx   xxxxx
 2  xxxxx   xxxxx
    xxxxx   xxxxx

其中'x'的块是图像,'a'、'b'、'1'和'2'是文本。

到目前为止,这是我的两次尝试:

\begin{figure}
\begin{center}
\begin{tabular}{ccc}
 & a & b \\
1 & \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &
    \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
2 & \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &
    \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
\end{tabular}
\end{center}
\end{figure}

产生:

      a       b
    xxxxx   xxxxx
    xxxxx   xxxxx
 1  xxxxx   xxxxx

    xxxxx   xxxxx
    xxxxx   xxxxx
 2  xxxxx   xxxxx

\begin{figure}
\begin{center}
\begin{tabular}{m{1cm}m{6cm}m{6cm}}
 & a & b \\
1 & \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &
    \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
2 & \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &
    \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
\end{tabular}
\end{center}
\end{figure}

产生:

    a       b
    xxxxx   xxxxx
 1  xxxxx   xxxxx
    xxxxx   xxxxx

    xxxxx   xxxxx
 2  xxxxx   xxxxx
    xxxxx   xxxxx
4

2 回答 2

15

您可以创建一个新的列类型,或者简单地为两个图像列添加>{\centering\arraybackslash}之前m{6cm}

例如:

\newcolumntype{C}{>{\centering\arraybackslash} m{6cm} }  %# New column type
\begin{tabular}{m{1cm}CC}                                %# Table with two of them
...

>指令使您基本上可以在该列中的每个条目之前注入包含的代码。我们需要处理环境与环境\arraybackslash之间的不兼容问题。[更多信息可以在这里找到。] 1centeringtabular

于 2010-05-10T13:21:43.437 回答
4

我用\dummyimage,因为我没有im.png。将其替换为\includegraphics{im.png}

\font\dummyfont = cmr10 at 100pt
\def\dummyimage{{\vbox to 100pt{\vfil\hbox to 100pt{\hfil\dummyfont A\hfil}\vfil}}}

\hfil\vbox{
\halign{&\hfil\ $\vcenter{\hbox{#}}$\strut \ \hfil\cr
&a&b\cr 
1&\dummyimage&\dummyimage\cr
2&\dummyimage&\dummyimage\cr
}}
于 2010-05-05T10:35:15.273 回答