(I forgot to CC the mailing list) On Sun, 09 Nov 2025 15:33:32 +0800, Pedro Andres Aranda Gutierrez wrote: > > [1 <multipart/alternative (7bit)>] > [1.1 <text/plain; UTF-8 (quoted-printable)>] > [1.2 <text/html; UTF-8 (quoted-printable)>] > ---------- Forwarded message --------- > From: Pedro Andres Aranda Gutierrez <[email protected]> > Date: Sun, 9 Nov 2025 at 08:15 > Subject: Re: Status of the all-tex-fonts feature branch > To: Ihor Radchenko <[email protected]> > Cc: Org Mode List <[email protected]> > > After a longer CJK immersion ... > > On Sat, 8 Nov 2025 at 21:37, Ihor Radchenko <[email protected]> wrote: > > Pedro Andres Aranda Gutierrez <[email protected]> writes: > > >> You also removed xeCJK. Why? > >> > > Woops, I went too far... > > + ;; If the CJK font families have been included > + ;; Check for polyglossia and/or babel and warn? > + ;; Or advise for these packages to be added to > `org-latex-package-alist' ?? > + (when (and cjk-packages (equal compiler "xelatex")) > + (message "Adding the CJK packages") > + (goto-char (point-min)) > + (forward-line 2) > + (insert "\\usepackage[CJKspace]{xeCJK}\n")) > > From the forum replies, it looks like > \usepackage{ctex} is strictly better - it loads xeCJK foe xelatex, and > also right packages for lualatex and even pdflatex. > > OK further experiments I have done show that > if there is a \setCJK...font{} declaration (for example from a > .dir-locals.el), > you need xeCJK. Therefore we will keep the code as is. > If we do not add this package in the presence of explicit CJK fonts, we don't > produce compilable documents. > > ctex is (IMHO) orthogonal to this.
ctex (https://ctan.org/pkg/ctex) can actually be think of an abstraction layer on top of several Chinese supporting macro-packages, so for example when compiled using XeTeX (XeTeX is the engine which XeLaTeX is a format built for XeTeX) it will load xeCJK, and when using LuaTeX, it will load luatex-ja for Chinese typesetting support. IMO it's best to use it, so the export of Org containing Chinese text can be processed with nearly every TeX engine (XeTeX, LuaTeX, pTeX family, pdfTeX, ApTeX). For the \setCJK...font declaration, I can provide a wrapper in LaTeX if needed, compatible with XeTeX, LuaTeX and probabily other engines. You will need xeCJK for this control sequence while other engines will not compile because it is provided by the xeCJK package. Under other engines, there are different control sequences used for font configuration (i.e., under LuaTeX thus luatex-ja, you use \set...jfont). Feel free to ask me to elaborate. > Also, maybe we should load these conditional of #+language? Say, by > adding to `org-latex-language-alist'. Then, we might be able to > generalize similar specialized packages to more languages. > > Could we keep that as a FIXME for a refinement and discuss it further in the > future? > > >> And I am getting > >> ⛔ Warning (ox-latex): PDF file produced with warnings: [Missing > >> character(s): please load an appropriate font with the fontspec package] > >> Despite everything being rendered just fine. > > ... > > The warning, however, is triggered by: > > > > = Missing character: There is no (U+200B) in font > > [lmroman10-regular]:mapping=t > > = ex-text;! > > = Missing character: There is no (U+200B) in font > > [lmroman10-regular]:mapping=t > > = ex-text;! > > > > The character it is complaining about is a zero width space > > <https://unicode-explorer.com/c/200B>. > > I would need to investigate where this character comes from. > > But it has nothing to do with adding or not xeCJK. > > It is right from > 包时,org当中的加粗转为中间文件*tex*时是 - 200B*tex*200B escaping > emphasis markup, as full with spaces are not used in Chinese writing. > > > And it appears when the default font is lmroman. > Setting the main font to 'Noto Serif' got rid of the message. CJK typesetting conventions is to use different font for CJK characters and latin characters, so setting the main font to 'Noto Serif' is generally not considered as a good solution. > The other option is the LATEX_HEADER in your proposal plus > #+LATEX: \ctexset{space=auto} > which I got from > https://emacs-china.org/t/help-implementing-better-out-of-the-box-xelatex-export-in-org/30405/6 > (thanks LuciusChen for this!) > With that, using lmroman will not trigger the warning and it will not > interfere with fonts that define the 200B > character. And the use of \ctexset{space=auto} is not encouraged, expecially by Org. This option has different behaviours across different engines. If decided adding zws as delimiters is the solution for inline markup CJK texts, then the best solution should be changing the catcode for zws as active, and define it to \relax. So it will be ignored by the TeX engine while macro expansion. This is the code, which you can add in preamable to test. \catcode`\^^^^200b=\active\let^^^^200b\relax > Which begs the question whether a solution with an extra document class for > this could not be the cleanest answer in the > future. (But leave it as FFS, please) I am willing to work on Chinese and Japanese support in Org, however I might need some guidance on the Org infra. And since there is no such package like ctex for Japanese, only a document class providing unified interface across engines (the BXjscls, https://ctan.org/pkg/bxjscls). Some questions: 1. Which engines should we support? Only pdfTeX, XeTeX and LuaTeX, or pTeX family and ApTeX as well. 2. How configurable the TeX export is from Org? In what form can one configure it? (sry I'm not that familiar with Org.) This might affect whether to use an engine-wise solution rather than ctex or any unified interface, since that's more flexible. 3. Do we prefer document class based solution or macro-package based solution? > -- > Ihor Radchenko // yantar92, > Org mode maintainer, > Learn more about Org mode at <https://orgmode.org/>. > Support Org development at <https://liberapay.com/org-mode>, > or support my work at <https://liberapay.com/yantar92> > > > PS, I'm attaching the test document to make it easier to add things w/o going > through potential cut&paste quirks > > Best, /PA > -- > Fragen sind nicht da, um beantwortet zu werden, > Fragen sind da um gestellt zu werden > Georg Kreisler > > "Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE! > Year 1 of the New Koprocracy > > -- > Fragen sind nicht da, um beantwortet zu werden, > Fragen sind da um gestellt zu werden > Georg Kreisler > > "Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE! > Year 1 of the New Koprocracy > [2 test-ctex.org <application/octet-stream (base64)>]
