子图标题位置不正确

子图标题位置不正确

无论我删除了多少包,我似乎都无法找出为什么我的子图上的标题被放在了图的顶部而不是下方。我删除了文档中的所有内容,只留下了最基本的部分,但标题仍然放在顶部,尽管我的代码与没有遇到此问题的人的代码相同。到底是怎么回事?我如何强制将子标题放在图像下方,这是标准做法吗?在此处输入图片描述

\documentclass[11pt,a4paper]{article}
\pdfoutput=1

\usepackage{graphicx} % Including graphics

\usepackage{subcaption} % For subfigures

\captionsetup[subfigure]{position=bottom}

\begin{document}

\begin{figure}[t]
%\centering
\begin{subfigure}[b]{0.4\textwidth}
    %\centering
    \caption{Test.
    \label{fig:StNDdbL}}
    \includegraphics[width=1\textwidth]{example-image-a}
\end{subfigure}
\hspace{2ex}
\begin{subfigure}[b]{0.4\textwidth}
    %\centering
    \caption{Test.
    \label{fig:StNDdbP}}
    \includegraphics[width=1\textwidth]{example-image-a}
\end{subfigure}
\\[3ex]

%\centering
\begin{subfigure}[b]{0.4\textwidth}
    %\centering
    \caption{Test.
    \label{fig:StNFbpL}}
    \includegraphics[width=1\textwidth]{example-image-a}
\end{subfigure}
\hspace{2ex}
\begin{subfigure}[b]{0.4\textwidth}
    %\centering
    \caption{Test.
    \label{fig:StNFbpP}}
    \includegraphics[width=1\textwidth]{example-image-a}
\end{subfigure}
\caption{Test.
\label{fig:StImages}}
\end{figure}

\end{document}

答案1

正如评论中所说:

\caption{}下面的图形放入代码中。像这样:

\documentclass[11pt,a4paper]{article}
\pdfoutput=1

\usepackage{graphicx} % Including graphics

\usepackage{subcaption} % For subfigures

\captionsetup[subfigure]{position=bottom}

\begin{document}
    
    \begin{figure}[t]
        %\centering
        \begin{subfigure}[b]{0.4\textwidth}
            %\centering
            \includegraphics[width=1\textwidth]{example-image-a}
            \caption{Test.
                \label{fig:StNDdbL}}
        \end{subfigure}
        \hspace{2ex}
        \begin{subfigure}[b]{0.4\textwidth}
            %\centering
            \includegraphics[width=1\textwidth]{example-image-a}
            \caption{Test.
                \label{fig:StNDdbP}}
        \end{subfigure}
        \\[3ex]
        
        %\centering
        \begin{subfigure}[b]{0.4\textwidth}
            %\centering
            \includegraphics[width=1\textwidth]{example-image-a}
            \caption{Test.
                \label{fig:StNFbpL}}
        \end{subfigure}
        \hspace{2ex}
        \begin{subfigure}[b]{0.4\textwidth}
            %\centering
            \includegraphics[width=1\textwidth]{example-image-a}
            \caption{Test.
                \label{fig:StNFbpP}}
        \end{subfigure}
        \caption{Test.
            \label{fig:StImages}}
    \end{figure}
    
\end{document}

在此处输入图片描述

相关内容