マクロツイーター

はてダから移行した記事の表示が崩れてますが、そのうちに直せればいいのに(えっ)

新しい XeLaTeX でどうしても xeCJK したい場合は

「LaTeX が新しくなってアレ」の話の続き。

XeLaTeX や LuaLaTeX で数式がアレな件は、unicode-data というパッケージの不具合が原因なのであるが、これについては修正版がもう CTAN に上がっているので、そのうち TeX Live にも反映されるであろう。

もう一つの問題は xeCJK(および zxjatype)がまともに動作しないことである。

% XeLaTeX 文書
% BXJSの標準設定は zxjatype を利用している
\documentclass[xelatex,a4paper,ja=standard]{bxjsarticle}
\begin{document}
(新しい){\LaTeX}がアレ!
\end{document}

この例では文字が欠ける結果になったが、訳の解らないエラーが発生する場合もある。

この不具合の原因は、LaTeX カーネルで旧来行われていた文字クラス(\XeTeXcharclass)の初期設定が廃止されたことにある。このことは LaTeX News でも言及されている。((\XeTeXintercharclass\XeTeXcharclass の誤りだろう。))

For XeTeX, users should note that \xtxHanGlue and \xtxHanSpace are no longer defined, that no assignments are made to \XeTeXinterchartoks and that no \XeTeXintercharclass data is loaded into the format. The values which were previously inherited from the plain XeTeX setup files are not suitable for properly typesetting East Asian text. …… Third-party packages may need adjustment to load the data themselves; see the unicode-data package for one possible loader.
LaTeX News, Issue 24, February 2016

従って、これは意図的な変更であり、xeCJK パッケージの方で対応を行う必要があるということになる。

xeCJK の修正版が入手可能になるまで待てないという人のために、応急措置を紹介しておく。文書ファイルの先頭に次の行を書けば、新しい LaTeX で現状の xeCJK がとりあえず通るようになる。

\input{load-unicode-xetex-classes}\count257=3

先の例の文書だと、次のようになる。

\input{load-unicode-xetex-classes}\count257=3
\documentclass[xelatex,a4paper,ja=standard]{bxjsarticle}
\usepackage{xeCJK}
\setCJKmainfont{IPAexMincho}
\begin{document}
(新しい){\LaTeX}がアレ!
\end{document}

xeCJK の開発元のリポジトリを見ると、ソレっぽい修正がコミットされているので、近い将来に正式な修正版が公開されると思われるが……。