\figureformat コマンドを再定義できません (\figureformat が未定義です)

\figureformat コマンドを再定義できません (\figureformat が未定義です)

図のキャプションの出力をカスタマイズするために、\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}

関連情報