Created
March 22, 2023 17:59
-
-
Save moriglia/0d9dd1e21d40c15619d164d49a0474fb to your computer and use it in GitHub Desktop.
Render images in equally wide minipages with the same hight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newlength{\mycustomheight} | |
\settoheight{\mycustomheight}{\includegraphics[width=0.5\textwidth, keepaspectratio]{wider-image}} | |
% ^^^^^^^^^^^^ Note this cool trick guys! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
% Figures will have the same height though they are set in equally wide minipages :D | |
\begin{figure} | |
\centering | |
\begin{minipage}{0.5\textwidth} | |
\centering | |
\includegraphics[height=\mycustomheight{}, keepaspectratio]{narrower-image} | |
\caption{Caption of narrow} | |
\label{fig:narrow} | |
\end{minipage} | |
\begin{minipage}{0.5\textwidth} | |
\centering | |
\includegraphics[height=\mycustomheight{}, keepaspectratio]{wider-image} | |
\caption{Caption of wide} | |
\label{fig:wide} | |
\end{minipage} | |
\end{figure} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment