CTEX and Chinese language

Posted by:

It turned to be not so trivial to setup Chinese for Latex in a Linux System. Hope this will help some souls.

CTEX Installation if not already


Windows Fonts for Chinese

LaTeX 随笔漫谈(1)- LaTeX 下的中文支持总结 – 若为自由故 路径:~/texlive/texmf-local/tex/latex/local/mychinesefont.sty~ English: Top 10 LaTeX Fonts

Copy fonts from one of your Windows System

cp Windows font to /usr/share/fonts/mschinese The following is the list of my windows fonts:


Note:

  1. 隶书和幼圆这两种字体Windows系统里没有,而在安装微软Office时会安装。 If you do not have it you can download the 6 fonts from here.
  2. About Windows old and new

    Adapted from here.

    在字体定义文件 ctex-xecjk-winfonts.def 中,楷体和仿宋不是使用字体全名,而是使用字体文件名表示的。如楷书是: \setCJKfamilyfont{zhkai}{[simkai.ttf]} 之所以这样是因为在 Windows XP 中楷书和仿宋是 GB2313 字符集的,只有 6000 多个汉字,楷体字体全名是 KaiTiGB2312;而在 Windows Vista 以后和版本则是 GBK 大字库的,有 20000 多个汉字,字体全名是 KaiTi。为了避免为微软的不同操作系统版本写不同的配置文件(这样更麻烦,而且 Windows 用户是大多数),就把它直接用没有变化过的字体文件名表示。

  3. 字体族名


    在 fontspec 或 xeCJK 中使用的字体族名是上面列表中冒号前的部分。例如可以使用


    fontspec 和 xeCJK 也可以使用字体的文件名访问字体。例如 Windows 下的宋体也可以使用命令:


Prep the Chinese fonts for Tex


Share Tex font for system-wide use

Assuming you have suitable privileges, proceed as follows. Copy the texlive-fontconfig.conf file to /etc/fonts/conf.d/09-texlive.conf.


Generate Chinese documents with template ElegantPaper – Life Savior

ElegantLaTeX/ElegantPaper: Elegant LaTeX Template for Working Papers

使用LATEX工作室提供的方正字体 (https://pan.baidu.com/s/1BgbQM7LoinY7m8yeP25Y7Q),提取码为:njy9进 行安装。

copy cls file to file:///home/tan/texlive/texmf-local/tex/latex/local/elegantpaper.cls. Verify fine the tex file can produce pdf.

Incorporate into a org-mode as a org-latex classes Export Org-mode in Chinese to PDF with custom latex class.


change options in org-mode:


In my case, it works with chinesefont=founder, or no setting. It does NOT work with modified nofont setting 字体设置 · ElegantLaTeX/ElegantPaper Wiki.

Cross your finger and pray hard

In my case, the windowsnew and ubuntu config file is working without any modification needed; but I have no luck with adobe and fandol fonts.

Test it out


0

Add a Comment