1

I have two picture that I want to align it with the text next to it from top, i used this code:

\documentclass[3p,onecolumn]{elsarticle}
\usepackage{array}
\usepackage{lipsum}
\begin{document}
\section*{Virtual}
\vspace{2cm}
\begin{tabular}{l p{11cm}}
\includegraphics[width=3cm]{black}&\lipsum[1].\\
\vspace{1cm}\\
\includegraphics[width=3cm]{black}&\lipsum[2].\\
\end{tabular}

\end{document}

But it doesn't align with it. how can I fix it?? enter image description here

2

The problem is that the bottom of the \includegraphics is aligned to the baseline, whereas the bottom of the 1st line of text also sits on the baseline. The image must be shifted down by its height (\height) and then up by the height of one row of text above the baseline (\ht\strutbox).

\documentclass[3p,onecolumn]{elsarticle}
\usepackage{array}
\usepackage{lipsum}
\begin{document}
\section*{Virtual}
\vspace{2cm}
\begin{tabular}{l p{11cm}}
\raisebox{\dimexpr-\height+\ht\strutbox}{\includegraphics[width=3cm]{example-image}}&\lipsum[1].\\
\vspace{1cm}\\
\raisebox{\dimexpr-\height+\ht\strutbox}{\includegraphics[width=3cm]{example-image}}&\lipsum[2].\\
\end{tabular}
\end{document}

enter image description here

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.