[Tex/LaTex] How to specify a font for labelfont in caption

captionscjkfontsxecjk

I would like to set the font for the caption label, not just its series, shape or size, I would like to set the font itself. For example, my document's font is set to be Times New Roman, but I would like the caption label to be in a font that exists in another font family or even under a different font encoding. However, the labelfont option of package caption seem to only allow attributes like normalfont, up, it, sl, sc, md, bf, rm, sf, tt and so on, it would not let me specify a literal font, like Georgia, Helvetica or others.

\usepackage[labelfont = bf]{caption}

I am not sure if I have made it clear, please let me know if it is not and I will try to make it clear as possible.

Also, the reason why I am asking this question is, I am typesetting a Chinese document in which the caption label is in Chinese, but in a font I do not like. I am trying to change the font for the caption label to another font for Chinese character.

Thanks in advance!

Best Answer

If you are already using caption package this might be a solution:

\documentclass{article}

\usepackage{tikz} %jus to draw a picture
\usepackage{caption}[2007/11/04]

%select font attributes for coptions
\DeclareCaptionFont{blah}{\small\fontseries{n}\fontfamily{phv}\selectfont}
%naturally you can define more caption fonts with different attributes to use different fonts for different kind of captions, table, figure,...

%define a different way to display "name-caption"
\DeclareCaptionLabelSeparator*{twonl}{\\[0.5\baselineskip]}

%select attributes for table caption
\captionsetup[table]{labelsep=twonl,justification=centering,font=blah}

%select attribute for figure caption
\captionsetup[figure]{labelsep=period,font=blah}


\begin{document}

Some text, only to be able to see the font difference

\begin{table}[h]
\centering
 \begin{tabular}{c|c}
  A & B\\
  \hline
  1 & 2
 \end{tabular}
 \caption{Different font for caption}
\end{table}

\begin{figure}[h]
 \centering
 \begin{tikzpicture}
  \draw (0,0) circle [radius=2cm];
 \end{tikzpicture}
 \caption{A nice circle}
\end{figure}


\end{document}

whose output looks like:

enter image description here

Related Question