Linux texlive 2015 Chinese issues

Source: Internet
Author: User
Tags name database

It is said that it is possible to implement the Texlive in Linux under the English mixed row:

1. This method is from http://seisman.info/mini-template-for-xeCJK.html

XECJK + Xelatex, which is probably the best Chinese solution so far.

\DOCUMENTCLASS{ARTICLE}\USEPACKAGE{XECJK}

XECJK will default to the Fandole font that comes with texlive. To be able to compile the pass, you need to install Texlive's own Chinese fonts into the system, the simplest way is to build a soft link in the ~/.fonts directory:

Ln -s/opt/texlive//texmf-dist/fonts/opentype/public/fandol ~/.fonts/

You can then compile the Foo.tex using the Xelatex command.

2. This method is from http://www.cnblogs.com/lienhua34/p/3675027.html. Compared to Method 1, this is probably the older texlive implementation of the Chinese-English mixture of the way (?). )。

In a document Foo.tex:

\documentclass{ctexart}\begin{document} Hello, \latex! \end{document}

If you compile directly, an error occurs:

 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Fontspec Error:  "!! The font  " simsun   "  cannot be found. !! See the Fontspec documentation for   further Information. !! For immediate help type H <return> ! ...............................................L.  5  {simsun} ?  

This is because the CTEX macro package defaults to the Windows system font, and there is no font or font name for the Windows system under Linux, and the fonts are not SimSun, so it is reported that the Arial (Sim Sun) error.

The Ctex macro package provides three font options: Nofonts, Adobefonts, and winfonts, which are winfonts by default.

If you do not use other options to modify font configuration in the Tex source file, you will need to have four TrueType fonts installed in the operating system with the Chinese Windows operating system: Arial (SimSun), Bold (Simhei), Fangsong (Simfang), Italic (Simkai). If you use the adobefonts option, you will need to have Adobe's four OpenType fonts installed in the operating system: Adobe Arial, Adobe blackbody, Adobe imitation, Adobe Italic.

eg as follows:

Idea one: Let Ctex use the nofonts option, and then set the system's own Chinese font to the default font in Chinese using CJK Chinese scheme.

Step one: View the Chinese fonts in the Ubuntu system with the command Fc-list:lang-zh

    $ Fc-list:lang-zh |SortAR PL UKai cn:style=Book AR PL UKai hk:style=Book AR PL UKai TW mbe:style=Book AR PL UKai tw:style=Book AR PL uming cn:style=Light AR PL uming hk:style=Light AR PL uming TW mbe:style=Light AR PL uming tw:style=Light ... Wenquanyi Zen Hei, such as wide Micron Black, Wen Quan Shu Cityinn and other broad micron Black, Wenquanyi Micro Hei mono:style=Regular Wenquanyi Zen hei, such as wide positive black, Wen Quan Shu Cityinn, such as the width of black, Wenquanyi Zen Hei mono:style=Regular Wen Quan Shu, wen Quan shu cityinn dot matrix is black, Wenquanyi Zen Hei sharp:style=Regular Wen Quan shu-micron Black, Wen Quan shu cityinn micron Black, Wenquanyi Micro hei:style=Regular Wenquanyi Zen Hei is black, Wen Quan shu Cityinn is black, Wenquanyi Zen hei:style=regular

Step Two: Use the following font settings at the beginning of the document:

  

\documentclass[nofonts]{ctexart} \setcjkmainfont[italicfont  ={ar Pl UKai cn}]{ar PL uming CN}%%< c5>% set Wenquanyi Zen hei equal width positive black font as Chinese typewriter font \begin{document} Hello, \latex! \end{document} 

You can then compile with Xelatex.

We can use texlive to deal with Chinese characters through commands such as Setcjkmainfont, but it is really annoying to write such a command in each document.

So there is the idea of two.

Idea two: By writing this command of the font set above to the custom macro package file Mylinuxfonts.sty, then use this custom macro package in the document with the command \usepackage{mylinuxfonts}.

To create a new mylinuxfonts.sty, refer to the following:

  

\providespackage{mylinuxfonts} \setcjkmainfont[italicfont  ={ar Pl UKai cn}]{ar pl uming CN}% % set Chinese typewriter (equal width) font for Wen Quan yi Zheng Black \endinput  

Then use the following in the document:

  

\documentclass[nofonts]{ctexart}\usepackage{mylinuxfonts}\begin{document} Hello, \latex! \end{document}

Texlive provides a variable texmfhome (the default is ~/TEXMF), which gives the user a separate installation of the macro package, font, and so on. The macro package file needs to be placed in the directory Texmfhome/tex/latex or its subdirectories. We put the mylinuxfonts.sty in the directory ~/texmf/tex/latex, and then compile the Foo.tex file. Texlive also provides a variable texmflocal (default =/usr/local/texlive/texmf-local), which is used by the system administrator to install additional macro packages or fonts for use by the entire system. The macro package file needs to be placed in the directory Texmflocal/tex/latex or its subdirectories. We put the mylinuxfonts.sty file in this directory:

sudo    CP mylinuxfonts.sty/usr/local/texlive/texmf-local/tex/latex/local

The Texmflocal directory requires a file name database that is kept updated, or the new file cannot be found. We update it by command MKTEXLSR.

Optimized configuration provided by the original author:

Now our texlive has supported Chinese, but we can also optimize our Ctex configuration.

As mentioned above, the Ctex default is to use the Font configuration option is winfonts, then each of us to use CTEX macro package in the Tex document to set the Nofonts option.

The Ctex macro package provides a configuration file ctexopts.cfg that the code in the file executes at the beginning of the Ctex package (after the option definition). We can use this file to set the default options for the Ctex macro package.

lienhua34:text$ cd/usr/local/texlive/2015/texmf-dist/tex/latex/ctex/cfg
lienhua34:cfg$ sudo cp ctexopts.cfg.template ctexopts.cfglienhua34:cfg$ sudo vi ctexopts.cfg

then enter the content

% Ctexopts.cfg:set Default Options\executeoptions{nofonts}\endinput

Save and then run the MKTEXLSR command. OK, the default font options for the Ctex macro package are changed to nofonts.

Linux texlive 2015 Chinese issues

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.