CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
976 stars 124 forks source link

Cannot output CJK chars in toc with Polyglossia #519

Closed cykerway closed 4 years ago

cykerway commented 4 years ago
\documentclass[11pt]{book}
\usepackage{polyglossia}
\usepackage{xeCJK}
\setdefaultlanguage{english}
\setotherlanguage{french}
\setmainfont{Noto Serif}
\setCJKmainfont{Noto Serif CJK SC}
\title{xeCJK and Polyglossia}
\author{}
\date{}
\begin{document}
\tableofcontents
\section{中文}
\section{English}
\begin{english}
\end{english}
\section{中文}
\section{French}
\begin{french}
\end{french}
\section{中文}
\section{中文}
\section{中文}
\end{document}

j

Can be "fixed" by using a CJK font in \setmainfont. But this overwrites the default latin font.

cykerway commented 4 years ago

BTW I understand xeCJK is NOT supposed to be used together with polyglossia. But this bug doesn't seem related with \XeTeXinterchartoks. It looks like a font switch problem. So I think it's probably not very difficult to fix.

cykerway commented 4 years ago

The same bug can also be produced with \begin{otherlanguage}, which is more or less:

\begingroup
\selectlanguage{<inner-language>}
...
\endgroup
\selectlanguage{<outer-language>}

But an additional grouping doesn't fix it. My current workaround is to use \begin{otherlanguage*} instead.

zepinglee commented 4 years ago

The result cannot be reproduced.

TeX Live 2020
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-06-03>
polyglossia 2020/04/08 v1.49
xeCJK 2020/06/06 v3.8.4
Screen Shot 2020-06-09 at 13 34 34
cykerway commented 4 years ago

Great. I can't reproduce either with polyglossia==1.49. Close it for now.