Saturday, July 12, 2008

Fedora 9中Tex的中文解决方案

Fedora 9 have texlive 2007 in both the DVD and the repository. But making it supporting Chinese is not as easy as the non-rpm texlive.

That's NOT the case because there are xetex and xelatex which can help you out in a unicode settings.

What should be done?
Install texlive-*

How to write?
This is a sample to make everything clear:

\documentclass[12pt,a4paper]{article}
\usepackage{hyperref}%不能有unicode选项,否则bookmark会是乱码
\usepackage{fontspec}
\setromanfont{SimSun}%定义中文字体
%中文断行
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\defaultfontfeatures{Mapping=tex-text}
\newfontinstance\rmfont{Liberation Sans}%定义非中文字体
\newcommand{\nc}[1]{{\rmfont #1}}


\hypersetup{pdfauthor={曹雪芹},
pdftitle={诗歌}} %注意,在document之外的导言区

\begin{document}
\tableofcontents

\section{其二}

蘅芷阶通萝薜门,也宜墙角也宜盆。花因喜洁难寻偶,人为悲秋易断魂。玉烛滴干风里泪,晶帘隔破月中痕。幽情欲向嫦娥诉,无奈虚廊夜色昏。
Chinese English \nc{Englisch English}
\setromanfont{SimHei}
\section{咏白海棠}

斜阳寒草带重门,苔翠盈铺雨后盆。玉是精神难比洁,雪为肌骨易消魂。芳心一点娇无力,倩影三更月有痕。莫谓缟仙能羽化,多情伴我咏黄昏。

\end{document}

No comments: