[Tex/LaTex] Aligning image and text on top, with minipages

graphicsminipagevertical alignment

I have an image (on the left) and a block of text (on the right), and I would like both to be aligned on their top. I am trying to use minipages for that:

\documentclass{article}
\begin{document}
\begin{minipage}[t]{0.2\linewidth}
%\includegraphics[width=\textwidth]{Boltzmann}
\rule{\textwidth}{3cm}
\end{minipage}\hfill
\begin{minipage}[t]{0.7\linewidth}
\paragraph{Ludwig Boltzmann (1844~V1906)}\par
He was an Austrian physicist famous for his founding contributions in the
fields of statistical mechanics and statistical thermodynamics. He was
one of the most important advocates for atomic theory at a time when that
scientific model was still highly controversial.
\end{minipage}
\end{document}

(actual image replaced with black rectangle).
That doesn't work, because it aligns the baseline of the image (which is its bottom) with the baseline of the text, which is the baseline of the first line. I then tried to change put the image in a raisebox, like so:

\raisebox{-\height}{\includegraphics[width=\textwidth]{Boltzmann}}

but that aligns the top of the image with the baseline of the text, which is still not what I want. I could add another raisebox, like so:

\raisebox{\baselineskip}{%
  \raisebox{-\height}{\includegraphics[width=\textwidth]{Boltzmann}}}

but (a) that code is plain ugly, and (b) it still doesn't align exactly, so I don't know why.

So, yes, this is nitpicking on my part, but how can I get clean code that does exactly what I described in the beginning?

Best Answer

Here's a nifty way to do it:

\documentclass{article}

\usepackage[demo]{graphics}

\begin{document}

\begin{tabular}{p{5cm} p{7cm}}
    \vspace{0pt} 
    \includegraphics{test}
    & 
    \vspace{0pt}
    He was an Austrian physicist famous for his founding contributions in the fields of
    statistical mechanics and statistical thermodynamics. He was one of the most
    important advocates for atomic theory at a time when that scientific model was 
    still highly controversial.\\
\end{tabular}

\end{document}

What happens here is that you change the reference point of the image with the \vspace{0pt}, which allows top aligning the the text and the image.

When you want to use \paragraph to style the name, the vertical spacing is still broken. Hopefully somebody will shed some extra light how to fix that (I found that using \vspace{-3ex} before the text seems to do the job).

Disclaimer: I used the idea of Stefan Kottwitz from this blog post, and rephrased his explanation. That's why this is a CW answer.