[Tex/LaTex] Side by side figures adjusted to have equal height

floatsminipagepositioningscaling

I have two graphics of different dimensions which I would like to put into my document side by side such that:

  1. The two figures are scaled to have the same height.
  2. The two figures take up the entire text width.

I have seen the mini-page approach to side-by-side figures, but you have to declare the size of the mini-pages ahead of time. That will not work here.

Best Answer

enter image description here

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{center}
X\dotfill X

\resizebox{\textwidth}{!}{%
\includegraphics[height=1cm]{example-image}
\includegraphics[height=1cm]{example-image-4x3}}
\end{center}

\end{document}

The initial 1cm height is arbitrary, then scale the combined pair to text width.