I would like to align 2 figures to top using minipage environment, I've seen post like this link but answers doesn't use minipage environment. I've got this code:
\documentclass[8pt,a4paper,dvipsnames]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=1.5cm,bottom=1.5cm]{geometry}
\begin{document}
Test text
\begin{figure}[htp]
{\hfill}
\begin{minipage}[t]{0.35\textwidth}
\centering
\includegraphics[scale=0.25]{example-image-a}
\end{minipage}
{\hfill}
\begin{minipage}[t]{0.55\textwidth}
\centering
\includegraphics[scale=0.55]{example-image-b}
\end{minipage}
{\hfill}
\end{figure}
\end{document}
which produces this:
I think if I've got figures align to bottom, I could align them to top. Thank you so much and excuse me if this is a duplicated.
Best Answer
You have two ways: one with minipages, one without them.
The addition of
\vspace{0pt}
sets an invisible item at the top of theminipage
, which becomes the the reference point.The second solution exploits the fact that the reference point of an image is the bottom left, so raising it by
-\height
pushes it down so the reference point is the upper left.Note the
%
to avoid spurious spaces. You're adding too many of them.