我想将图号放在一行,标题放在第二行。欢迎提出任何建议。
\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}
我希望它有帮助。
罗曼