1

I want to have a long table with text and images next to each other. Each row consists of a short paragraph about an image, and an image. The image and the text should be aligned such that the top of the image and the top of the paragraph are at the same height.

Here's what I tried:

\documentclass[11pt]{article}
\usepackage{longtable}
\usepackage{blindtext}
\usepackage[demo]{graphicx}
\begin{document}

\title{Hello world}
\author{Me}
\date{\today}
\maketitle

\begin{longtable}{| p{5cm} | p{5cm} |}
\blindtext & \includegraphics[width=4cm]{foo}\\
\end{longtable}
\end{document}

This results in the following table:

picture of my table

The problem with this is that the image sits on the first line of the second column, and extends way above the first line. How do I fix the table such that the top of the image is at the same height as the top of the first line? (Note that my actual document has multiple paragraphs with an image each.)

After this is fixed, I'd also like to include the source of the image (a short text) below the picture. So the solution should be compatible with this.

I've searched for other answers, but the closest I've come is this: Formatting of a \longtable containing a picture and https://tex.stackexchange.com/a/24688/32655 but I don't think either of those solve my problem.

2

You could use the option valign from the adjustbox package:

\documentclass[11pt]{article}
\usepackage{longtable}
\usepackage{blindtext}
\usepackage[demo]{graphicx}
\usepackage[export]{adjustbox}
\begin{document}

\title{Hello world}
\author{Me}
\date{\today}
\maketitle

\begin{longtable}{| p{5cm} | p{5cm} |}
\blindtext & \includegraphics[valign=t,width=4cm]{foo}\\
\end{longtable}
\end{document}

enter image description here

The export option allows you to use valign=t as an option for includegraphics. Alternatively, you can use the adjustbox environment itself. You can include a short description of the image like this:

\begin{adjustbox}{valign=t}
    \begin{minipage}{\linewidth}
    \includegraphics[width=\linewidth]{my_picture.jpg}\\[2px]
    \parbox{\linewidth}{\small Short description of the picture.}
    \end{minipage}
\end{adjustbox}
1
  • Thanks! The adjust box environment is exactly what I needed.
    – Emiel
    Apr 16 '18 at 7:46

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.