以前最流行的一种方式是LaTeX+CJK来输入中文,现在因为有了XeTeX,有一种更简单的方式,那就是用XeLaTeX来编译,可以直接从UTF-8格式的tex文件中输入中文。下面是两个例子:
% sample1.tex
%!TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{indentfirst}
\usepackage{graphicx}
\setromanfont{SimSun}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\newcommand\Helvetica{\fontspec{Helvetica}}
\newcommand\Times{\fontspec{Times}}
\newcommand\Kai{\fontspec{Kai}}
\begin{document}
\title{{\Times \LaTeX} 测试}
\author{\Times Jie Chen}
\maketitle
\begin{center}
\Kai 摘要
\end{center}
{\small 这是一个摘要}
\section{第一节}
为什么?
\begin{figure}[ht]
\centering
\includegraphics[width=3cm]{1.eps}
\Times \caption{ interesting \Kai 图片 }
\end{figure}
\Times
I am very proud of this.
\begin{equation}
ax+by=3\sqrt{5}
\end{equation}
\end{document}
%!TEX encoding = UTF-8 Unicode
%test.tex
\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{graphicx}
%全文使用STHeiti
\setromanfont{STHeiti}
%定义一个会用到的英文字体
\newfontinstance{\enfont}{SimSun}
\newcommand{\en}[1]{{\enfont #1}}
%中文断行用的
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\title{编}
%使用某草体
%\author{\cao 报告书ai}
\author{报告书ai}
\begin{document}
\maketitle
\begin{abstract}
本
\end{abstract}
\section{课}
%使用那个英文字体
\en{
We are english
}
\end{document}
没有评论:
发表评论