28 July 2009 View Comments

Write Chinese in LaTeX and LyX in Leopard


成功的可以在LaTeX还要LyX里写中文了。以前已经有很多这类教程了,但是我找了一下发现没有一个有用,后来觉得还是看说明书吧。就像学软件编程一样,不用老是捧着课本,多看看程序里的HELP,或者就看官方软件里的manual,结果被我试出来了。
以前已经有很多这类教程了,但是我找了一下发现没有一个有用,后来觉得还是看说明书吧,结果就被我试出来了。就像学软件编程一样,不用老是捧着课本,多看看程序里的HELP,或者就看官方软件里的manual。

Summary

我的系统是
MAC OSX 10.5.7
TeX Live Utility version 0.70
LyX version 1.6.3

Step 1

我首先看我的CJK Language Support安装好了没,这个可以去Tex Live Utility里查cjk

Path Finder.png

As you can see the cjk and collection-langcjk are installed. I find the show info is handy, it tells me that the collection-langcjk contains the Chinese fonts, macros.

collection-langcjk.png

Step 2

[cc lang="latex" line_numbers="true"]
\documentclass[11pt]{article}
\usepackage{CJK}
\usepackage{CJKspace}
\begin{document}
\parindent 2em
\begin{CJK*}{UTF8}{gbsn}
比如这里中文打中文
\end{CJK*}
\end{document}
[/cc]

scrap_paper.tex.png

CJK Settings for LyX

We can first create a new file, and we will need to choose Document -> Settings to configure

Document.png

We will need go to Fonts and set CJK to gbsn as follows

LyX_ Document Settings.png

我的language是这么选的

LyX_ Document Settings-1.png

In the LaTeX Preamble we will need to enter the following information:

LyX_ Document Settings-2.png

\usepackage{CJK}
\usepackage{CJKspace}
\parindent 2em
我发现用CJKspace是比较好,那样用中英混合排版效果不错。

Keywords: 中文,LyX, LaTeX, Typesetting, CJK, Big 5 encoded Chinese characters

Other reference/links:

How to make LaTeX (teTeX) handle unicode and CJK in MacOSX

我觉得官方文档还是比较有用的,比如说

CTAN home / tex-archive/ language/ chinese
那里我进入CJK下载了cjk-4.8.2-doc.tar.gz 和 cjk-4.8.2.tar.gz。

如果有问题欢迎在这里问。

Tags: , , ,
blog comments powered by Disqus