I have the following table

\includegraphics{tag.png} & bla bla bla.\\
\includegraphics{tag.png} & \\
\includegraphics{tag.png} & Store project\\
\includegraphics{tag.png} & Gestures\\
\includegraphics{tag.png} & Screenshot\\
\includegraphics{tag.png} & Tagging\\

Now I'd like to achieve that the second column consumes all the remaining page width and the text should be centered vertically in the cell. I achieve either one of this but no both together. Any hints?

  • A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). – lockstep Mar 11 '11 at 15:58

\begin{tabularx}{\linewidth}{@{} l X @{}}
\makecell{\includegraphics{tag.png}} & bla bla bla.\\
\makecell{\includegraphics{tag.png}} & \\
\makecell{\includegraphics{tag.png}} & Store project\\
\makecell{\includegraphics{tag.png}} & Gestures\\
\makecell{\includegraphics{tag.png}} & Screenshot\\

  • @Herbert This is basically the same as my solution, except the first column has a specfied width. Why does using lX (with the same redefinition of X) not work? – Alan Munn Mar 11 '11 at 16:47
  • @Alan: Because l is aligned to its baseline but m is aligned to its centerline. – Martin Scharrer Mar 11 '11 at 16:51
  • @Herbert: Thanks i also tried your solution but then I can't generate a PDF: <pictures//tag.png, id=198, 54.9553pt x 55.70813pt> <use pictures//tag.png> <pictures//tag1.png, id=199, 53.44969pt x 54.2025pt> <use pictures//tag1.png> Underfull \hbox (badness 10000) in paragraph at lines 323--324 <use pictures//tag.png> <use pictures//tag.png> ! Extra alignment tab has been changed to \cr. <template> ...egin \relax \d@llarend \endtemplate l.332 \end{tabularx} ? – RoflcoptrException Mar 11 '11 at 16:54
  • 2
    @Roflcoptr: you have forgotten a `\\` at one tabular line or more columns used than specified. – user2478 Mar 11 '11 at 17:06
  • 1
    @Herbert: It's annoying, but in a comment you have to use double backticks if the inline code ends with a backslash: ``\\`` gives \\. – Hendrik Vogt Mar 11 '11 at 17:31

Use the tabularx package: (the vertical bars are included just to show the centering).

 \rule{1in}{1in} & This is some text. This is some more text. This is even more text.


This doesn't do exactly what you want, because it uses two X columns rather than one. For some reason that I don't understand, using


fails to make the text in the X column vertically centred.

  • Thanks. I just tried that but i centers horizontally not vertically. – RoflcoptrException Mar 11 '11 at 16:11
  • I've updated my answer. It's not exactly what you want, but it might do the job. – Alan Munn Mar 11 '11 at 16:32

Herbert's answer is correct. However, if you don't want or can't specify the width of the first column you could use the following code and have it measured automatically.



    \rule{1in}{1in} & Text \\
    \rule{1in}{2in} & Other Text Ag\strut \\
    \rule{1in}{1in} & 
    Very very very very very very very very 
    Very very very very very very very very 
    Very very very very very very very very 
    Very very very very very very very very 
    long text \\
  • see my edited example, it does the same with column type l – user2478 Mar 11 '11 at 18:44
  • Thanks @Herbert! I didn't know makecell before. – Martin Scharrer Mar 11 '11 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.