[XeTeX] Can not display Chinese Characters in \caption

Jonathan Kew jfkthame at googlemail.com
Wed Apr 22 23:06:23 CEST 2009


On 22 Apr 2009, at 14:52, xingming wrote:

> Dear All,
>
> I am using XeTeX (TexLive 2008). I found that Chinese characters  
> disappear in \caption.
> However, it works if the package {hyperref} is not loaded.
>
> Best,
> Ming
>
> % -*- coding: utf-8 -*-
> \documentclass{article}
> \usepackage{hyperref}
> \begin{document}
> \font\1="SimSun"
> \1
>
> \begin{figure}
> \caption{中文 Chinese}
> \end{figure}
> \end{document}

I'd be surprised if it works either with or without hyperref, as I'd  
expect the figure environment and/or the caption to reselect a  
Computer Modern font by default, or something like that.

Anyhow, for xelatex, don't use ad hoc \font declarations like that;  
use the fontspec package:

\documentclass{article}
\usepackage{hyperref}
\usepackage{fontspec}
\setmainfont{SimSun}
\begin{document}
\begin{figure}
\caption{中文 Chinese}
\end{figure}
\end{document}

See the documentation of fontspec for much more information (e.g., use  
\newfontfamily if you want to create a \chinesefont command that you  
can use for certain sections of the text, without changing the default  
font for the whole document).

JK



More information about the XeTeX mailing list