1

I want to redefine the \figureformat to customize the output of figure captions:

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

However, it gives an error when I compile:

\figureformat undefined. \renewcommand*{\figureformat}

Here is the test tex:

\documentclass[10pt,letterpaper]{article}

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

\begin{document}

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

\end{document}

I am using TeX Live 2013/W32TeX and TexStudio

  • Out of curiosity, where did you find this command? – Johannes_B Feb 17 '15 at 15:02
  • @Johannes_B Here: http://tex.stackexchange.com/questions/27250/remove-dot-after-number-in-figure-captions-while-keeping-the-dot-in-chapter-sect – Changwang Zhang Feb 17 '15 at 15:09
  • There is your answer, figureformat is only defined with KOMA-classes. With the standard classes, you can use package caption to do it with a nice interface. – Johannes_B Feb 17 '15 at 15:13
  • @Johannes_B The problem is I want to change the format only for figures. I want the format of tables to remain unchanged. If I use caption interface, I will change both. – Changwang Zhang Feb 17 '15 at 15:22

1 Answers1

3

The command you cannot redefine is only provided by KOMA-classes. For the standard classes, package captioncomes in handy. You can define the labelformat for just figures, if you want to. Tables will stay the same.

leoCaptionFormat

\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}
Johannes_B
  • 24,235
  • 10
  • 93
  • 248