子浮动和小页面的子图错位问题

子浮动和小页面的子图错位问题

我正在尝试使用和整理几个子图minipage,但subfloat一直出现以下错位问题: 在此处输入图片描述

迷你页面显然有足够的空间,我缩小了最后两张图片的尺寸/增加了迷你页面的尺寸,以确保万无一失。当我只放六张图片(每个迷你页面三张)时,不会发生这种情况;每个迷你页面放四张会不会有什么问题?

这是我的情节代码:

\begin{figure}
\centering
\begin{minipage}[c][17cm][t]{.5\textwidth}
\centering
\subfloat[$t_{1}=3$,$t_{2}=0.5$ initial conditions.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range3-2_1.png}%
  \label{fig:mode2range3-05_1}
}

\subfloat[$t_{1}=2$,$t_{2}=0.5$ initial conditions.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range2-1_1.png}%
  \label{fig:mode2range2-05_1}
}

\subfloat[$t_{1}=4$,$t_{2}=1$ m initial conditions.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range4-2_1.png}%
  \label{fig:mode2range4-1_1}
}
\subfloat[$t_{1}=4$,$t_{2}=1.5$ m initial conditions.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range4-15_1.png}%
  \label{fig:mode2range4-15_1}
}
\end{minipage}%
\begin{minipage}[c][17cm][t]{.5\textwidth}
\centering
\subfloat[$t_{1}=3$,$t_{2}=0.5$ ISWs.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range3-2_2.png}%
  \label{fig:mode2range3-05_2}
}

\subfloat[$t_{1}=2$,$t_{2}=0.5$ ISWs.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range2-1_2.png}%
  \label{fig:mode2range2-05_2}
}

\subfloat[$t_{1}=4$,$t_{2}=1$ ISWs.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range4-2_2.png}%
  \label{fig:mode2range4-1_2}
}
\subfloat[$t_{1}=4$,$t_{2}=1.5$ ISWs.]{%
  \includegraphics[clip,width=0.9\linewidth]{mode2range4-15_2.png}%
  \label{fig:mode2range4-15_2}
}
\end{minipage}
\caption{The density profile of the initial conditions (left) and the point where the ISWs reach the right boundary (right) for the cases in which the coefficients for the two thicknesses of the pycnocline have been varied to $t_{1}=3$,$t_{2}=0.5$, $t_{1}=2$,$t_{2}=0.5$, $t_{1}=4$,$t_{2}=1$, and $t_{1}=4$,$t_{2}=1.5$.}
\end{figure}

以及我正在使用的软件包:

\documentclass[titlepage, 11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[margin=1in]{geometry}
\usepackage[style=apa]{biblatex}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}

这可能是什么问题?提前致谢!

答案1

没有必要使用小型页面,并且也不清楚为什么要将它们设置为某个高度。

使用\subcaptionbox(或subfigure环境)。

\documentclass[titlepage, 11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[margin=1in]{geometry}
\usepackage[style=apa]{biblatex}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}

\begin{document}

\begin{figure}
\centering\setlength{\parskip}{2ex}

\subcaptionbox
  {$t_{1}=3$, $t_{2}=0.5$ initial conditions.\label{fig:mode2range3-05_1}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}
\subcaptionbox
  {$t_{1}=2$, $t_{2}=0.5$ initial conditions.\label{fig:mode2range2-05_1}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}

\subcaptionbox
  {$t_{1}=4$, $t_{2}=1$ m initial conditions.\label{fig:mode2range4-1_1}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}
\subcaptionbox
  {$t_{1}=4$, $t_{2}=1.5$ m initial conditions.\label{fig:mode2range4-15_1}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}

\subcaptionbox
  {$t_{1}=3$, $t_{2}=0.5$ ISWs.\label{fig:mode2range3-05_2}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}
\subcaptionbox
  {$t_{1}=2$, $t_{2}=0.5$ ISWs.\label{fig:mode2range2-05_2}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}

\subcaptionbox
  {$t_{1}=4$, $t_{2}=1$ ISWs.\label{fig:mode2range4-1_2}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}
