# Easy and robust way to vertically align text and images side by side

Is there any syntactically easy and robust solution of how to place a image right (or left) to a text with correct vertical alignment (and appealing horizontal spacing)?

By syntactically easy I mean it should be at least as simple as the (not working) minimal example below. Uncommenting the lines %\hspace{1ex} and % \null\hfill\\[-\dimexpr\baselineskip+0.7em\relax] makes it work but not syntactically easy easy anymore. In particular because you need to adjust the 0.7em manually (which may be another value in other use cases) makes it painful to use.

By robust I mean that it should also work with lists instead of text and inside of theorem environments (in particular from the ntheorem package); compare: Spacing using minipage in theorem environment (ntheorem)

Instead of using images it should work the same way when using tikz or pstricks pictures.

As far as I know something like wrapfig or picins is not robust in that way.

Note that I don't need that the text wraps around the image as in the packages above (but this would also be ok).

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\begin{document}

\begin{minipage}[t]{0.6\linewidth}
\lipsum[1]
\end{minipage}%
%\hspace{1ex}
\begin{minipage}[t]{0.4\linewidth}
%  \null\hfill\\[-\dimexpr\baselineskip+0.7em\relax]
\includegraphics[draft,height=4cm, width=5cm]{imageName}
\end{minipage}
\end{document}


You are using [t] so aligning the two minipage on the baseline of their top row.

In the case of the second minipage that is the baseline of the image.

Using [b] or the default [c] would make a more reasonable layout. If you want to use [t] then the second minpage isn't really doing anything you could just as easily use

\begin{minipage}[t]{0.6\linewidth}
\lipsum[1]
\end{minipage}%
\includegraphics[draft,width=.4\linewidth]{imageName}


(don't use height and width together unless you use keepaspectratio)

To make that look better you need to move the baseline of the image to its top or near its top. traditionally that would be done via

\raisebox{-\height}{\includeimage....}


Although the adjustbox package makes this easier adding t and T alignment options to \includegraphics.

Note that all of this is just general considerations about aligning boxes, there is nothing specific about minipage or \includegraphics.