跳转至

图片排版

引自帖子 LaTeX中一些常见的图片排版组合方式

前置宏包

\documentclass{ctexart}
\usepackage[left=1cm, right=1cm]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}

双图并排

非子图

\begin{figure}[htbp]
    \centering
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[width=0.9\textwidth]{example}
        \caption{图1}
        \label{}
    \end{minipage}%
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[width=0.9\textwidth]{example}
        \caption{图2}
        \label{}
    \end{minipage}
\end{figure}

子图

\begin{figure}[htbp]
    \centering
    \subcaptionbox{子图1}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.4\textwidth]{example}
        \label{}
    }
    \hspace{0.5cm} 
    \subcaptionbox{子图2}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.4\textwidth]{example}
        \label{}
    } 
    \caption{Figure}
    \label{}
\end{figure}

双图纵排子图

\begin{figure}[htbp]
    \centering
    \subcaptionbox{子图1}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.4\textwidth]{example}
        \label{}
    }\\[0.5cm] % 换行并产生图片纵向距离
    \subcaptionbox{子图2}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.4\textwidth]{example}
        \label{}
    } 
    \caption{双图纵排子图}
    \label{}
\end{figure}

三个子图横排

\begin{figure}[htbp]
    \centering
    \subcaptionbox{子图1}[0.33\textwidth][c]{
        \centering
        \includegraphics[width=0.32\textwidth]{example}
        \label{}
    }%
        \subcaptionbox{子图2}[0.33\textwidth][c]{
        \centering
        \includegraphics[width=0.32\textwidth]{example}
        \label{}
    }%
        \subcaptionbox{子图3}[0.33\textwidth][c]{
        \centering
        \includegraphics[width=0.32\textwidth]{example}
        \label{}
    }%
    \caption{三个子图横排}
    \label{}
\end{figure}

三个子图(金字塔型)

\begin{figure}[htbp]
    \centering
    \subcaptionbox{子图1}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }\\ % 换行
    \subcaptionbox{子图2}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }%
    \hspace{0.3cm}
    \subcaptionbox{子图3}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }%
    \caption{三个子图(金字塔型)}
    \label{}
\end{figure}

三图并排(一个非子图右两个子图)

\begin{figure}[htbp]
    \centering
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[width=0.9\textwidth]{example}
        \caption{并排非子图}
        \label{}
    \end{minipage}%
    \begin{minipage}[b]{0.45\linewidth}
        \subcaptionbox{并排两个子图1}[0.45\textwidth][c]{
            \centering
            \includegraphics[width=0.45\textwidth]{example}
            \label{}
        }%
        \hspace{0.02cm} % 调整图形间距
        \subcaptionbox{并排两个子图2}[0.45\textwidth][c]{
            \centering
            \includegraphics[width=0.45\textwidth]{example}
            \label{}
        } 
        \caption{并排两个子图}
        \label{}
    \end{minipage}
\end{figure}

三个非子图(一大两小)

\begin{figure}[htbp]
    \centering
    \begin{minipage}[b]{0.45\textwidth}
        \centering
        \includegraphics[width=\textwidth, height=1.2\textwidth]{example}
        \caption{大图}
        \label{}
    \end{minipage}
    \hspace{0.5cm}%
    \begin{minipage}[b]{0.4\textwidth}
        \begin{minipage}[b]{\textwidth}
            \centering
            \includegraphics[width=\textwidth]{example}
            \caption{小图1}
            \label{}
        \end{minipage}\\[0.8cm]% 换行
        \begin{minipage}[b]{\textwidth}
            \centering
            \includegraphics[width=\textwidth]{example}
            \caption{小图2}       
            \label{}
        \end{minipage}  
    \end{minipage}
\end{figure}

四个子图

\begin{figure}[htbp]
    \centering
    \subcaptionbox{子图1}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }%
    \hspace*{0.1cm}
    \subcaptionbox{子图2}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }\\% % 换行
    \subcaptionbox{子图3}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }%
    \hspace*{0.1cm}
    \subcaptionbox{子图4}[0.45\textwidth][c]{
        \centering
        \includegraphics[width=0.45\textwidth]{example}
        \label{}
    }%
    \caption{四个子图}
    \label{}
\end{figure}