title: Centering Text Horizontally and Vertically in LaTeX
body: <p>I would like to produce the following:</p>
  
  <pre><code>      a       b
      xxxxx   xxxxx
   1  xxxxx   xxxxx
      xxxxx   xxxxx
  
      xxxxx   xxxxx
   2  xxxxx   xxxxx
      xxxxx   xxxxx
  </code></pre>
  
  <p>Where the blocks of 'x's are images, and 'a', 'b', '1' and '2' are text.</p>
  
  <p>Here are my two attempts so far:</p>
  
  <pre><code>\begin{figure}
  \begin{center}
  \begin{tabular}{ccc}
   &amp; a &amp; b \\
  1 &amp; \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &amp;
      \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
  2 &amp; \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &amp;
      \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
  \end{tabular}
  \end{center}
  \end{figure}
  </code></pre>
  
  <p>Which produces:</p>
  
  <pre><code>      a       b
      xxxxx   xxxxx
      xxxxx   xxxxx
   1  xxxxx   xxxxx
  
      xxxxx   xxxxx
      xxxxx   xxxxx
   2  xxxxx   xxxxx
  </code></pre>
  
  <p>And</p>
  
  <pre><code>\begin{figure}
  \begin{center}
  \begin{tabular}{m{1cm}m{6cm}m{6cm}}
   &amp; a &amp; b \\
  1 &amp; \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &amp;
      \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
  2 &amp; \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} &amp;
      \subfloat[]{\includegraphics[width=0.47\textwidth]{im.png}} \\
  \end{tabular}
  \end{center}
  \end{figure}
  </code></pre>
  
  <p>Which produces:</p>
  
  <pre><code>    a       b
      xxxxx   xxxxx
   1  xxxxx   xxxxx
      xxxxx   xxxxx
  
      xxxxx   xxxxx
   2  xxxxx   xxxxx
      xxxxx   xxxxx
  </code></pre>