1. 程式人生 > >TexShop編輯中文例子

TexShop編輯中文例子

研究tex如何編輯中文的問題,百度上沒有一篇文章適用的,貼出一個demo,複製貼上即可:

系統:macos

軟體:texshop

下載地址:https://www.macupdate.com/app/mac/31777/mactex

%!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} %設定中文字型
\XeTeXlinebreaklocale “zh”
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt %文章內中文自動換行

\newfontfamily{\H}{SimHei}
\newfontfamily{\E}{Arial}
\title{\H 演算法設計}
\author{Donald}
\date{\E\today}

\begin{document}
\maketitle
這個段落中,夾雜著一個{\E word}。
\end{document}