Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created January 31, 2016 04:10
Show Gist options
  • Select an option

  • Save takuma7/f793ebb22c6720f3ba32 to your computer and use it in GitHub Desktop.

Select an option

Save takuma7/f793ebb22c6720f3ba32 to your computer and use it in GitHub Desktop.

Revisions

  1. takuma7 created this gist Jan 31, 2016.
    26 changes: 26 additions & 0 deletions horizontal-images-same-height.tex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    %%%% Preamble >>>
    \usepackage{subcaption}
    \newlength{\twosubht}
    \newsavebox{\twosubbox}
    %%%%% <<<

    \begin{figure}[htp]
    % preliminary
    \sbox\twosubbox{%
    \resizebox{\dimexpr.99\textwidth-1em}{!}{% {(num of image)-1}em
    \includegraphics[height=100cm]{first-image}%
    \includegraphics[height=100cm]{second-image}%
    }%
    }
    \setlength{\twosubht}{\ht\twosubbox}
    % typeset
    \centering
    \subcaptionbox{\label{fig:first}}{%
    \includegraphics[height=\twosubht]{first-image}%
    }\quad
    \subcaptionbox{\label{fig:second}}{%
    \includegraphics[height=\twosubht]{second-image}%
    }
    \caption{(\subref{fig:first}) First. (\subref{fig:second}) Second.}
    \label{fig:two-images-same-height}
    \end{figure}