子标题:在列中标记子图

子标题:在列中标记子图

如同问题,我正在使用subfigure它来布局图像网格。我希望 (a) 位于左上方,(b) 位于左下方,(c) 位于右上方,(d) 位于右下方。如何实现?

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}

\begin{document}
  \begin{figure}
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
      \centering
      \includegraphics[width=\textwidth]{dummy}
      % \caption*{Column 1a}
      \label{fig:1}
    \end{subfigure}%
    ~
    \begin{subfigure}[b]{0.3\textwidth}
      \centering
      \includegraphics[width=\textwidth]{dummy}
      % \caption*{Column 2a}
      \label{fig:2}
    \end{subfigure}%
    \\ % Change row.
    \begin{subfigure}[b]{0.3\textwidth}
      \centering
      \includegraphics[width=\textwidth]{dummy}
      \caption{Column 1b}
      \label{fig:3}
    \end{subfigure}%
    ~
    \begin{subfigure}[b]{0.3\textwidth}
      \centering
      \includegraphics[width=\textwidth]{dummy}
      \caption{Column 2b}
      \label{fig:4}
    \end{subfigure}%
    \caption{The overall caption.}
    \label{fig:all}
  \end{figure}%
\end{document}

答案1

您可以使用包含两个表格的表格。

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{array}
\begin{document}
  \begin{figure}
    \centering
    \begin{tabular}{@{}c@{}p{1ex}@{}c@{}}
        \begin{tabular}{@{}c@{}}
            \begin{subfigure}[b]{0.3\textwidth}
                \centering
                \includegraphics[width=\textwidth]{dummy}
                \caption{Column 1a}
                \label{fig:1}
            \end{subfigure}\\[1em]
            \begin{subfigure}[b]{0.3\textwidth}
                \centering
                \includegraphics[width=\textwidth]{dummy}
                \caption{Column 1b}
                \label{fig:2}
            \end{subfigure}%                    
        \end{tabular}
        &&
        \begin{tabular}{@{}c@{}}
        \begin{subfigure}[b]{0.3\textwidth}
        \centering
        \includegraphics[width=\textwidth]{dummy}
        \caption{Column 2a}
        \label{fig:3}
        \end{subfigure}\\[1em]
        \begin{subfigure}[b]{0.3\textwidth}
        \centering
        \includegraphics[width=\textwidth]{dummy}
        \caption{Column 2b}
        \label{fig:4}
        \end{subfigure}%
        \end{tabular}
    \end{tabular}
    \caption{The overall caption.}
    \label{fig:all}
  \end{figure}%
\end{document}

在此处输入图片描述

答案2

使用minipages 非常简单:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{array}

\begin{document}
    \begin{figure}
    \centering
\setkeys{Gin}{width=\linewidth}
    \begin{minipage}[t]{0.45\textwidth}  
        \begin{subfigure}[b]{\linewidth} 
            \includegraphics{example-image-duck}
            \caption{Column 1a}
            \label{fig:1}
        \end{subfigure}

        \medskip
        \begin{subfigure}[b]{\linewidth} 
            \includegraphics{example-image-duck}
            \caption{Column 1b}
            \label{fig:2}
        \end{subfigure}%
    \end{minipage}\hfil
    \begin{minipage}[t]{0.45\textwidth} 
        \begin{subfigure}[b]{\linewidth} 
        \includegraphics{example-image-duck}
        \caption{Column 2a}
        \label{fig:3}
        \end{subfigure}
        
        \medskip
        \begin{subfigure}[b]{\linewidth} 
        \centering
        \includegraphics{example-image-duck}
        \caption{Column 2b}
        \label{fig:4}
        \end{subfigure}%
    \end{minipage}
\caption{The overall caption.}
\label{fig:all}
    \end{figure}%
\end{document}

在此处输入图片描述

相关内容