# Subfig: Color for numerates and line breaks in caption (beamer)

Before my subfig caption, Latex automatically put (a) (b) in front and color are in blue. Anyway to change the color of (a) and (b) to black?

Also, is there a way to enter line breaks in the subcaptions? Below are the headings that I use:

\documentclass[xcolor={dvipsnames}]{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme{default}  % or try serif, structurebold, ...
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{itemize items}[ball]
\setbeamertemplate{itemize subitem}[triangle]
\setbeamertemplate{footline}[page number]
}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{dsfont}
\usepackage{mathtools}
\usepackage{graphicx}
\DeclareMathOperator*{\Max}{Max}
\DeclareMathOperator*{\Min}{Min}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\usepackage{color}
\definecolor{darkblue}{rgb}{0.0,0.0,0.66}
\usepackage{hyperref}
\usepackage{bbm}
\usepackage{appendixnumberbeamer}
\usepackage{comment}
\usepackage{subfig}

\begin{document}

\section{Sample}
\begin{frame}{Sample}
\begin{figure}
\centering
\subfloat[This is figure a]{\includegraphics[width=0.49\textwidth]{example-image}}
\subfloat[This is figure b]{\includegraphics[width=0.49\textwidth]{example-image}}
\end{figure}
\end{frame}

\end{document}

• Could you please add \begin{document}...\end{document} to make your code compilable, and add some images and captions to illustrate your problem? You can used \includegraphics{example-image} to produce dummy image. – Ruixi Zhang Aug 2 '18 at 2:27
• Are you sure you want to use subfloats for that? Why not simply use columns? Then you have full control over the colors and can do as many line breaks as you want. – user121799 Aug 2 '18 at 3:10
• You don't need \usecolortheme{default} and \usefonttheme{default}. As the name suggests, they are loaded per default. – user36296 Aug 2 '18 at 8:05
• Also \usepackage{graphicx} and \usepackage{hyperref} are unnecessary. – user36296 Aug 2 '18 at 8:05

Some comments on the packages you used:

• You don’t need \usepackage{amsmath} if you used \usepackage{mathtools}.
• Both dsfont and bbm provide “black board” letters. I won’t mix these two fonts because they are very similar, so please choose only one.
• You don’t need \usepackage{color}, since beamer already uses xcolor.

Here is the solution: What you need is \setbeamercolor{caption name}{fg=black}.

\documentclass[xcolor={dvipsnames}]{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme{default}  % or try serif, structurebold, ...
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{itemize items}[ball]
\setbeamertemplate{itemize subitem}[triangle]
\setbeamertemplate{footline}[page number]
}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\definecolor{darkblue}{rgb}{0.0,0.0,0.66}
\usepackage{subfig}

\setbeamercolor{caption name}{fg=black}

\begin{document}

\section{Sample}
\begin{frame}{Sample}
\begin{figure}
\centering
\subfloat[This is figure a with a very very very very very long caption]{\includegraphics[width=0.49\textwidth]{example-image}}%
\subfloat[This is figure b]{\includegraphics[width=0.49\textwidth]{example-image}}
\end{figure}
\end{frame}

\end{document}