# Changing Caption Font Doesn't Work

I need to format the caption of tables and figures in my document so that is is 10pt Arial font bold faced. The main font is 12pt Times New Roman. I've tried the following (MWE), but it doesn't seem to work. I'm using XeLaTex.

\documentclass[12pt]{article}

\usepackage{threeparttable}
\usepackage{caption}
\usepackage{fontspec}

\setmainfont{Times New Roman}
\newfontfamily\myfont{Arial}

\DeclareCaptionFormat{mytabformat}{\myfont\fontsize{10pt}{0pt}\bf\tablename~\thetable. \selectfont #3}
\captionsetup[table]{format=mytabformat}

\begin{document}

Some text, which appears to be in Times New Roman.

\begin{table}[h]
\centering
\caption{Summary of some stuff, but my caption it is not Arial font.}
\begin{tabular}{c c c }
\hline
Group & Value & Description \\
\hline
1 & 22  & Something\\
2 & 29 & Insightful\\
\hline
\end{tabular}
\end{table}

{\fontspec{Arial} Some more text (in Arial), just to be sure.}

\begin{table}[h]
\centering
\begin{threeparttable}
\caption{Summary of some stuff, but my caption it is not Arial font. threeparttable is not the problem}
\begin{tabular}{c c c }
\hline
Group & Value & Description \\
\hline
1 & 22  & Something\\
2 & 29 & Insightful\\
\hline
\end{tabular}
\end{threeparttable}
\end{table}

\end{document}


Any help would be appreciated?

You are using \bf that has been deprecated for 20 years and placing \selectfont in the wrong place. Also \fontsize{10}{0} is wrong.

\documentclass[12pt]{article}

\usepackage{threeparttable}
\usepackage{caption}
\usepackage{fontspec}

\setmainfont{Times New Roman}
\setsansfont{Arial}

\DeclareCaptionFormat{mytabformat}{%
\fontsize{10pt}{12pt}\sffamily\bfseries\tablename~\thetable. #3%
}

\captionsetup[table]{format=mytabformat}

\begin{document}

Some text, which appears to be in Times New Roman.

\begin{table}[h]
\centering

\caption{Summary of some stuff, but my caption it is not Arial font.}

\begin{tabular}{c c c }
\hline
Group & Value & Description \\
\hline
1 & 22  & Something\\
2 & 29 & Insightful\\
\hline
\end{tabular}

\end{table}

{\sffamily Some more text (in Arial), just to be sure.}

\begin{table}[h]
\centering
\begin{threeparttable}

\caption{Summary of some stuff, but my caption it is not Arial font.
threeparttable is not the problem}

\begin{tabular}{c c c }
\hline
Group & Value & Description \\
\hline
1 & 22  & Something\\
2 & 29 & Insightful\\
\hline
\end{tabular}
\end{threeparttable}

\end{table}

\end{document}


• I'm still new to LaTex, could you explain your answer in a little more detail? Sometimes it is hard to just look at the manual of a package, so often times I'll find code on these forums. I guess sometimes what others post may not necessarily be up to date. Thanks for the help! Aug 20 '15 at 16:28
• @user13317 The second argument to \fontsize specifies the baseline skip (with 0 the lines would bump each other and the spacing may be not uniform). When you give font selection commands, you have to do \selectfont, which is implicit in \sffamily and \bfseries, so it can be omitted here. Rather than a new font family, it's better to set the default sans serif font to Arial. Never use \bf, that's been deprecated for 20 years. Aug 20 '15 at 17:08