2007年7月28日星期六

[转]XeTeX code sample

%# -*- coding: utf-8 -*-
\documentclass{book}
\usepackage{fontspec,xunicode,ifthen,indentfirst}
\usepackage[colorlinks,bookmarksopen,pdfstartview=FitH]{hyperref}
\usepackage{fancyhdr}
\usepackage{titlesec, titletoc}
\usepackage{moresize}
 
\begin{document}
\setmainfont[Ligatures={Common, Rare}, Mapping=tex-text, BoldFont=Adobe Heiti Std]{Adobe Song Std}
%% Adobe Reader 8.0 的中文包里包含了这两个中文字体
 
%\def ~{\hspace {0.25em plus 0.125em minus 0.08em}\ignorespaces}
\def\CJKnumber #1{ \ifcase #1 \or\or \or\or\or\or\or\or\or \fi}
 
\newcommand{\prechaptername}{}
\newcommand{\postchaptername}{ }
\newcommand{\chapterformat}{\prechaptername\CJKnumber {\thechapter}\postchaptername}
\renewcommand {\contentsname}{\quad }
 
\titleformat{\chapter}[display]
{ \normalfont\huge\bfseries}{\chapterformat}{20pt}{\Huge}
\titlecontents{chapter}[0em]{\addvspace{1.5ex}\bfseries}
    {\prechaptername\CJKnumber{\thecontentslabel}\postchaptername\quad }{\hspace*{-2.3em}}
    {\hfill{} \contentspage}[\addvspace{0.5ex}]
   
\fancyhead {}
\fancyhead[RO,LE]{\bfseries\chapterformat}
\fancyhead [LO,RE]{\bfseries\thetitle}
\fancyfoot[C]{\thepage }
%      E       偶数页
%      O       奇数页
%      L       页眉或页脚的左边部分
%      C       页眉或页脚的中间部分
%      R       页眉或页脚的右边部分
%      H       页眉
%      F       页脚
 
\newcommand\thetitle{Of Blood And Honor}
\newcommand\theauthor{Chris Metzen}
 
\setlength{\parindent }{2em}
 
%%** End of globle configuration **%%
 
\pagestyle{empty}
%The valid options are:
%    * plain - Just a plain page number.
%    * empty - Produces empty heads and feet - no page numbers.
%    * headings - Puts running headings on each page. The document style specifies what goes in the headings.
%    * myheadings - You specify what is to go in the heading with the \markboth or the \markright commands.
 
\begin{titlepage}
\fontspec[Ligatures={Common, Rare}, Mapping=tex-text]{Zapfino} %% Mac OSX Font: Zapfino.dfont
\centering
\HUGE\thetitle\\
\large\theauthor
\end{titlepage}
 
\frontmatter
\pagestyle{headings}\tableofcontents
 
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
 
\mainmatter\pagestyle{fancy}
 
\input{ch1}
 
\end{document}


Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1488931



--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

没有评论: