Chinese configuration scheme of Ubuntu14.04+texlive2014+lyx-linux under LYX

Source: Internet
Author: User

LyX is a WYSIWYG document typesetting software, lyx the use of Ubuntu system needs to solve the problem of Chinese font support. The Texlive installation package provides the perfect solution for Chinese language support in Ubuntu systems. After two days of debugging finally solved the LyX Chinese document compilation problem. Now the installation process and the problems encountered in the intermediary below, I hope to be able to meet the same problem to help people.

1, first need to install Texlive installation package. The latest version is texlive2015, but I encountered some problems when installing texlive2015 (I do not know the problem of the installation package itself or the installation process), and later tried texlive2014, found to be able to use the normal, so this article in the adoption of the 2014 version. The downloaded installation package file is named Texlive2014-20140525.iso.

(a) Install texlive by executing the following command. (Before installation, you need to confirm the removal of the previously installed version , I was previously installed through the command line texlive, causing problems during the installation process)

sudo mkdir  /media/cdimagessudo mount-o loop  Texlive2014-20140525.iso/media/cdimagescd/media/cdimagessudo. /install-tl
Intermediate process will appear prompt input, direct input I for installation, the whole installation process will take about 10 minutes to change. The installation path defaults to the/usr/local/texlive path.

(b) Setting environment variables, this article uses the way to set the current user environment variables. Use the Gedit editor to modify the. bashrc file.

sudo gedit ~/.BASHRC

Add a file at the end of the file after opening it

Export Path=/usr/local/texlive/2014/bin/x86_64-linux: $PATHexport manpath=/usr/local/texlive/2014/texmf-dist/doc/ Man: $MANPATHexport infopath=/usr/local/texlive/2014/texmf-dist/doc/info: $INFOPATH
After you save the document, execute the following command to update the environment variables
           SOURCE ~/.BASHRC
after the environment variable is updated, enter it on the command line
you can see the following version information


(c) Testing of the installed texlive.

First test the compilation of English documents, establish TEST-EN.TEX documents, the contents of the document are as follows

\documentclass{article}\begin{document}hello \latex!\end{document}

Execute the following command :

      Xelatex Test-en.tex
Can get test-en.pdf, the content is as follows, then the installation is normal.

Test the compilation of Chinese documents, establish Test-ch.tex, the contents of the document are as follows

\documentclass[utf8]{ctexart}\begin{document} I love China! \end{document}  

Execute command: 

Xelatex Test-ch.tex

At the end of the run, the following compilation error will appear

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!          !          ! Fontspec error: "Font-not-found"     !     ! The font "SimSun" cannot be found.     !!    See the FONTSPEC documentation for further information.     !!    For immediate help type H <return>.           
This is due to the lack of windows and Adobe fonts in the font caused by the fonts, the commonly used Chinese window font is: Bold, italic, Arial, imitation, Young circle, official script, and adobe commonly used there are four kinds: bold, italic, imitation, young circle, script. The following describes how to install the fonts for both environments.


2. Install Windows and Adobe Fonts. The window font can be found from the c://windows//fonts//path, and Adobe fonts can be downloaded from Wang Xiaoai. Place these fonts in the winfonts and adobefonts folders, respectively.


(a) To install Windows Fonts as an example, copy the Winfonts folder to/usr/share/fonts

sudo cp-rf  

The output is as follows:  

You can see the fonts under the Winfonts folder (in the four common examples), which are as follows:

Fangsong, imitation: Style=regular,... Kaiti, italics: Style=regular,... SimSun, Song body: Style=regular ... Simhei, blackbody: Style=regular ...  
  Modify the Texlive configuration file as follows:
sudo gedit/usr/local/texlive/2014/texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def

Open the file with the following contents:

% ctex-xecjk- Winfonts.def:Windows xecjk font settings, default to six medium easy font% Vim:ft=tex \setcjkmainfont[boldfont={simhei},italicfon T={[simkai. TTF]}] {SimSun} \setcjksansfont{simhei} \setcjkmonofont{[simfang. TTF]} \setcjkfamilyfont{zhsong}{simsun} \setcjkfamilyfont{zhhei}{simhei} \setcjkfamilyfont{zhka I}{[simkai. TTF]} \setcjkfamilyfont{zhfs}{[simfang. TTF]}% \setcjkfamilyfont{zhli}{lisu}% \setcjkfamilyfont{zhyou}{youyuan} \newcommand*{\songti} {\cjkfamily{zhsong}}% Arial \newcommand*{\heiti}{\cjkfamily{zhhei}}% Black body \newcommand*{\kaishu}{\cjkfamily{zh        Kai}}% regular script \newcommand*{\fangsong}{\cjkfamily{zhfs}}% imitation% \newcommand*{\lishu}{\cjkfamily{zhli}% script % \newcommand*{\youyuan}{\cjkfamily{zhyou}}% young round \endinput 

Change the name of the font (Red mark part) in the above Ctex-xecjk-winfonts.def to the name of the input font (note that the brackets are replaced

[Simfang. TFF], Fangsong [Simkai. TFF]-Kaiti

After saving the file, execute the

           Xelatex Test-ch.tex

Can output normal results


(b) The installation of Adobe fonts is the same as the Windows font process (requires modification of the/usr/local/texlive/2014/texmf-dist/tex/latex/ctex/fontset/ Ctex-xecjk-adobefonts.def file. (LyX ctex.lyx templates use Adobe fonts and font errors occur if the Aode fonts are not installed in the department)


(c) Some of the English fonts that need to be used securely in Windows, such as Arial, New times Roman, found that the installation process using the aforementioned (a) and (b) did not solve the problem, and that access to some information was only Discover Ununtu can install these fonts directly from the software Application Center.

Open the App Center


Enter the following keywords


The output results are as follows:

after installation can solve the winThe English font problem under dows.

3. Also install LyX software from the software Application Center.

Execute file, new file from template select Ctex.lyx to compile the Chinese document correctly.


4. References

Add Microsoft Core Fonts to Ubuntu.

Install texlive under Ubuntu and set up Ctex Chinese set.

Chinese configuration scheme of Ubuntu14.04+texlive2014+lyx-linux under LYX

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: 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.