將 minipage 與 subfigure 一起使用不會產生並排的數字

將 minipage 與 subfigure 一起使用不會產生並排的數字

按照,我嘗試\minipage與我的一起使用\subfigure,但無濟於事。 (我的人物仍然垂直堆疊)我什至嘗試更改scalewidth=0.5\textwidth...

我做錯了什麼?

簡要工作範例:

還上傳了這裡作為 .zip 檔案。

抱歉,我真的不知道該如何格式化這裡的內容。所以看起來很亂。

\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}

答案1

如果由於某種原因,您不能使用另一個包,而是使用過時的subfigure包,那麼這是實現您想要的效果的一種方法;基本上,不要在subfigure環境之間留下空白行(這些空白行是\par結束段落的命令);另外,使用scale=<value>它可能會更安全,width=<length>這樣你就可以保證三個圖像的總寬度不會超過\textwidth(當然,如果你可以保證使用的條件scale,那麼可以隨意使用該選項) ;盡量不要留下虛假的空格(您的程式碼也有一些我%在某些行末尾使用的刪除的空格):

\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}

在此輸入影像描述

例如,我刪除了一些對於解決方案來說並不重要的軟體包。

demoGraphicx 選項只是將實際圖形替換為黑色矩形;做不是在您的實際文件中使用該選項。

相關內容