Graphics, Figures & TablesGraphics inside tables

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
alexflint
Posts: 1
Joined: Tue Mar 08, 2011 4:33 pm

Graphics inside tables

Post by alexflint »

Hi there,

I was hoping someone could point out how to put graphics inside tables such that text in column 2 is vertically aligned next to an image in column 1. My current efforts have the first line of text aligned with the bottom of the table, and further lines added below that.

MWE:

Code: Select all

\documentclass{article}

\usepackage{times}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{verbatim}
\usepackage{array}

\begin{document}

\title{Foo}

\begin{tabular}{lp{0.6\textwidth}}
  \includegraphics[width=0.3\textwidth]{myimage} &
  Text next to the image. Lots and lots and lots and lots and lots and
  of it. \\
\end{tabular}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Graphics inside tables

Post by Stefan Kottwitz »

Hi,

in such cases you could use \raisebox with negative \height such as:

Code: Select all

\raisebox{-\height}{\includegraphics[width=0.3\textwidth]{myimage}}
However, it's not yet perfect, if you wish to align the text on its top instead on the baseline of its first line.

A quick way is

Code: Select all

\begin{tabular}{lp{0.6\textwidth}}
  \parbox[t]{0.3\textwidth}{\vspace{0pt}\includegraphics[width=0.3\textwidth]{myimage}} &
  \parbox[t]{0.3\textwidth}{\vspace{0pt}Text next to the image.
  Lots and lots and lots and lots and lots and
  of it.} \\
\end{tabular}
Now image and text are top-aligned.

Stefan
LaTeX.org admin
Post Reply