图号和标题分两行

图号和标题分两行

我想将图号放在一行,标题放在第二行。欢迎提出任何建议。

\documentclass{article}
\usepackage{lipsum}
\usepackage{caption} 
\usepackage{mwe}

\begin{document}
Example

\begin{figure}
    \centering
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-a} % first figure itself
        \caption{first figure}
    \end{minipage}\hfill
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-b} % second figure itself
        \caption{second figure}
    \end{minipage}
\end{figure}


\end{document}

答案1

让我将我的评论转换为答案:

\documentclass{article}
\usepackage{lipsum}
\usepackage[labelsep=newline]{caption} % <---
\usepackage{mwe}

\begin{document}
Example

\begin{figure}[htb]
    \centering
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-a} % first figure itself
        \caption{first figure with math expression: $2+2=4$}
    \end{minipage}\hfill
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-b} % second figure itself
        \caption{second figure}
    \end{minipage}
\end{figure}
\end{document}

在此处输入图片描述

如果您希望标题中的文本居中,请添加justification=centering选项caption

\usepackage[labelsep=newline,justification=centering]{caption}

在此处输入图片描述

答案2

您可以加载包caption并执行以下操作

\documentclass{article}
\usepackage{lipsum}
\usepackage{mwe}
\usepackage{caption}

\begin{document}
Example

\begin{figure}
    \centering
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-a} % first figure itself
        \caption{\\first figure}
    \end{minipage}\hfill
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-b} % second figure itself
        \caption{\\second figure}
    \end{minipage}
\end{figure}


\end{document}

在此处输入图片描述

更新

通过数学模式和数学表达式,

\documentclass{article}
\usepackage{lipsum}
\usepackage{mwe}
\usepackage{amsmath}
\usepackage[labelsep=newline]{caption}

\begin{document}
Example

\begin{figure}
    \centering
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-a} % first figure itself
        \caption{$\Pi \succ \Lambda$}
    \end{minipage}\hfill
    \begin{minipage}{0.45\textwidth}
        \centering
        \includegraphics[width=0.9\textwidth]{image-b} % second figure itself
        \caption{$\Phi \prec \Lambda$}
    \end{minipage}
\end{figure}


\end{document}

我希望它有帮助。

罗曼

相关内容