Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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 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 at 11:20

2 Answers 2

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}

enter image description here

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

share|improve this answer

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}
\newcommand\onlinecap{\renewcommand\fnum@figure{\figurename~\thefigure~(Online color)}}
\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:

enter image description here

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:

\newcommand\offlinecap{\renewcommand\fnum@figure{\figurename~\thefigure}}
share|improve this answer
1  
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 at 11:46
    
@egreg Thanks for the suggestion. Added in the answer. –  karlkoeller Feb 11 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.