subfigmatrix 中的子圖

subfigmatrix 中的子圖

我想放置5張子圖片,3張放在第一行,兩張放在第二行。最後兩個必須與前三個具有相同的尺寸,但居中(我的意思是它們都靠近頁面的中心,而不是在兩端)。

\begin{figure}[H]

\begin{subfigmatrix}{3}
    \subfigure[$\mathbb{P}^2$]{\includegraphics{Chapter3/Immagini/RSB/p2.png}}
    \subfigure[$\mathbb{P}^4$]{\includegraphics{Chapter3/Immagini/RSB/p4.png}}
    \subfigure[$\mathbb{P}^6$]{\includegraphics{Chapter3/Immagini/RSB/p6.png}}
    \subfigure[$\mathbb{P}^8$]{\includegraphics{Chapter3/Immagini/RSB/p8.png}}
    \subfigure[$\mathbb{P}^{10}$]{\includegraphics{Chapter3/Immagini/RSB/p10.png}}
\end{subfigmatrix}
\caption{RSB -- $\theta'$ contours , $\mathbb{P}^{2,4,6,8,10}$ solutions on a mesh of $2\,400$ elements using the Godunov flux.}
\label{fig:rsb}

\end{figure}

答案1

我的想法被偷了這裡。似乎subfigmatrix用來\hfill做子圖之間的間距。這裡我們局部改為\hfill\hspace{0.1cm}因此子圖形之間總是有 0.1cm 的間距。

\documentclass{article}
\usepackage{graphicx,subfigmat,etoolbox,amssymb,float}
\begin{document}
\begin{figure}[H]
\patchcmd{\subfigmatrix}{\hfill}{\hspace{0.2cm}}{}{}
\begin{subfigmatrix}{3}
    \subfigure[$\mathbb{P}^2$]{\includegraphics{example-image}}
    \subfigure[$\mathbb{P}^4$]{\includegraphics{example-image}}
    \subfigure[$\mathbb{P}^6$]{\includegraphics{example-image}}
    \subfigure[$\mathbb{P}^8$]{\includegraphics{example-image}}
    \subfigure[$\mathbb{P}^{10}$]{\includegraphics{example-image}}
\end{subfigmatrix}
\caption{RSB -- $\theta'$ contours , $\mathbb{P}^{2,4,6,8,10}$ solutions on a mesh of $2\,400$ elements using the Godunov flux.}
\label{fig:rsb}
\end{figure}
\end{document}

結果


另一個想法

只是為您提供另一個想法:您可以subcaption嘗試\subcaptionbox

\documentclass{article}
\usepackage{graphicx,subcaption,amssymb}
\begin{document}
\begin{figure}
    \centering
    \subcaptionbox{$\mathbb{P}^2$}[0.3\linewidth]{\includegraphics[width=\linewidth]{example-image}}
    \subcaptionbox{$\mathbb{P}^4$}[0.3\linewidth]{\includegraphics[width=\linewidth]{example-image}}
    \subcaptionbox{$\mathbb{P}^6$}[0.3\linewidth]{\includegraphics[width=\linewidth]{example-image}}
    \subcaptionbox{$\mathbb{P}^8$}[0.3\linewidth]{\includegraphics[width=\linewidth]{example-image}}
    \subcaptionbox{$\mathbb{P}^{10}$}[0.3\linewidth]{\includegraphics[width=\linewidth]{example-image}}
\caption{RSB -- $\theta'$ contours , $\mathbb{P}^{2,4,6,8,10}$ solutions on a mesh of $2\,400$ elements using the Godunov flux.}
\label{fig:rsb}
\end{figure}
\end{document}

結果(子標題框)

答案2

subfigmat軟體包使用的subfigure內容已經過時了大約 20 年。

這是類似的方法,使用subfig.有些技巧是必要的,因為\subfloat忽略了後面的空格。

\documentclass{article}
\usepackage{graphicx,amssymb,subfig}
\usepackage{showframe}

\NewCommandCopy\ORIsubfloat\subfloat
\NewDocumentCommand{\NEWsubfloat}{om}{%
  \begingroup\setlength{\spaceskip}{0pt}%
  \IfValueTF{#1}{\ORIsubfloat[#1]{#2}}{\ORIsubfloat{#2}}%
  \endgroup\space\ignorespaces
}

\newlength{\subfloatmatrixwidth}
\newenvironment{subfloatmatrix}[2][0.2cm]{%
  \centering
  \setlength{\subfloatmatrixwidth}{%
    \dimexpr(\columnwidth-(#1)*\numexpr(#2-1)\relax)/(#2)\relax
  }%
  \setlength{\spaceskip}{#1 minus 1pt}%
  \setkeys{Gin}{width=\subfloatmatrixwidth}%
  \setlength{\lineskip}{\medskipamount}%
  \RenewCommandCopy\subfloat\NEWsubfloat
}{\par}

\begin{document}

\begin{figure}[htp]
\begin{subfloatmatrix}{3}
    \subfloat[$\mathbb{P}^2$]{\includegraphics{example-image}}
    \subfloat[$\mathbb{P}^4$]{\includegraphics{example-image}}
    \subfloat[$\mathbb{P}^6$]{\includegraphics{example-image}} 
    \subfloat[$\mathbb{P}^8$]{\includegraphics{example-image}}
    \subfloat[$\mathbb{P}^{10}$]{\includegraphics{example-image}}
\end{subfloatmatrix}
\caption{RSB -- $\theta'$ contours , $\mathbb{P}^{2,4,6,8,10}$ solutions on 
  a mesh of $2\,400$ elements using the Godunov flux.}
\label{fig:rsb}
\end{figure}

\end{document}

環境還有一個可選參數用於子浮點之間的間隔,預設為 0.2 公分。

在此輸入影像描述

相同,但與

\begin{subfloatmatrix}[0.5cm]{3}

在此輸入影像描述

相關內容