# Adding text between figure number and its punctuations

We are using the below definition to get the figure numberings automatically

\renewcommand\thefigure{\@arabic\c@figure}
\def\fnum@figure{\figurename~\thefigure}


The output is as shown below:

Figure 1. Caption

But, we need to insert the text "(Online color)" after figure number as shown below:

Figure 1 (Online color). Caption

To achieve this I again redefining the command

\def\fnum@figure{\figurename~\thefigure (Online color)}


which again I have to reset for the next captions.

Could anyone suggest how to get this automatically?

-
If you redefine \fnum@figure it will stay redefined unless something else changes it. What class/packages are you using? Can you please provide an example? – Thruston Feb 11 '14 at 10:31
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Feb 21 '14 at 11:20

This should get you started. I have defined a new environment myfigure. If you want

Figure 1 (Online color). Caption


use myfigure or else use figure.

A sample code:

\documentclass{article}
\usepackage{caption}
\usepackage{graphicx}
\DeclareCaptionFormat{myformat}{#1 (Online color)#2#3}
\newenvironment{myfigure}%
{\captionsetup{format=myformat,labelsep=period}
\figure
}%
{\endfigure}%
\begin{document}
\listoffigures
\begin{myfigure}[htb]
\centering
\includegraphics[width=4cm]{example-image-a}
\caption[myfig1]{my caption here}
\end{myfigure}

\begin{figure}[htb]
\centering
\includegraphics[width=4cm]{example-image-b}
\caption[myfig2]{my caption here}
\end{figure}
\end{document}


Further adjustments are left as assignment. For details refer to caption manual.

-

Here a different solution with no need for additional packages.

Simply issue the command \onlinecap inside those figure environments where you want the modified caption.

MWE:

\documentclass{article}

\makeatletter
\renewcommand\thefigure{\@arabic\c@figure}
\renewcommand\fnum@figure{\figurename~\thefigure}
\makeatother

\begin{document}

\begin{figure}[htbp]
\caption{A}
\end{figure}

\begin{figure}[htbp]
\onlinecap
\caption{B}
\end{figure}

\begin{figure}[htbp]
\caption{C}
\end{figure}

\end{document}


Output:

Just in case you have figures with multiple captions, you might need a command to nullify the effect of \onlinecap for a subsequent caption. In this case you might also insert between \makeatletter and \makeatother another line which defines a command \offlinecap for this purpose:


-
Probably also an \offlinecap command should be provided, in case a figure environment has two captions, only the first of which has the addition. – egreg Feb 11 '14 at 11:46
@egreg Thanks for the suggestion. Added in the answer. – karlkoeller Feb 11 '14 at 12:17