What is the easiest way to center align each row of table? I have a table column that contains an image and other cells in the same row contain text. I would like to know how to vertically center align the image and text cells. Currently each row is vertically bottom aligned. Here is my code:

\usepackage{booktabs, caption, underscore, url, graphicx}

\begin{tabular}{cccc} \bottomrule[2pt]
A & B & V & D & E \\ \bottomrule
\includegraphics[scale=0.35]{img1.eps} & 2 & 3 & 4 \\ 
\includegraphics[scale=0.35]{img2.eps} & 2 & 3 & 4  \\ 


Here is a quick sketch of the table I am trying to achieve:

enter image description here

The first column contains an image while the other columns contain a single line of text. How can the text be center aligned with the middle of the image?

  • 4
    Do you mean vertical alignment?
    – Count Zero
    Mar 1, 2012 at 16:13
  • Hmmm, what I am trying to say is: How can I align the contents of each cell in a row, such that they are centered horizontally. I've added a drawing to the question to provide clarity.
    – dr.bunsen
    Mar 1, 2012 at 16:35
  • 2
    I think you mean that in each row the vertical centers of each cell lie in the same (horizontal) line. That's usually called vertical alignment. Mar 1, 2012 at 16:37

2 Answers 2


Vertically centering cell entries is possible via the m{<width>} column type from the array package. Horizontal centering is obtained by prepending the column entries with \centering\arraybackslash (also supported by array). For completeness and brevity, the MWE below defines the new column type M which does all of the above:

enter image description here

%\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage[margin=1.0in]{geometry}% http://ctan.org/pkg/margin
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{array}% http://ctan.org/pkg/array
    A & B & D & E \\
    \rule{15pt}{10pt} & One & Two & Three \\ 
    \rule{15pt}{10pt} & Three & One & Two \\ 
    \rule{15pt}{10pt} & Two & Three & One \\ 

For images, I've used \rule{15pt}{10pt}, although the above solution works for any image size.

The table width is also chosen to fit exactly within the text block, making each of the four columns the same width (.25\linewidth-2\tabcolsep). To see this, uncomment the showframe package which highlights the text block boundary.

  • Fantastic! Thank you for the help. This did precisely what I was looking for. I previously tried to find a solution with the array package, but I was unsuccessful.
    – dr.bunsen
    Mar 1, 2012 at 16:58
  • This is great! I get an error and my table doesn't compile whenever I replace the M in the \columntype{}{} command with anything longer than 1 character.
    – John Mark
    Aug 1, 2012 at 10:10
  • @JohnMark: You can only use a single character for a column type. Otherwise is would be difficult to assess whether the column specification MR (say) refers to a single MR column or a two-column M and R arrangement.
    – Werner
    Aug 1, 2012 at 14:04

Images are always set with their base on the baseline (if they aren't rotated). So what you need is to lower the graphics; the easiest way is to say


If the height of the row is to be taken into consideration, then a slightly more complex calculation is necessary:


The adjustbox package has many features that ease this kind of job; after \usepackage{adjustbox} you can say

  • Thanks for the help. For some reason I could get your solution to work.
    – dr.bunsen
    Mar 1, 2012 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .