2010-05-05 51 views
14

我想产生以下:定心文本形式水平和垂直乳胶

 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 
+0

对于未来的读者,请检查:http://tex.stackexchange.com/questions/12703/how-to-create-fixed-width-table-columns-with-text-raggedright-centered-raggedlef – Bernhard 2014-09-09 07:26:44

回答

12

可以使一个新的列类型,或者干脆m{6cm}前添加>{\centering\arraybackslash}两个图像列。

例如:

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

>指令,让您在该列中的每个条目之前基本上注入其中包含的代码。我们需要\arraybackslash来处理centering环境和tabular环境之间的不兼容问题。 More info can be found here.

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 
}} 
+0

是TeX,而不是LaTeX,不是? – Svante 2010-05-05 21:40:32

+1

@Svante:是的。我没有看到Alexey的答案会导致Latex问题。 – 2010-05-06 09:19:11