Centering Text Horizontally and Vertically in LaTeX
- by Paul
I would like to produce the following:
a b
xxxxx xxxxx
1 xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
2 xxxxx xxxxx
xxxxx xxxxx
Where the blocks of 'x's are images, and 'a', 'b', '1' and '2' are text.
Here are my two attempts so far:
\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}
Which produces:
a b
xxxxx xxxxx
xxxxx xxxxx
1 xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
2 xxxxx xxxxx
And
\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}
Which produces:
a b
xxxxx xxxxx
1 xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
2 xxxxx xxxxx
xxxxx xxxxx