Use Chinese in texshop (for Mac OS)

Source: Internet
Author: User

First, we recommend that you go to texshop-> preferences-> source, find the encoding drop-down menu bar, and select the encoding format as Unicode (UTF-8 ).

Although there will be special commands in the latex source code later to specify this encoding, the encoding format is set for compilation, and the encoding in "preference settings" seems to be the encoding format for saving. This is beneficial to the good versatility among platforms.

Two methods are available on the Web to display Chinese characters on texshop.

Method 1: xelatex.

(Original Author: Cheng Yan)

In texshop, xelatex is used as the typeset. Xelatex seems to be integrated in texshop. At least I did not install xelatex in my test.

Source code example:

%! Tex ts-program = xelatex %! Tex encoding = UTF-8 Unicode \ documentclass [12pt] {Article} \ usepackage {geometry} \ geometry {letterpaper} \ usepackage {fontspec, xltxtra, xunicode} \ defaultfontfeatures {mapping = Tex-text} \ setromanfont {simsun} % set the Chinese font \ xetexlinebreaklocale "ZH" \ Signature = 0pt plus 1pt minus 0.1pt % Chinese automatic line breaks \ newfontfamily {\ h} {simhei} \ newfontfamily {\ e} {Arial} % set the new font shortcut command \ title {\ H algorithm design} \ author {Donald} \ Date {\ e \ today} \ begi The section N {document} \ maketitle contains a {\ e word }. \ End {document}

One disadvantage of using xelatex is that if the Chinese font is different from the English font, You need to specify the font continuously in the English and Chinese paragraphs, to ensure that the same English font is used. The original author uses the following method to name a new font command:
\ Newfontfamily {\ e} {Arial}

To use this font later, you only need:

{\ E word}

Method 2: CJK macro package.

(This method is self-developed, but there are still some problems, so to be continue ...)

%! Tex encoding = UTF-8 Unicode \ documentclass {Article} \ usepackage {cjkutf8} \ begin {document} \ begin {CJK} {utf8} {BsmI} work diary \ newline unique idea \ end {CJK} \ end {document}

The output result is:

Some special words cannot be displayed, such as "NOTE" and "independent ". Paste it here first. If you can tell me which prawns are confused, I am very grateful for the bacteria!

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