Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

As per this, I tried using \minipage with my \subfigure, however to no avail. (My figures are still stacked vertically) I even tried changing scale to width=0.5\textwidth...

What did I do wrong?

Brief working example:

Also uploaded here as a .zip file.

Sorry, I really don't know how to format stuff on here. So it looks messy.

\documentclass[a4paper,10pt]{article}
\usepackage{setspace}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{eps2pdf}
\usepackage{subfigure}
\usepackage{float}
\usepackage[super,numbers,sort&compress]{natbib}
\usepackage{color}
% \usepackage{underscore}
\usepackage{grrfile}
\usepackage{placeins}
\newcommand{\hilight}[1]{\colorbox{yellow}{#1}}
\renewcommand{\thefootnote}{\alph{footnote}}
\usepackage[paper=letterpaper,left=1.0in,right=1.0in,top=0.25in,bottom=1.0in,]{geometry}




\begin{document}



\begin{figure}[ht]
\centering

\begin{minipage}{0.45\textwidth}
\begin{subfigure}[Initial condition]{
   \includegraphics[scale =0.25] {./pngs/profile_L_3lambda_max_1wl_0.png}
   \label{fig:subfig1}
 }
\end{subfigure}
\end{minipage} 


\begin{minipage}{0.45\textwidth}
 \begin{subfigure}[DFT]{
   \includegraphics[scale =0.25] {./pngs/profile_L_3lambda_max_1wl_dft_0.png}
   \label{fig:subfig2}
 }\end{subfigure}
\end{minipage}



\begin{minipage}{0.45\textwidth}
 \begin{subfigure}[DFT (corner)]{
   \includegraphics[scale =0.25] {./pngs/profile_L_3lambda_max_1wl_dft_0_X.png}
   \label{fig:subfig3}
 }\end{subfigure}
\end{minipage}


\label{myfigure}
\caption{Initial condition, $L=3\lambda_{max}, \text{k}=1, G=0.333,S=100, M=35.1, \text{Pr=7.02}, E=0, Ra=0$}
\end{figure}




\begin{figure}
\centering

\begin{subfigure}[Initial condition]{
   \includegraphics[scale =0.25] {./pngs/profile_L_3lambda_max_1wl_Rup.png}
   \label{fig:subfig4}
 }\quad
\end{subfigure}

 \begin{subfigure}[DFT]{
   \includegraphics[scale =0.25] {./pngs/profile_L_3lambda_max_1wl_dft_Rup.png}
   \label{fig:subfig5}
 }\end{subfigure} 

\label{myfigure}
\caption{Rupture condition, , $L=3\lambda_{max}, \text{k}=1, G=0.333,S=100, M=35.1, \text{Pr=7.02}, E=0, Ra=0$}
\end{figure}

\end{document}
share|improve this question
1  
rather than using the subfigure package, a lot of folks prefer the subcaption package- would you be interested in seeing a solution using it? –  cmhughes Aug 29 '12 at 18:28
    
@cmhughes sure. And thats because the subfigure package is "deprecated"? –  drN Aug 29 '12 at 18:31
add comment

1 Answer 1

up vote 5 down vote accepted

If, for some reason, you can't use another package but the obslote subfigure package, here's one way to achieve what you want; basically, don't leave blank lines between subfigure environment (those blank lines are \par commands ending a paragraph); also, instead of using scale=<value> it could be safer to use width=<length> so that you can guarantee that the total width for the three images won't surpass the \textwidth (of course, if you can guarantee the condition using scale, then feel free to use that option instead); try not to leave spurious blank spaces (your code has some of those too which I removed using % at the end of some lines):

\documentclass[a4paper,10pt]{article}
\usepackage[demo]{graphicx}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage{grrfile}
\usepackage[paper=letterpaper,left=1.0in,right=1.0in,top=0.25in,bottom=1.0in,]{geometry}

\begin{document}

\begin{figure}[ht]
\centering
\begin{subfigure}[Initial condition]{\includegraphics[width=.3\linewidth] {./pngs/profile_L_3lambda_max_1wl_0.png}
   \label{fig:subfig1}
 }%
\end{subfigure}\hfill
 \begin{subfigure}[DFT]{\includegraphics[width=.3\linewidth]{./pngs/profile_L_3lambda_max_1wl_dft_0.png}
   \label{fig:subfig2}
 }%
\end{subfigure}\hfill
 \begin{subfigure}[DFT (corner)]{\includegraphics[width=.3\linewidth]{./pngs/profile_L_3lambda_max_1wl_dft_0_X.png}
   \label{fig:subfig3}
 }%
\end{subfigure}%
\caption{Initial condition, $L=3\lambda_{max}, \text{k}=1, G=0.333,S=100, M=35.1, \text{Pr=7.02}, E=0, Ra=0$}
\label{fig:myfigure}
\end{figure}

\end{document}

enter image description here

For the example, I removed some of the packages that were not essential for the solution.

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

share|improve this answer
    
Hi! sorry I got a little sick with the flu. Will try this suggestion soon! Thanks. –  drN Sep 4 '12 at 16:51
    
Works like a charm! Thanks! –  drN Sep 4 '12 at 17:09
1  
You're welcome! I hope the flu is gone and you're better. –  Gonzalo Medina Sep 4 '12 at 17:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.