% !Mode:: "TeX:UTF-8:Hard"
\documentclass[a4paper]{article}
\usepackage[a4paper,hmargin=1.25in,vmargin=1in]{geometry} % 用Microsoft Office 中Word 的默認頁邊距
% ===========================數學符號===============================================
\usepackage{amsmath,amssymb}
\usepackage{bm} % $\bm{letter}$ 數學式中粗斜體字母的最佳方案
\usepackage{calc}
\usepackage{units} %單位宏包
% ===========================XeLatex相關宏包與選項========================================
\usepackage[driverfallback=dvipdfm,colorlinks=true,linkcolor=black]{hyperref} % 選項防與amssymb衝突,防目錄、註釋紅框。
\usepackage{xltxtra}
% 提供了針對XeTeX的改進而且加入了XeTeX的LOGO,自動調用xunicode宏包(提供Unicode字符宏)
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
% 中文斷行
% ===========================中文字體==========================================
\usepackage[hyperref,nopunct]{ctex}
%\usepackage{fontspec}
%將系統字體名映射爲邏輯字體名稱,主要是爲了維護的方便
\newcommand\fontnamewenquanyi{WenQuanYi Micro Hei Mono}
\newcommand\fontnamefangsong{FangSong}
\newcommand\fontnameyahei{Microsoft YaHei}
\newcommand\fontnamehei{SimHei}
\newcommand\fontnamesong{SimSun}
\newcommand\fontnamekai{楷體}
%English Fonts
\newcommand\fontnamemono{DejaVu Sans Mono}
\newcommand\fontnameroman{Times New Roman}
\newcommand\fontnamelucida{Lucida Console}
\newcommand\fontnamecourier{Courier New}
\newcommand\fontnamemeiryo{Meiryo UI}
%%設置經常使用中文字號,方便調用
\newcommand{\erhao}{\fontsize{22pt}{\baselineskip}\selectfont}
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{16pt}{\baselineskip}\selectfont}
\newcommand{\xiaosanhao}{\fontsize{15pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.5pt}{\baselineskip}\selectfont}
%設置文檔正文字體爲宋體
\setCJKmainfont[BoldFont=\fontnamehei]{\fontnamesong}
\setCJKsansfont[BoldFont=\fontnamehei]{\fontnamekai}
\setCJKmonofont{\fontnamemono}
\setmainfont{\fontnameroman}
%楷體
\newfontinstance\KAI {\fontnamekai}
\newcommand{\kai}[1]{{\KAI#1}}
%黑體
\newfontinstance\HEI{\fontnamehei}
\newcommand{\hei}[1]{{\HEI#1}}
%雅黑
\newfontinstance\YAHEI{\fontnameyahei}
\newcommand{\yahei}[1]{{\YAHEI#1}}
%
%宋體
\newfontinstance\SONG{\fontnamesong}
\newcommand{\song}[1]{{\SONG#1}}
%隸書
\newfontfamily\lishu{LiSu}
%英文
\newfontinstance\ROMAN{\fontnameroman}
\newcommand{\newroman}[1]{\,{\ROMAN#1}\,}
%Lucida Console
\newfontinstance\LUCIDA{\fontnamelucida}
\newcommand{\lucida}[1]{\,{\LUCIDA#1}\,}
%Courier New
\newfontinstance\COURIER{\fontnamecourier}
\newcommand{\courier}[1]{\,{\COURIER#1}\,}
%Consolas
\newfontfamily\consol{Consolas}
%Minion Pro
\newfontfamily\minion{Minion Pro}
%===========================段落設置================================================
\usepackage{setspace}
\setlength{\parindent}{2em}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
% ==========================圖形表格=================================================
\usepackage{caption}
\captionsetup{font={scriptsize}}
\usepackage{booktabs}
\usepackage{array}
\usepackage{longtable}
\usepackage{tabularx} % 上這個網站 http://truben.no/latex/table/ 粗製一份表格
\usepackage{rotating} % 圖片旋轉
\usepackage{graphicx} % 插圖必用宏包
\usepackage{wrapfig}
\usepackage{tikz}
%==========================引用格式宏包=============================
\usepackage{harvard} % havard bibliography style宏包
\citationstyle{dcu} % harvard引用格式,即(author 1, year 1; author 2, year 2)格式
% ========================默認組成名修改爲對應中文命令========================
\renewcommand{\figurename}{圖} % 將圖的名字改爲圖1:…… 圖2:……等
\renewcommand{\tablename}{表} % 將默認的talbe 1,table 2改爲表一、表2等
\usepackage{titletoc}
\renewcommand{\contentsname}{\centering{\Huge 目\quad 錄}}
%\usepackage[center]{titlesec}
%\titleformat{\chapter}{\centering\huge\hei}{第\,\thechapter\,章}{1em}{}
% ===========Opening===============
\begin{document}
\tableofcontents % 目錄
\clearpage
\section{裝傻}
很傻
\subsection{犯二}
很二
\end{document}