Latex on Fedora

From ITRS
Jump to: navigation, search
  • Fedora 17+ should contain up-to-date TexLive packages.
  • Fedora 16- are stuck with outdated TexLive 2007 packages by default. Updates were blocked by a legal audit (wiki, RHBZ:488651)(since resolved).

If you're using Fedora 16-, use the texlive repo packaged by Jindrich Novy (mailing list):

# Support for older Fedora releases and RHEL also available, browse around the folder
rpm -i http://jnovy.fedorapeople.org/texlive/packages.f16/texlive-release.noarch.rpm
yum -y install 'texlive-*'

XeTex Chinese Support

The trick is figuring out which fonts on your system covers your target language:

fc-list :lang=zh ;  fc-list :lang=ja ; fc-list :lang=ko

will list Chinese, Japanese and Korean fonts respectively.

/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei Sharp,文泉驛點陣正黑,文泉驿点阵正黑:style=Regular
/usr/share/fonts/google-droid/DroidSansFallback.ttf: Droid Sans:style=Regular
/usr/share/fonts/cjkuni-uming/uming.ttc: AR PL UMing TW MBE:style=Light
...

For more fun with Fontconfig, try:

fc-match -v sans:lang=zh ; fc-list :spacing=100 # all mono fonts
Pattern has 31 elts (size 32)
	family: "DejaVu Sans"(s)
	familylang: "en"(s)
...

and fonts-conf(5).

Example

test.tex

% !TEX TS-program = xelatex
% !TEX encoding = UTF-8 Unicode

\documentclass{book}
\usepackage{hyperref}

\usepackage{fontspec}
\usepackage[BoldFont,SlantFont,CJKnumber,fallback]{xeCJK}
\setmainfont{Liberation Serif}
\setromanfont{Liberation Sans}
\setmonofont{Liberation Mono}

%% list Chinese fonts: "fc-list :lang=zh"
%\setCJKmainfont{WenQuanYi Zen Hei}
\setCJKmainfont{AR PL UMing TW}
\setCJKsansfont{AR PL UKai TW}
%\setCJKmainfont{PMingLiU}
\CJKsetecglue{\hspace{2mm}}

\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt

\begin{document}
測試。Your text goes here.\textbf{粗體}
\CJKfamily{\CJKsfdefault}改變字體
\end{document}

The `xeCJK` Latex package can be installed with:

$ yum install texlive-xeCJK

Generating a PDF:

$ xelatex test.tex
<...>
Output written on test.pdf (1 page).

See Also

Comments

blog comments powered by Disqus