2

My question is very similar to this, However, I would like to only change the name of Caption for a specific figure, instead of all figures. Is it even possible and if so, then how?

2 Answers 2

6

IFF your document is really similar to the linked question, then you could do this:

\documentclass{article}

%\renewcommand{\figurename}{Fig.}

\usepackage[labelsep=endash]{caption}

\begin{document}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{This is a figure}
\end{figure}

\begin{figure}
\renewcommand{\figurename}{Fig.}%
\centering
\rule{1cm}{1cm}
\caption{This is a figure}
\end{figure}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{This is a figure}
\end{figure}

\end{document}

However, depending on what your real document looks like --- which is why an MWE is almost always advisable --- you may need to do something rather different.

6
  • Yea, I was about to post same answer, I realized moving that command under any figure will change the caption name.
    – lonesome
    Commented Jun 23, 2016 at 1:09
  • It's actually about keeping the redefinition in a group (here, the \begin{<environment>} ... \end{<environment>}.
    – jon
    Commented Jun 23, 2016 at 1:17
  • What other group(s) are available for this redefinition?
    – lonesome
    Commented Jun 23, 2016 at 1:22
  • And can you tell me how to reset numbering for the particular figure with redefined caption name?
    – lonesome
    Commented Jun 23, 2016 at 1:36
  • @lonesome -- When do you want to reset the numbering? Normally, the counter is incremented in relation to other counters (such as those triggered by \chapter and/or \section, e.g.).
    – jon
    Commented Jun 24, 2016 at 2:21
4

This is more of an answer to a comment, but it was too long to write there. It is based on the code in jon's answer.

It creates a new counter. I am sure this can be done in one of the existing packages, but this works without any.

A new environment is created (figCaption), mostly not to keep writing the same thing for every figure. Within it, it just copies and replaces the existing counter for the figure, and resets it afterwards, so that the normal figure will keep counting Also, it replaces the figure-name, in the same way jon did, in his code.

Output

enter image description here

Code

\documentclass{article}

\usepackage[labelsep=endash]{caption}
\newcounter{Figcount}
\newcounter{tempFigure}
\newenvironment{figCaption}{%
    \renewcommand{\figurename}{Fig.}
    \setcounter{tempFigure}{\thefigure}
    \setcounter{figure}{\theFigcount}
    }{%
    \setcounter{figure}{\thetempFigure}
    \stepcounter{Figcount}
    }
\begin{document}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{This is a figure}
\end{figure}

\begin{figure}
\begin{figCaption}
    \centering
    \rule{1cm}{1cm}
    \caption{This is a figure}
\end{figCaption}
\end{figure}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{This is a figure}
\end{figure}

\begin{figure}
\begin{figCaption}
    \centering
    \rule{1cm}{1cm}
    \caption{This is a figure}
\end{figCaption}
\end{figure}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{This is a figure}
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .