
下圖的字幕來了Figure 1: abc
\begin{figure}[!h]
\centering
\includegraphics[width=12cm]{Fig.jpg}
\caption{abcd}
\label{fig}
\end{figure}
我想將標題更改為Figure S1: abc
答案1
我完成了你的程式碼微量元素(請務必自己做)。您的目標可以透過以下方式實現:
\documentclass{report}
\usepackage{graphicx}
\begin{document}
\let\oldthefigure\thefigure % Store old \thefigure-command.
\renewcommand{\thefigure}{S\oldthefigure} % Create new \thefigure-command by prepending an "S".
\begin{figure}[!h]
\centering
\includegraphics[width=12cm]{example-image-duck}
\caption{abcd}
\label{fig}
\end{figure}
See Figure~\ref{fig}.
\end{document}
答案2
如果您加載標題包中,您可以使用 來調整字幕\captionsetup
。您想要如何進行變更取決於您放置此巨集的位置。如果您希望更改圖中的所有標題,請在序言中新增這些行
\DeclareCaptionLabelFormat{<<the name>>}{#1 S#2}
\captionsetup[figure]{labelformat=<<the name>>}
但是,如果您只想影響選定的圖形,請保留\DeclareCaptionLabelFormat
序言並在figure
環境中新增其他命令(不含可選參數)
\captionsetup{labelformat=<<the name>>}
具有全域設定的完整程式碼:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\DeclareCaptionLabelFormat{labelwiths}{#1 S#2}
\captionsetup[figure]{labelformat=labelwiths}
\begin{document}
\begin{figure}[!h]
\centering
\includegraphics[width=12cm]{Fig.jpg}
\caption{abcd}
\label{fig}
\end{figure}
\begin{figure}[!h]
\centering
\includegraphics[width=12cm]{Fig.jpg}
\caption{Sample sample sample}
\label{fig}
\end{figure}
\end{document}