如何在标题中的图片编号和名称前添加附加文字?

如何在标题中的图片编号和名称前添加附加文字?

我需要使标题看起来如下:

   Additional text
Figure 1:Picture name

我怎样才能实现这个目标?

答案1

“照常”做:

\documentclass{article} 
\usepackage{graphicx}
\begin{document} 
\begin{figure}
    \centering
    \includegraphics{example-image}

    This is some text
    \caption{Caption}
    \label{fig:my_label}
\end{figure}
\end{document}

答案2

您可以使用包\DeclareCaptionLabelFormat中的命令caption来实现您需要的功能

\documentclass{article}
\usepackage{mwe}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Add the following %%%%%%%%%%%%%%
\usepackage{caption}  
\DeclareCaptionLabelFormat{mycaptionlabel}{ 
                This is some text before each caption \\ 
                #1 #2
                      } 
\captionsetup{labelformat=mycaptionlabel} 

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{figure}
    \centering
    \includegraphics[scale=0.5]{example-image-a}
    \caption{my first figure}
\end{figure}

\begin{figure}
    \centering
    \includegraphics[scale=0.5]{example-image-b}
    \caption{my second figure}
\end{figure}
\end{document}

在此处输入图片描述

相关内容