\subcaptionbox
  {$t_{1}=4$, $t_{2}=1.5$ ISWs.\label{fig:mode2range4-15_2}}
  {\includegraphics[height=3cm,width=0.45\textwidth]{example-image}}

\caption{The density profile of the initial conditions (left) and the point 
  where the ISWs reach the right boundary (right) for the cases in which the 
  coefficients for the two thicknesses of the pycnocline have been varied to 
  $t_{1}=3$, $t_{2}=0.5$, $t_{1}=2$, $t_{2}=0.5$, $t_{1}=4$, $t_{2}=1$,
  and $t_{1}=4$, $t_{2}=1.5$.}
\end{figure}

\end{document}

需要注意的几点:

  1. 我更改了文件名以生成图片;恢复正确的文件名并删除height=3cm我用来模拟图片的选项;

  2. clip除非您指定,否则该选项是多余的viewport

  3. 逗号后面应该有一个空格;

  4. 我添加了一个(本地)设置\parskip来分隔图像行;

  5. [htp]对于如此大的浮动,选择权是必要的。

在此处输入图片描述

答案2

一些题外的建议(主要问题已由@David Carlisle 评论解决):

  • 通过使用subcaption选项belowskipskip子选项移动到更靠近图像的位置并远离下方图像。
  • 使minipages 变窄并且图像宽度等于minipages 的宽度。
  • 因为所有图像都具有相同的设置,所以对它们使用 leays Gin 是明智的。这样代码就短多了。
  • Pairs$t_1=...$,$t_2=...$,最好写成$t_1...,t_2=...$,。除此之外,代码稍微短一点,结果(在我看来)也更好:
\documentclass[titlepage, 11pt]{article}
\usepackage[margin=1in]{geometry}

\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[skip=0.5ex,
            belowskip=1ex]{subcaption}

\begin{document}
    \begin{figure}
    \setkeys{Gin}{clip,width=\linewidth}
\centering
\begin{minipage}{.48\textwidth}
\centering
\subfloat[$t_{1}=3,t_{2}=0.5$ initial conditions.]{%
  \includegraphics{mode2range3-2_1.png}%
  \label{fig:mode2range3-05_1}
}

\subfloat[$t_{1}=2,t_{2}=0.5$ initial conditions.]{%
  \includegraphics{mode2range2-1_1.png}%
  \label{fig:mode2range2-05_1}
}

\subfloat[$t_{1}=4,t_{2}=1$ m initial conditions.]{%
  \includegraphics{mode2range4-2_1.png}%
  \label{fig:mode2range4-1_1}
}

\subfloat[$t_{1}=4,t_{2}=1.5$ m initial conditions.]{%
  \includegraphics{mode2range4-15_1.png}%
  \label{fig:mode2range4-15_1}
}
\end{minipage}%
\hfill
\begin{minipage}{.48\textwidth}
\centering
\subfloat[$t_{1}=3,t_{2}=0.5$ ISWs.]{%
  \includegraphics{mode2range3-2_2.png}%
  \label{fig:mode2range3-05_2}
}

\subfloat[$t_{1}=2,t_{2}=0.5$ ISWs.]{%
  \includegraphics{mode2range2-1_2.png}%
  \label{fig:mode2range2-05_2}
}

\subfloat[$t_{1}=4,t_{2}=1$ ISWs.]{%
  \includegraphics{mode2range4-2_2.png}%
  \label{fig:mode2range4-1_2}
}

\subfloat[$t_{1}=4,t_{2}=1.5$ ISWs.]{%
  \includegraphics{mode2range4-15_2.png}%
  \label{fig:mode2range4-15_2}
}
\end{minipage}
\caption{The density profile of the initial conditions (left) and the point where the ISWs reach the right boundary (right) for the cases in which the coefficients for the two thicknesses of the pycnocline have been varied to $t_{1}=3, t_{2}=0.5$, $t_{1}=2, t_{2}=0.5$, $t_{1}=4, t_{2}=1$, and $t_{1}=4, t_{2}=1.5$.}
    \end{figure}
\end{document}

在此处输入图片描述

相关内容