In my code below, I wanted to change the color of the text for the table and figure caption. I am using this:
\usepackage[svgnames]{xcolor}
\definecolor{ocre}{RGB}{243,102,25}
\usepackage{caption}
\usepackage[labelfont={color=ocre,bf}]{caption}
\renewcommand{\thefigure}{\textcolor{ocre}{\bfseries\itshape\thechapter.\arabic{figure}}}
\renewcommand{\figurename}{\textcolor{ocre}{\bfseries\itshape Fig.}}
\renewcommand{\thetable}{\textcolor{ocre}{\bfseries\itshape\arabic{table}}}
\renewcommand{\tablename}{\textcolor{ocre}{\bfseries\itshape Table}}
This is what I get as the output.
Can you tell me how to get the caption text the same color as the Fig.1.1 text?
Best Answer
You can do all your changes using options for the
caption
package:In standard classes
book
andreport
, thefigure
andtable
counters are by default subordinated to thechapter
counter; if you are using a class in which this is not the default, you can useso the counter will be subordinated and will reset each time
chapter
steps.It is not a good idea,in general, to involve direct modifications of attributes like color in redefinitions of
\thefigure
(or\thetable
), since then the changes will also appear in (most of the times) undesired locations, such as cross-references.