Allow Pandoc to output PDF when supporting Chinese

Source: Internet
Author: User

The host environment is: Ubuntu 12.04 LTS. For the RH series, the name of the Yum package may be different, but the Yum Lenovo capability is stronger and should not be a problem.

Install Pandoc, install Tex-live
sudo apt-get install Pandoc texlive
Installation EnglishFont

You can use the "fc-list" command to view installed fonts. Use the following command to install the Gnome Chinese font.

Apt-get Install Apt-get Install language-pack-gnome-zh*

If you have TTF files, such as Windows font files under (windows\fonts), double-click to install.

Customizing Latex templates

Use the following command to export the Pandoc standard Template:

Pandoc-d Latex > Template.tex

Find "% if LuaTeX or XeTeX" in the template and insert the following code below the statement:

% support for Chinese
\USEPACKAGE[BOLDFONT,SLANTFONT,CJKSETSPACES,CJKCHECKSINGLE]{XECJK}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{mapping=tex-text,scale=matchlowercase}

\punctstyle{quanjiao}
\setcjkmainfont{Wen Quan Shu-micron Black}

where "\setcjkmainfont" set the font part, according to the system installed font self-modification.

Configuring Pandoc Command Parameters

Add the following code under. BASHRC

Alias pandoc= "Pandoc--template= $HOME/templates/template.tex--latex-engine=xelatex"

Where the template parameter represents the custom template path used by Pandoc, I put it under ~/templates.

Allow Pandoc to output PDF when supporting Chinese

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.