2

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!

  • 1
    You might try to play with \DeclareCaptionFormat and similar commands described in § 4 of the documentation (‘Own Enhancements’), pp 24-28. – Bernard Oct 17 '18 at 19:27
2

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

  • It worked! Thanks so much! For my case, I used \DeclareCaptionFont{kai}{\kaishu} then \captionsetup{labelfont = kai} with package ctex loaded. – zyy Oct 18 '18 at 3:39
  • 1
    @zyy Great! you needed only a hint – Luis Turcio Oct 18 '18 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.