Created
September 18, 2012 07:10
-
-
Save Answeror/3741730 to your computer and use it in GitHub Desktop.
Make two image height equal
This file contains hidden or 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
| % from http://tex.stackexchange.com/a/13039 | |
| \documentclass{article} | |
| \usepackage{graphicx} | |
| \newsavebox\IBoxA \newsavebox\IBoxB \newlength\IHeight | |
| \newcommand\TwoFig[6]{% Image1 Caption1 Label1 Image2 ... | |
| \sbox\IBoxA{\includegraphics[width=0.45\textwidth]{#1}} | |
| \sbox\IBoxB{\includegraphics[width=0.45\textwidth]{#4}}% | |
| \ifdim\ht\IBoxA>\ht\IBoxB | |
| \setlength\IHeight{\ht\IBoxB}\else\setlength\IHeight{\ht\IBoxA}\fi% | |
| \begin{figure}[!htb] | |
| \minipage[t]{0.45\textwidth}\centering | |
| \includegraphics[height=\IHeight]{#1} | |
| \caption{#2}\label{#3} | |
| \endminipage\hfill | |
| \minipage[t]{0.45\textwidth}\centering | |
| \includegraphics[height=\IHeight]{#4} | |
| \caption{#5}\label{#6} | |
| \endminipage | |
| \end{figure}% | |
| } | |
| \begin{document} | |
| \TwoFig{methods} {Methods} {fg:methods} | |
| {method_detail}{Method detail information}{fg:method_detail} | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment