Xetex perfect Chinese Configuration

Source: Internet
Author: User
Xetex perfect Chinese configuration-general Linux technology-Linux technology and application information, the following is a detailed description. After two months of exploration, I finally learned how to make latex perfectly support Chinese, that is, Xetex.

Configuration:
Install xetex... OK from the source.
Xetex will use the font of your system, that is, you do not need to compile the font yourself.

Use $ fc-list: lang = zh-cn to view your Chinese font.
Use $ fc-list to view all your fonts.
# Su
# Mkdir/usr/share/texmf/tex/xelatex/zhfontcfg

Create a "zhfontcfg. sty" file in the zhfontcfg folder as follows:

% Xetex/xelatex font set macro package

\ ProvidesPackage {zhfontcfg}
\ Usepackage {fontspec, xunicode}
\ Defaultfontfeatures {Mapping = tex-text} % if not, some special tex characters, such as hyphens, cannot be used normally.

% Chinese disconnection
\ XeTeXlinebreaklocale "zh"
\ XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt

% Ing System fonts into logical fonts for maintenance convenience
\ Newcommand \ fontnamehei {FZHeiTi}
\ Newcommand \ fontnamesong {Adobe Song Std}
\ Newcommand \ fontnamekai {FZKaiTi}
\ Newcommand \ fontnamemono {DejaVu Sans Mono}
\ Newcommand \ fontnameroman {Dustismo Roman}

% Set the document body font to
\ Setmainfont [BoldFont = \ fontnamehei] {\ fontnamesong}
\ Setsansfont [BoldFont = \ fontnamehei] {\ fontnamekai}
\ Setmonofont {\ fontnamemono}


% Entity body
\ Newfontinstance \ KAI {\ fontnamekai}
\ Newcommand {\ kai} [1] {{\ KAI #1 }}

%
\ Newfontinstance \ HEI {\ fontnamehei}
\ Newcommand {\ hei} [1] {\ HEI #1 }}

% English
\ Newfontinstance \ ENF {\ fontnameroman}
\ Newcommand {\ en} [1] {\,{\ ENF #1 }\,}
\ Newcommand {\ EN }{\, \ ENF \,}

Note: You can select the font you want. I use Adobe Song Std as the song body, so that the document can be even in adobe reader ink.

Run:
# Sudo mktexlsr

Everything is OK. Compiled with xelatex. Your documents will not contain any garbled characters, including bookmarks.

Example: test. tex

\ Documentclass {article}

\ Usepackage {zhfontcfg}
\ Usepackage [colorlinks, linkcolor = black] {hyperref}
% Opening
\ Title {simple example of latex multi-font}
\ Author {Yan Kai}

\ Begin {document}
\ Maketitle
\ Section {entity body}
\ Kai {}
\ Section {}
\ Hei {}
\ End {document}

Haha, you have done it.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.