CTeX-org / ctex-kit

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

Extra space using xecjk with bidi-enabled babel #522

Open cykerway opened 4 years ago

cykerway commented 4 years ago
\documentclass[12pt]{article}
\usepackage[bidi=default,main=english]{babel}
\babelprovide[import]{chinese-simplified}
\babelfont{rm}{FreeSerif}
\babelfont[chinese-simplified]{rm}{Noto Serif CJK SC}
\usepackage{xeCJK}
\setCJKmainfont{Noto Serif CJK SC}
\setlength{\parindent}{0pt}
\begin{document}

一二三四

\foreignlanguage{chinese-simplified}{一二三四}

一二三四

\end{document}

img

Problem: The second line has unwanted space. Removing bidi=default will fix the extra space, but I need bidi for other RTL languages. I know I don't have to use \foreignlanguage{chinese-simplified} for Chinese text, but I'm wondering where the extra space comes from when using this macro. If possible I'd like to keep this macro since there has to be extra work removing this macro from babel settings. I'm using texlive 2019 with not-too-old packages.