図の前後の余白を減らす(サブ図あり)

図の前後の余白を減らす(サブ図あり)

ドキュメントに 2 つの画像を含めるための次のコードがあります。

\begin{figure}[!ht]
    \centering
    \begin{subfigure}[b]{1.0\textwidth}
        \centering
        \includegraphics[height=6.31cm]{fig1_xxx.eps}
        \caption{}
        \label{fig1}
    \end{subfigure}
    \centering
    \begin{subfigure}[b]{1.0\textwidth}
        \centering
        \includegraphics[height=6.31cm]{fig2_xxx.eps}
        \caption{}
        \label{fig2}
    \end{subfigure}
    \caption{ABC capion: (a) XYZ and (b) PQR}
\end{figure}

上記のコードは、2 つの画像をドキュメントの中央に垂直に配置します。ただし、画像が挿入される前と後に、不要な余白が大量に生成されることがわかりました。この問題の解決方法を提案してくださる方はいらっしゃいますか?

答え1

MWEに追加されたコードはすべてパディングを削減し、要件に応じて値を定義できます。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage[a4paper]{geometry} % set suitable page parameters
\usepackage[T1]{fontenc}
\usepackage{caption} % optional 
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}

\raggedbottom
\begin{document}
\setlength{\belowcaptionskip}{-10pt}
\captionsetup{belowskip=0pt}
\renewcommand\floatpagefraction{.7}
\renewcommand\dblfloatpagefraction{.9} % for two column documents
\renewcommand\topfraction{.7}
\renewcommand\dbltopfraction{.9} % for two column documents
\renewcommand\bottomfraction{.7}
\renewcommand\textfraction{.1}   
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
\vspace{-7pt}
\begin{figure}[!ht]
    \centering\offinterlineskip
  \fbox{\begin{subfigure}[b]{.6\textwidth}
        \centering
        \includegraphics[vspace=0pt, height=10\baselineskip]{example-image-a}
        \caption{}
        \label{fig1}
    \end{subfigure}}

    \centering
    \fbox{\begin{subfigure}[b]{.6\textwidth}
        \centering
        \includegraphics[height=10\baselineskip]{example-image-b}

        \caption{}
        \label{fig2}
    \end{subfigure}}
    \caption{ABC capion: (a) XYZ and (b) PQR}
\end{figure}

\end{document}

要件を満たしている場合は回答を承認してください

関連情報