3

For colored figures, Physical Review journals require that the caption label takes the form "FIG. 1 (color online). Caption content" if the figure will not appear in color in print.

Could someone with RevTex experience tell me how to put that "(color online)" label before the caption's label separator (i.e. before the period that follows the figure's number)? Thanks.

2
  • Could you provide the community with a minimal working example (MWE) of your current setup? Not everyone is familiar with RevTeX's format and/or requirements. It'll speed up the process of getting solutions your way.
    – Werner
    Commented Jul 24, 2015 at 18:46
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Jul 24, 2015 at 19:09

1 Answer 1

6

If you're using revtex4-1 there is a hook \@caption@fignum@sep for determining the separator following the float number, which defaults to a period followed by a space:

\def\@caption@fignum@sep{. }

You can define a new command \colorcaption to be used instead of caption for colored figures.

\makeatletter
\newcommand{\colorcaption}[2][]{%
  \begingroup%
  \renewcommand{\@caption@fignum@sep}{ (color caption). }%
  \caption[#1]{#2}%
  \endgroup%
}
\makeatother

This command redefines \@caption@fignum@sep to have the caption you want. \begingroup...\endgroup ensure that the change is made locally.

MWE:

\documentclass[]{revtex4-1}
\usepackage{graphicx}

\makeatletter
\newcommand{\colorcaption}[2][]{%
  \begingroup%
  \renewcommand{\@caption@fignum@sep}{ (color caption). }%
  \caption[#1]{#2}%
  \endgroup%
}
\makeatother

\begin{document}

\begin{figure}
\includegraphics[width=10cm]{example-image-a}
\colorcaption{Colored figure}
\end{figure}

\begin{figure}
\includegraphics[width=10cm]{example-image-b}
\caption{Normal caption}
\end{figure}

\vspace*{\fill} % just for displaying purposes

\end{document} 

Output:

enter image description here

2
  • Thanks! This does exactly what I need. Apologies for not including the MWE.
    – user82567
    Commented Jul 26, 2015 at 17:48
  • @user82567 You're welcome. And don't mind for the MWE, in this case the question was clear enough even without it. But, generally consider adding a MWE to your questions ;-) Happy TeXing. Commented Jul 26, 2015 at 19:48

You must log in to answer this question.

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