%%%%%%%%%%%%%%%%%%
\usepackage[cm-default]{fontspec}
\usepackage[slantfont, boldfont]{xeCJK}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{zhspacing}
\zhspacing
%\setmainfont{Times New Roman}
\setCJKmainfont{SimSun}
\setCJKfamilyfont{song}{SimSun}
\setsansfont{AR PL UKai CN}
\setmainfont[BoldFont=SimHei,ItalicFont=楷体_GB2312]{SimSun}
%\setmainfont[Mapping=tex-text]{文泉驿等宽微米黑} %这里是字体名
%中文断行
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
% 页边距设置
\usepackage[top=1.2in,bottom=1.2in,left=1.2in,right=1in]{geometry}
% 页眉页脚设置
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % 清空页眉页脚
\fancyhead[LE,RO]{\thepage} % 偶数页左,奇数页右
\fancyhead[RE]{\leftmark} % 偶数页右
\fancyhead[LO]{\rightmark} % 奇数页左
\fancypagestyle{plain}{
\fancyhf{} % 重定义plain页面样式
\renewcommand{\headrulewidth}{0pt}
}
\renewcommand\chaptermark[1]{\markboth{\chaptername~ #1}{}}
\renewcommand\sectionmark[1]{\markright{\thesection~ #1}}
\renewcommand{\baselinestretch}{1.25} % 正文行距
% 章节格式设置
\usepackage{titlesec}
\titleformat{\chapter}{\centering\huge}{第\thechapter{}章}{1em}{\textbf}
\titleformat{\part}{\centering\huge}{第\thepart{}部分}{1em}{\textbf}
\renewcommand{\contentsname}{目~录}
\renewcommand{\indexname}{索引}
\renewcommand{\listfigurename}{插图目录}
\renewcommand{\listtablename}{表格目录}
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand{\appendixname}{附录}
%\renewcommand{\appendixpagename}{附录}
%\renewcommand{\appendixtocname}{附录}
%\renewcommand\refname{参考文献}
\usepackage{listings}
\usepackage{color}
\definecolor{hellgelb}{rgb}{1,1,0.85}
\definecolor{colKeys}{rgb}{0,0,1}
\definecolor{colIdentifier}{rgb}{0,0,0}
\definecolor{colComments}{rgb}{1,0,0}
\definecolor{colString}{rgb}{0,0.5,0}
\lstset{%
language=Matlab,%
float=hbp,%
basicstyle=\footnotesize\ttfamily,%
identifierstyle=\color{colIdentifier},%
keywordstyle=\color{colKeys},%
stringstyle=\color{colString},%
commentstyle=\itshape\color{colComments},%
columns=fixed,
tabsize=4,%
frame=single,%
framerule=1pt,
extendedchars=false,%这一条命令可以解决代码跨页时,章节标题,页眉等汉字不显示的问题
showspaces=false,%
showstringspaces=false,%
numbers=left,%
numberstyle=\tiny\ttfamily,%
numbersep=1em,%
breaklines=true,%
breakindent=10pt,%
backgroundcolor=\color{hellgelb},%
breakautoindent=true,%
captionpos=t,%
xleftmargin=1em,%
xrightmargin=\fboxsep,
escapechar=`
}
%%%%%%%%%%%%%%%%%%%%%%%