1. 程式人生 > >Mac 系統中文輸入-xelatex模版

Mac 系統中文輸入-xelatex模版

開啟Launchpad,在終端位置搜尋“字型冊”,然後定義系統有的字型,如 \newfontfamily{\FS}{STFangsong}

下面是已經用XelaTeX寫好的模版,定義了不同的中文字型:

 

% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.

% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt]{article}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}

% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}


\newfontfamily{\A}{Geeza Pro}
 \newfontfamily{\H}[Scale=0.9]{Lucida Grande}
 \newfontfamily{\J}[Scale=0.85]{Osaka}
 \newfontfamily{\FS}{STFangsong}
 \newfontfamily{\S}{STSong}
 \newfontfamily{\K}{STKaiti}
 \newfontfamily{\XK}{STXingkai-SC-Light}
 \newfontfamily{\WB}{Weibei-SC-Bold}
 


\title{\WB  中文字型-魏碑}
\author{\XK 作者-行楷}
%\date{}                                           % Activate to display a given date or no date

\begin{document}
\maketitle

% For many users, the previous commands will be enough.
% If you want to directly input Unicode, add an Input Menu or Keyboard to the menu bar 
% using the International Panel in System Preferences.
% Unicode must be typeset using a font containing the appropriate characters.
% Remove the comment signs below for examples.


 Here are some multilingual Unicode fonts: 
 \\this is Chinese text:{\FS 仿宋},{\S 宋體 },{\K 楷體},
 \\this is Arabic text: {\A السلام عليكم},
 \\this is Hebrew: {\H שלום}, 
\\ here's some Japanese: {\J 今日は}.


\end{document}  

 

輸出: