Easy to configure Tex UTF-8 Chinese environment under Ubuntu

Source: Internet
Author: User
Tags add time

There are several options and related methods for using the Tex Chinese environment under Ubuntu, some simpler (such as using XeTeX directly), and some are relatively troublesome (such as manually generating related fonts).

The most widely used is TEXLIVE+CJK, and if you want to try to make your Tex documents Windows/linux with each other, you typically choose this combination, and this is the most mature (relative to XeTeX).

The approach in this article today is to take advantage of the methods that have now been successful and combine them with Ubuntu's specific environment. Hope to give a reference to a friend who wants to configure the Tex Chinese environment under Ubuntu.

—–

To introduce the most popular method of configuring Tex under Linux in the first time, this article is generally referred to here:

Http://mailboxpublic.googlepages.com/texlive2007cjkchinesehowto

Download the ISO file around 1GB, mount the ISO and install the texlive, and then create the relevant font files. Generally can be successfully configured to tex+utf-8 the Chinese environment.

However, users who are accustomed to apt-get may not be willing to install the Tex Kit from the outside. So, I've made reference to some articles, and figured out a way to use the texlive in Ubuntu, and then manually generate the font packs, with the advantage of not having to download 1GB iso files, just download the files I prepared for the hundreds of KB font generation to use. Install the relevant Tex kit from the Ubuntu source only, and do not write other files to the system directory for easy deletion. You still need to manually generate the font files, but they are installed in your home directory.

Good. Please see the detailed method:

First, install TEXLIVE+LATEX+CJK:

Open the terminal, perform the following command to install texlive and some commonly used latex macro packages (can be modified according to your needs):

sudo apt-get install texlive Texlive-math-extra texlive-latex-base Texlive-latex-extra Texlive-pictures texlive-science Texlive-bibtex-extra Texlive-common Latex-beamer

If the hard drive is sufficient, a direct full installation can also:

sudo apt-get install texlive-full Latex-beamer

After installing, you can install the related software package of CJK, if only need to obtain Chinese support, then execute:

sudo apt-get install Latex-cjk-chinese ttf-arphic-* hbf-*

Otherwise, it is recommended that you install Latex-cjk-all for full support.

second, the generation of Chinese font pack

After you install TEXLIVE+CJK, you will also need to install a software ──fontforge for generating fonts:

sudo apt-get install FontForge

OK, the front is done, are standard Debian installation, if you do not need one day, direct remove installation can be.

Before you generate fonts, prepare your own font files that you need to generate: Simsun.ttc,simhei.ttf and so on, here take SIMSUN.TTC (Arial) as an example.

When you are ready, download the following package and extract it into a place such as your own home directory ~/font:

font.tar.bz2

Then copy the SIMSUN.TTC to the ~/font, and execute the following command to generate the font map:

CD ~/font
Time Fontforge-script subfonts.pe SIMSUN.TTC song UNICODE.SFD

Add time is to calculate times, because more time-consuming, under my Core 2 Duo T5500, the generation of song took 40 minutes, generating Hei spent 24 minutes, for reference only.

Font generation OK, then create a description file.

Under ~/font, create a Makemap file that reads as follows:

For I in *.TFM
Todo
Cat >> Song.map << EOF
${I%.TFM} ${I%.TFM} < ${I%.TFM}.PFB
Eof
Done

Then execute under the terminal: chmod +x makemap Let the file plus execute permission, and finally execute:

./makemap

Create one more C70SONG.FD file:

% is C70SONG.FD for CJK package.
% created by Edward G.J Lee
% Modify by Yue Wang
/PROVIDESFILE{C70SONG.FD}
/declarefontfamily{c70}{song}{/hyphenchar/font/m@ne}
/declarefontshape{c70}{song}{m}{n}{<-> CJK * song}{}
/declarefontshape{c70}{song}{bx}{n}{<-> cjkb * Song}{/cjkbold}
/endinput

All right, the related files have been generated, and the font has been copied to take effect.

Execute the following command to generate a hidden personal Tex configuration in your home directory, or delete it if you don't need it any day:

Mkdir-p ~/.TEXMF-VAR/FONTS/MAP/DVIPS/CJK
Mkdir-p ~/.texmf-var/fonts/tfm/cjk/song
Mkdir-p ~/.texmf-var/fonts/type1/cjk/song
Mkdir-p ~/.texmf-var/tex/latex/cjk/utf8

After you've built this layer of catalogs, copy the fonts you just generated.

CP ~/font/song.map ~/.TEXMF-VAR/FONTS/MAP/DVIPS/CJK
CP ~/FONT/*.TFM ~/.texmf-var/fonts/tfm/cjk/song
CP ~/FONT/*.PFB ~/.texmf-var/fonts/type1/cjk/song
CP ~/FONT/C70SONG.FD ~/.texmf-var/tex/latex/cjk/utf8

After the copy is done, execute the command to flush the cache and let it take effect:

sudo texhash
Updmap--enable Map Song.map

If all is in order, test if we can use the song body we installed.

Edit the file in any location and save it as Test.tex to support the UTF-8 format:

/documentclass{article}
/usepackage{cjkutf8}
/begin{document}
/begin{cjk}{utf8}{song}
How are you doing. This is the TEXLIVE+CJK environment under Ubuntu.
/END{CJK}
/end{document}

Perform separate build PDF documents and view documents with evince:

Pdflatex Test.tex
Evince test.pdf

Look at your process is not smooth, the resulting PDF file is also the case below.

Use the same method to handle common Chinese standard fonts such as Hei and Kai, and start enjoying your Tex bar.

References are:

the Tex UTF-8 Chinese system is configured on Fedora

texlive 2007 CJK Chinese Howto

Ubuntu 7.10 down latex + CJK

Reprint PLEASE note: Transfer from the Linux desktop Chinese network-easy to configure in Ubuntu, Tex UTF-8 Chinese environment

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.