# How to set font size for \caption* (but not \caption)

I need to change the font size from \caption* to 10pt.However, using \captionsetup the \caption font size changes as well. How can I solve that?

-

## migrated from stackoverflow.comAug 21 '12 at 14:30

This question came from our site for professional and enthusiast programmers.

Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – percusse Aug 21 '12 at 14:34

The following minimal example changes the starred \caption of all floats to be different from that of \caption using etoolbox to patch \caption@@@make:

\documentclass[12pt]{article}
\usepackage[paperheight=4in]{geometry}% http://ctan.org/pkg/geometry
\usepackage{caption}% http://ctan.org/pkg/caption
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\captionsetup{font=small}
\makeatletter
\patchcmd{\caption@@@make}% <cmd>
{\ifcaption@star}% <search>
{\ifcaption@star\footnotesize}% <replace>
{}{}% <success><failure>
\makeatother
\begin{document}
\makeatletter
\begin{figure}\caption{A regular figure caption: \f@size{}pt}\end{figure}
\begin{figure}\caption*{A starred figure caption: \f@size{}pt}\end{figure}
\makeatother
\end{document}


\captionsetup sets the caption font to \small in a 12pt base font, which is equivalent to 10.95pt (for \caption). The patch turns \caption*'s font size into \footnotesize, which is equivalent to 10pt.

geometry was used just for this example to reduce the paper size and may not be needed in your application.

-