無法重新定義 \figureformat 指令(\figureformat undefined)

無法重新定義 \figureformat 指令(\figureformat undefined)

我想重新定義 \figureformat 以自訂圖形標題的輸出:

\renewcommand*{\figureformat}{\thefigure.\figurename}

但是,當我編譯時,它給出了一個錯誤:

\figureformat undefined. \renewcommand*{\figureformat}

這是測試文本:

\documentclass[10pt,letterpaper]{article}

\renewcommand*{\figureformat}{\thefigure. \figurename}

\begin{document}

\begin{figure}[h]
\caption{{test}
\label{fig1}
\end{figure}

\end{document}

我正在使用 TeX Live 2013/W32TeX 和 TexStudio

答案1

您無法重新定義的命令僅由 KOMA 類別提供。對於標準類,包caption會派上用場。如果需要,您可以僅為數字定義標籤格式。表格將保持不變。

leo 字幕格式

\documentclass[10pt,letterpaper]{article}

\usepackage{caption}
\DeclareCaptionLabelFormat{figure}{\thefigure.\nobreakspace\figurename}
\captionsetup[figure]{labelformat=figure}
\begin{document}

\begin{figure}[h]
    \caption{figure caption}
    \label{fig1}
\end{figure}
\begin{table}[h]
    \caption{table caption}
\end{table}

\end{document}

相關內容