[Tex/LaTex] Vertical align (top) graphic and top of text-line

minipagevertical alignment

I want to align the top of an image, and the top of a line of text. Below is a MWE with the current setup (using a placeholder "graphic" but the effect seems the same) and the desired behavior.

\documentclass{article}

\usepackage{graphicx}

\begin{document}

    \begin{minipage}[t]{0.5\textwidth}
        %\includegraphics[height=0.4in]{theimage.png}
        \rule{0.95\textwidth}{0.5in}
    \end{minipage}%
    \begin{minipage}[t]{0.5\textwidth}
        sometext to fill the line
    \end{minipage}

\end{document}

MWE behavior:

MWE behavior

Desired behavior:

enter image description here

Best Answer

A simple way to fix your problem is by adding \vspace{0pt} as soon as a minipage is created:

Output

\documentclass{article}

\usepackage{graphicx}

\begin{document}
  \begin{minipage}[t]{0.5\textwidth}
    \vspace{0pt}
    %\includegraphics[height=0.4in]{theimage.png}
    \rule{0.95\textwidth}{0.5in}
  \end{minipage}%
  \begin{minipage}[t]{0.5\textwidth}
    \vspace{0pt}
    sometext to fill the line
  \end{minipage}
\end{document}
Related Question