
1 つの図の一部である 4 つの画像を中央に配置し、画像間のスペースを狭めようとしています。 や などのコマンドはhspace
何\captionsetup[sub]{skip=0mm}
も実行しません。中心を \begin{figure} の下に移動しても、すべてが 1 行の長い行になります。
私の関連するセグメントは次のとおりです。
\begin{center}
\begin{figure}[b]
\vspace{-45mm}
\begin{subfigure}[b]{0.6\textwidth}
\centering
\includegraphics[width=\textwidth]{Plot M37 with parameters to see more stars.png}
\vspace{-10mm}
\caption{Image of Open Cluster Messier 37}
\vspace{-1mm}
\label{fig:0}
\end{subfigure}
\begin{subfigure}[b]{0.6\textwidth}
\centering
\includegraphics[width=\textwidth]{HD23190.png}
\vspace{-10mm}
\caption{Image of Star HD23190}
\vspace{-1mm}
\label{fig:1}
\end{subfigure}
\vspace{-10mm}
\begin{subfigure}[b]{0.6\textwidth}
\centering
\includegraphics[width=\textwidth]{HD40649.png}
\vspace{-10mm}
\caption{Image of Star HD40649}
\label{fig:2}
\end{subfigure}
\vspace{-10mm}
\begin{subfigure}[b]{0.6\textwidth}
\centering
\includegraphics[width=\textwidth]{HD280264.png}
\vspace{-10mm}
\caption{Image of Star HD280264}
\label{fig:3}
\end{subfigure}
\end{figure}
\end{center}
答え1
この例では、似たようなものを見ることができます: https://www.latextemplates.com/template/arsclassica-article
転置しようとすると、次のようなコードになります。
\begin{figure}[tb]
\centering
\subfloat[Image of Open Cluster Messier 37.]{\includegraphics[width=.45\columnwidth]{Plot M37 with parameters to see more stars.png}}\label{fig:0} \quad
\subfloat[Image of Star HD23190.]{\includegraphics[width=.45\columnwidth]{HD23190.png}\label{fig:1}\\
\subfloat[Image of Star HD40649.]{\includegraphics[width=.45\columnwidth]{HD40649.png}}\label{fig:2} \quad
\subfloat[Image of Star HD280264.]{\includegraphics[width=.45\columnwidth]{HD280264.png}}\label{fig:3}
\caption[Stars.]{Stars.}
\label{fig:PicturesOfStars}
\end{figure}
答え2
- 新しい挿入フロート環境を修正版に挿入します(
minipage
などcenter
) - 1行のサブ画像の幅の合計はテキストの幅より小さくする必要があります。そうでない場合、サブ画像は右の境界からはみ出します。
- 画像の幅がサブ図と同じ場合、
\centering
サブ図でコマンドを使用しても意味がないので、サブ図をドロップアウトすることができます。 Gin
すべての画像の幅は同じなので、キーを使って幅を決定すると便利です。- オプションを使用すると、
[b]
サブ図のキャプションの下部が垂直に揃えられます。キャプションの1つに他のものよりも多くの行がある場合、画像の上部が揃えられなくなります。 - 画像間の水平スペースに使用すると
\hfill
、画像はテキストの左右の境界から離されます。
上記を考慮すると、画像のコードを含む MWE は次のようになります。
\documentclass{article}
\usepackage{graphicx}
\usepackage[skip=0.5ex, belowskip=1ex]{subcaption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{figure}[htb]
\setkeys{Gin}{width=\linewidth}
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics{example-image-duck}%{Plot M37 with parameters to see more stars.png}
\caption{Image of Open Cluster Messier 37}
\label{fig:0}
\end{subfigure}%
\hfill
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics{example-image-duck}%{HD23190.png}
\caption{Image of Star HD23190}
\label{fig:1}
\end{subfigure}
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics{example-image-duck}%{HD40649.png}
\caption{Image of Star HD40649}
\label{fig:2}
\end{subfigure}%
\hfill
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics{example-image-duck}%{HD280264.png}
\caption{Image of Star HD280264}
\label{fig:3}
\end{subfigure}
\end{figure}
\end{document}
(赤い線はページレイアウトの一部を示しています)