I've read through a bunch of questions on that topic but I don't understand why their solutions don't work here.
I have two minipages that cover 50 % of the width each. One contains text, the other contains an image. The text is of much smaller height than the image. I want the text and the image both aligned to the top. Other questions provide [t] as the solution, but I only get this:
Here is my code:
\documentclass{exam}
\usepackage{graphicx}
\begin{document}
\begin{minipage}[t]{0.5\linewidth}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}
\begin{center}
\includegraphics[width=\linewidth]{Peter_the_Hermit.jpg}
\end{center}
\end{minipage}
\end{document}
(The image is a random image from Wikipedia, found here)




%after\end{minipage}so you do not have a space between them and use\vspace*{-5pt}(choose an amount) before\includegraphicsyou have aligned on the top row of each minipage but the image is like a big letter so put a vspace above it so the first thing in the minipage is not the image – David Carlisle Oct 21 '23 at 10:01