- XeTeXのインストール
- fontspecのインストール
- TeXshop (GUI front end; if needed) のインストール
というわけで凡例。こちらのサイトから拝借したひな形を少しいじったものです。
% !TEX encoding = UTF-8 Unicode %%% XeLaTeX sample%%% \documentclass{book} %%%%%%%%%%%%%%%%%%%%% \usepackage{fontspec,xltxtra,xunicode} \setmainfont{AGaramondPro-Regular} \usepackage{setspace} \setstretch{1.2} \usepackage{indentfirst} \XeTeXlinebreaklocale "ja" \XeTeXlinebreakskip=0em plus 0.1em minus 0.01em \XeTeXlinebreakpenalty=0 \renewcommand{\baselinestretch}{1.4} \settowidth{\parindent}{あ} %%%%%%%%%%%%%%%%%%%%%% \begin{document} \chapter{Font availability with \XeLaTeX} \section{Examples} This page is mainly written with Adobe Garamond Pro. \subsection{Roman letters} \begin{itemize} \item $G(x) = A \times \exp{(-\frac{1}{2}\cdot \frac{{(x-x_{0})}^2}{\sigma_x^2})}$: Not applied to equations by default. \item $\it G(x) = A \times \exp{(-\frac{\rm1}{\rm2}\cdot \frac{{(x-x_{\rm0})}^2}{\sigma_x^2})}$: Can be written with Garamond by some tricks. \item $\rm{ABCDEFG}$: In equations, letters escaped by $\backslash$rm or $\backslash$it are written with Garamond. \item ABCDEFG: In plain text, regular style. \item \textbf{ABCDEFG}: In plain text, bold style. \item \textit{ABCDEFG}: In plain text, italic style. \end{itemize} \subsection{Japanese/Chinese letters} \fontspec{Hiragino Mincho Pro W3} ヒラギノ明朝 Pro W3 は、こんな感じ。 \fontspec{Hiragino Kaku Gothic Pro W3} ヒラギノ角ゴシック Pro W3 は、こんな感じ。 \end{document}
コンパイル結果はこんな感じになりました。デフォルトでは数式にフォントの変更が適用されないみたいですねぇ。今回はちょっとズルをしましたが、正攻法でもどうにかできるはずだよなぁ。まぁこれはおいおい。
追記。
上記のサンプルだとendash (--)やemdash (---)などのコマンドがつうじない。
参考↓
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}を追記するとこれらもうまく動くようになる。
参考↓
http://www.latex-community.org/forum/viewtopic.php?f=40&t=1398
さわだ