Pedro Andres Aranda Gutierrez have been recently working on better LaTeX export of non-latin Org documents, including written in Chinese. As a part of this work, we are looking for suitable standard LaTeX preamble that will suit most Chinese documents. Apart from setting appropriate unicode fonts, we also need to load some packages like \usepackage[CJKspace]{xeCJK}.
Another package we often see in various online forums is \usepackage{xpinyin}, but we are not 100% sure if it is really something that is commonly needed by native Chinese Org users. Could you please share your experience?
Pedro Andres Aranda Gutierrez 近期在改进非拉丁语Org文档(包括中文文档)的LaTeX导出功能。为此我们需要寻找一个标准的LaTeX导言,能够适配大多数中文文档。除了设置合适的Unicode字体外,还需要加载一些包,比如\usepackage[CJKspace]{xeCJK}。
the popular universe all-in-one solution for writing Chinese with LaTeX is the CTAN: Package ctex package by
\usepackage{ctex}
or by using one of the ctexart, ctexrep, ctexbook, ctexbeamer documentclasses, which auto detects TeX engine and load appropriate support packages like xeCJK for XeTeX or luatex-ja for luaTeX.
xpinyin
no, it is for adding phonetic alphabets, which is only relevant in very specific scenarios such as preparing exam papers for elementary school
Can someone please create a bug report about this? We have discussed potential solutions for Org markup when using Chinese on the list, but that was rather theoretical, without input from native speakers.
One of the possibilities I do recall is using zero-width space. You can get bold inside Org buffers that way: 你好*你好*你好. (you can copy-paste into Org buffer and see that “hello” in the middle is fontified as bold). This, however does not work with latex export as latex typesets zero-width spaces as normal spaces by default. So, we further discussed a possibility to cleanup zero-width spaces around markup during export. Or, alternatively, there might be a way to do the same in LaTeX:
#+LANGUAGE: zh
#+LATEX_HEADER: \usepackage[UTF8]{ctex}
#+LATEX_HEADER: \usepackage{newunicodechar}
#+LATEX_HEADER: \newunicodechar{}{}
#+LATEX_COMPILER: xelatex
* This is test
你好*你好*你好.
#+LANGUAGE: zh
#+LATEX_HEADER: \usepackage[UTF8]{ctex}
#+LATEX_HEADER: \usepackage{newunicodechar}
#+LATEX_HEADER: \newunicodechar{}{}
#+LATEX_COMPILER: xelatex
* This is test
你好*你好*你好.
There will be zero-width characters if you use the suggested 你好*你好*你好. Here, I used the official way Org supports inline emphasis (Escape Character (The Org Manual)) - adding zero-width spaces around the emphasis markers. These markers, however, are also preserved in LaTeX, where they are rendered as full-width spaces.
如果你使用建议的 你好*你好*你好,将会出现零宽字符。在这里,我使用了 Org 官方支持内联强调的方式(Escape Character (The Org Manual) )——在强调标记周围添加零宽空格。不过,这些标记在 LaTeX 中也会被保留,并被渲染为全角空格。
That would be too breaking and also against the original Org markup design. We have discussed alternative approaches to provide intraword markup in the past: (1) adding multiple markers **bold**; (2) adding a more verbose version of the markup @*{bold} (a special kind of inline special block).