6

I would like to change the color of the "FIGURE 1:" portion of my caption to blue (including the number & colon), but I want the remainder of the caption to be black. I have tried the following in my preamble, however, the whole caption is blue:

\documentclass{article}
\usepackage{color}
\renewcommand{\figurename}{\color{blue}{FIGURE}}
\usepackage{graphicx}

\begin{document}

\begin{figure}
        \includegraphics[width=\linewidth]{../ubmFigures/exampledoc}
         \caption{An example figure}
\end{figure}
\end{document}
9

The caption package provides better control over caption elements. Specifically, you can set the labelfont and textfont to include colour or not. With the elements grouped, just setting labelfont{color=blue} prints the \figurename, number and separator in blue:

enter image description here

\documentclass{article}
\usepackage{graphicx,xcolor}% http://ctan.org/pkg/{grahpicx,xcolor}
\usepackage{caption}
\renewcommand{\figurename}{FIGURE}
\captionsetup[figure]{labelfont={color=blue}}
\begin{document}
\begin{figure}
  \includegraphics{example-image-a}
  \caption{An example figure}
\end{figure}
\end{document}

A discussion on the options are available from the caption documentation (section 2.3 Fonts, p 9-10).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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