1. unmount the old texlive2009 from Ubuntu
Try the following commands, one after another. If you progress, respective folders may already be deleted:
sudo apt-get purge texlive* rm -rf /usr/local/texlive/2009 and rm -rf ~/.texlive2009 rm -rf /usr/local/share/texmf rm -rf /var/lib/texmf rm -rf /etc/texmf sudo apt-get remove tex-common --purge rm -rf ~/.texlive
2. Install texlive 2013
This installation is relatively simple. I use ubuntu12.04.4. The specific steps are to mount the ISO file you downloaded.
sudo mkdir /media/texlive sudo mount texlive2013-20130530.iso /media/texlive
Then go to the/Media/texlive directory and execute:
./install-tl
Enter I when prompted (uppercase I, you will see the prompt)
After the installation is complete, you can add the following code to the last line of the/etc/profile file. Note that my system is 64-bit, check whether your system has the latex command in this directory.
export PATH=/usr/local/texlive/2013/bin/x86_64-linux:$PATH
If you want to use help, you can also ~ /. Add the following two lines to bashrc:
export MANPATH=/usr/local/texlive/2013/texmf-dist/doc/man:$MANPATH export INFOPATH=/usr/local/texlive/2013/texmf-dist/doc/info:$INFOPATH
Here, I usually restart it.
Test whether the above configuration is correct:
which latex
If you find latex, you can continue. If you cannot find latex, you need to check whether you have not configured the environment path.
3. Set Chinese Fonts
(1) Test the Chinese font
First, write a simple test Tex file. The name is test. Tex.
\ Documentclass [utf8] {ctexart} \ begin {document} I love China! \ End {document}
Then execute the following command to compile:
xelatex test.tex
Wait for a while and you will encounter an error, which is roughly as follows:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! fontspec error: "font-not-found"! ! The font "SimSun" cannot be found.! ! See the fontspec documentation for further information.! ! For immediate help type H <return>.!...............................................
We need to solve this problem below.
(2) The error "font-not-found "! Therefore, you must first install the simsun font.
Run the following command:
cd /etc/fonts/conf.d sudo ln -s /usr/local/texlive/2013/texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts 09-texlive.conf
The preceding command allows the system to use the texlive font.
Do the following to use a Custom font.
Mkdir ~ /. Fonts # create a directory if the directory does not exist. Cp *. TTF ~ /. Fonts # copy the font to. Fonts
Run the following command to modify the font permission and update the font cache:
sudo chmod 644 *.ttf sudo mkfontscale sudo mkfontdir sudo fc-cache -fsv
After successful execution, perform the following operations:
cd /usr/local/texlive/2013/texmf-dist/tex/latex/ctex/fontset/ sudo vim ctex-xecjk-winfonts.def
The file defines xecjk
Font settings,The content is roughly as follows:
% Ctex-xecjk-winfonts.def: xecjk font settings for Windows, default: Six Easy fonts % VIM: Ft = Tex \ setcjkmainfont [boldfont = {simhei}, italicfont = {[simkai. TTF]}] {simsun} \ setcjksansfont {simhei} \ setcjkmonofont {[simfang. TTF]} \ setcjkfamilyfont {zhsong} {simsun} \ setcjkfamilyfont {zhhei} {simhei} \ setcjkfamilyfont {zhkai} {[simkai. TTF]} \ setcjkfamilyfont {zhfs} {[simfang. TTF] }%\ setcjkfamilyfont {zhli} {Lisu }%\ setcjkfamilyfont {zhyou} {youyuan} \ newcommand * {\ songti} {\ cjkfamily {zhsong} % \ newcommand * {\ heiti} {\ cjkfamily {zhhei} % \ newcommand * {\ kaishu} {\ cjkfamily {zhkai} % \ newcommand * {\ fangsong} {\ cjkfamily {zhfs }}% % \ newcommand * {\ Lishu} {\ cjkfamily {zhli }}% % \ newcommand * {\ youyuan} {\ cjkfamily {zhyou} % youyuan \ endinput
The error occurs because the specified font does not exist or cannot be found. Therefore, modify the font name based on the existing font name.
Open a new terminal and run the following command:
fc-list :lang=zh-cn
The output is roughly as follows:
Ar PL uming TW: Style = lightar PL uming HK: Style = light wenquanyi width micron black, wenquanyi micron black, wenquanyi micro Hei Mono: Style = regular Imitation Song, fangsong: style = normal, Oby? EJN é, standard, α v ο ν ι κ ?, Regular, normaali, normál, Normale, Standaard, normalny, Zookeeper, normálne, navadno, arrunta, dfkai \-SB: style = regularar PL uming CN: Style = light, nsimsun: Style = regular, regular, kaiti: Style = normal, Oby? EJN é, standard, α v ο ν ι κ ?, Regular, normaali, normál, Normale, Standaard, normalny, Zookeeper zookeeper, normálne, navadno, arrunta, Microsoft yahei: Style = normal, oby? EJN é, standard, α v ο ν ι κ ?, Regular, normaali, normál, Normale, Standaard, normalny, Zookeeper zookeeper, normálne, navadno, arruntaadobe STD, Adobe kaiti STD, adobe kaiti std r, Adobe std r: Style = r, regularmicrosoft yahei UI, Microsoft yahei UI light: Style = light, regular
The following is to change the font simfang. ttf in the ctex-xecjk-winfonts.def to fangsong and simkai. TTF to kaiti.
If you use vim, You can execute the following command in VIM:
:%s/\[SIMFANG.TTF\]/FangSong/g:%s/\[SIMKAI.TTF\]/KaiTi/g
(3) solve the test problem and run the following command again:
xelatex test.tex
Now there should be no problem.
(4) Although the above method solves some problems, it still cannot use fonts such as. The following is a solution.
The test document is:
\ Documentclass {ctexart} \ setcjkfamilyfont {Microsoft yahei} {} \ newcommand {\ yah} {\ cjkfamily {Microsoft yahei} \ begin {document} Note: UTF-8 code, use xelatex for compilation. {\ yah here is }. \ The effect is acceptable. \ End {document}
The result is as follows:
Success.