3

I am writing a document in Chinese and would like to choose a font for the caption label, different from that is used in the main text. I know it is tricky to work with Chinese font in LaTeX, but I really want to get this straight.

To set caption label to use a font defined readily in ctex, one could do the following

\documentclass[UTF8]{article}
\usepackage{ctex}
\usepackage{float}
\usepackage{graphicx}
\usepackage{caption}

\DeclareCaptionFont{kai}{\kaishu}
\captionsetup{labelfont = kai}

\begin{document}

正文

\begin{figure}[h]
\centering
\includegraphics[scale = 0.3]{example.png}
\caption{图注}
\end{figure}

\end{document}

However, I have no idea of how to declare a font that is not already defined in ctex for the caption label. Like the font Weibei SC, which can be used with package fontspec for the main text

\documentclass[11pt, a4paper]{article}
\usepackage{fontspec}
\setmainfont{Weibei SC}

\begin{document}

正文

\end{document}

Could someone help me on this issue? Thanks in advance!

1 Answer 1

3

Since you mentioned the use of fontspec, I will assume that your compile engine is XeLaTeX/LuaLaTeX. Basically you need to declare a new CJK font. I do not have Weibei SC, so I will illustrate using 华文新魏.

% !TeX program = XeLaTeX
\documentclass[UTF8]{article}

\usepackage{ctex}
\newCJKfontfamily\weibei{华文新魏}

\usepackage{graphicx}
\usepackage{caption}
\DeclareCaptionFont{weibei}{\weibei}
\captionsetup{labelfont=weibei}

\begin{document}

正文

\begin{figure}[h]
\centering
\includegraphics[scale = 0.3]{example-image}
\caption{图注}
\end{figure}

\end{document}

label font

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .