Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

is there a way to create a table with 2 columns, in the left column should be some text, in the right column should be a picture.

The problem is - to align both to the left, top corner. The image seems to be inserted as an inline object, so it pushes the text down, from the top.

                          _____________________
                         |                     |    
                         |                     |
Some text is pushed down |                     |

What i want is:

Some text is pushed down  _____________________
                         |                     |    
                         |                     |
                         |                     |

Here is the code:

\begin{tabular}{\textwidth}{ l l }
Some text & \includegraphics{images/image.png} \\
\end{tabular}
share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

The adjustbox is what's needed:

\begin{tabular}{ll}
Some text & \adjustbox{valign=t}{\includegraphics[height=3cm,width=4cm]{p}}\\
...
\end{tabular}

With valign=t the picture is lowered in such a way that its final height is similar to the height of the surrounding text (the rest will stick below).

If you want that the top of the figure is on the baseline, use valign=T.

As the author of adjustbox comments, calling

\usepackage[export]{adjustbox}

the options provided by the package can go directly in the argument of \includegraphics, so

\begin{tabular}{ll}
Some text & \includegraphics[valign=T,height=3cm,width=4cm]{p}}\\
...
\end{tabular}

is good as well. Change the other options for your case.

share|improve this answer
3  
Using \usepackage[export]{adjustbox} you can use most keys directly for \includegraphics, i.e. \includegraphics[height=3cm,width=4cm,valign=t]{p}. The set depth key might also be useful if the official depth should be changed afterwards. A package-less alternative to valign=T would be \raisebox{-\height}{\includegraphics[..]{..}}. –  Martin Scharrer Sep 30 '11 at 17:34
    
The new v0.7 now also provides \adjustimage{<key=value>}{<filename>} as a shortcut for \adjustbox{<key=value>}{\includegraphics{<filename>}}. You can place all keys for \includegraphics also into \adjustbox. –  Martin Scharrer Nov 9 '11 at 15:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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