template.tex 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. \documentclass[a4paper, 11pt]{article}
  2. \usepackage{geometry} % 設定邊界
  3. \geometry{
  4. top=1in,
  5. inner=1in,
  6. outer=1in,
  7. bottom=1in,
  8. headheight=3ex,
  9. headsep=2ex
  10. }
  11. \usepackage{tabu}
  12. \usepackage[T1]{fontenc}
  13. \usepackage{lmodern}
  14. \usepackage{booktabs}
  15. \usepackage{amssymb,amsmath}
  16. \usepackage{ifxetex,ifluatex}
  17. \usepackage{fixltx2e} % provides \textsubscript
  18. % use upquote if available, for straight quotes in verbatim environments
  19. \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
  20. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  21. \usepackage[utf8]{inputenc}
  22. $if(euro)$
  23. \usepackage{eurosym}
  24. $endif$
  25. \else % if luatex or xelatex
  26. \usepackage{fontspec} % 允許設定字體
  27. \usepackage{xeCJK} % 分開設置中英文字型
  28. \setCJKmainfont{STSong} % 設定中文字型
  29. \setmainfont[Mapping=tex-text]{Times New Roman}%\rmfamily 使用的字体,默认英文和数字的字体。 % 設定英文字型
  30. \setromanfont{Georgia} % 字型
  31. \setmonofont{Courier New}
  32. \linespread{1.2}\selectfont % 行距
  33. \XeTeXlinebreaklocale "zh" % 針對中文自動換行
  34. \XeTeXlinebreakskip = 0pt plus 1pt % 字與字之間加入0pt至1pt的間距,確保左右對整齊
  35. \parindent 0em % 段落縮進
  36. \setlength{\parskip}{20pt} % 段落之間的距離
  37. \ifxetex
  38. \usepackage{xltxtra,xunicode}
  39. \fi
  40. \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  41. \newcommand{\euro}{€}
  42. $if(mainfont)$
  43. \setmainfont{$mainfont$}
  44. $endif$
  45. $if(sansfont)$
  46. \setsansfont{$sansfont$}
  47. $endif$
  48. $if(monofont)$
  49. \setmonofont{$monofont$}
  50. $endif$
  51. $if(mathfont)$
  52. \setmathfont{$mathfont$}
  53. $endif$
  54. \fi
  55. % use microtype if available
  56. \IfFileExists{microtype.sty}{\usepackage{microtype}}{}
  57. $if(geometry)$
  58. \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
  59. $endif$
  60. $if(natbib)$
  61. \usepackage{natbib}
  62. \bibliographystyle{plainnat}
  63. $endif$
  64. $if(biblatex)$
  65. \usepackage{biblatex}
  66. $if(biblio-files)$
  67. \bibliography{$biblio-files$}
  68. $endif$
  69. $endif$
  70. $if(listings)$
  71. \usepackage{listings}
  72. $endif$
  73. $if(lhs)$
  74. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  75. $endif$
  76. $if(highlighting-macros)$
  77. $highlighting-macros$
  78. $endif$
  79. $if(verbatim-in-note)$
  80. \usepackage{fancyvrb}
  81. $endif$
  82. $if(tables)$
  83. \usepackage{longtable}
  84. $endif$
  85. \usepackage{graphicx}
  86. \usepackage{caption}
  87. % We will generate all images so they have a width \maxwidth. This means
  88. % that they will get their normal width if they fit onto the page, but
  89. % are scaled down if they would overflow the margins.
  90. \makeatletter
  91. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
  92. \else\Gin@nat@width\fi}
  93. \makeatother
  94. \let\Oldincludegraphics\includegraphics
  95. \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
  96. \ifxetex
  97. \usepackage[setpagesize=false, % page size defined by xetex
  98. unicode=false, % unicode breaks when used with xetex
  99. xetex]{hyperref}
  100. \else
  101. \usepackage[unicode=true]{hyperref}
  102. \fi
  103. \hypersetup{breaklinks=true,
  104. bookmarks=true,
  105. pdfauthor={$author-meta$},
  106. pdftitle={$title-meta$},
  107. colorlinks=true,
  108. urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
  109. linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
  110. pdfborder={0 0 0}}
  111. \urlstyle{same} % don't use monospace font for urls
  112. $if(links-as-notes)$
  113. % Make links footnotes instead of hotlinks:
  114. \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
  115. $endif$
  116. $if(strikeout)$
  117. \usepackage[normalem]{ulem}
  118. % avoid problems with \sout in headers with hyperref:
  119. \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
  120. $endif$
  121. \setlength{\parindent}{0pt}
  122. %\setlength{\parskip}{6pt plus 2pt minus 1pt}
  123. \setlength{\emergencystretch}{3em} % prevent overfull lines
  124. \title{\huge 基于REST服务的最小物联网系统设计} % 設置標題,使用巨大字體
  125. \author{Phodal Huang} % 設置作者
  126. \date{February 2014} % 設置日期
  127. \usepackage{titling}
  128. \setlength{\droptitle}{-8em} % 將標題移動至頁面的上面
  129. \usepackage{fancyhdr}
  130. \usepackage{lastpage}
  131. \pagestyle{fancyplain}
  132. $if(numbersections)$
  133. \setcounter{secnumdepth}{5}
  134. $else$
  135. \setcounter{secnumdepth}{0}
  136. $endif$
  137. $if(verbatim-in-note)$
  138. \VerbatimFootnotes % allows verbatim text in footnotes
  139. $endif$
  140. $if(lang)$
  141. \ifxetex
  142. \usepackage{polyglossia}
  143. \setmainlanguage{$mainlang$}
  144. \else
  145. \usepackage[$lang$]{babel}
  146. \fi
  147. $endif$
  148. $for(header-includes)$
  149. $header-includes$
  150. $endfor$
  151. $if(title)$
  152. \title{$title$}
  153. $endif$
  154. \author{$for(author)$$author$$sep$ \and $endfor$}
  155. \date{$date$}
  156. %%%% 段落首行缩进两个字 %%%%
  157. \makeatletter
  158. \let\@afterindentfalse\@afterindenttrue
  159. \@afterindenttrue
  160. \makeatother
  161. \setlength{\parindent}{2em} %中文缩进两个汉字位
  162. %%%% 下面的命令重定义页面边距,使其符合中文刊物习惯 %%%%
  163. \addtolength{\topmargin}{-2pt}
  164. \setlength{\oddsidemargin}{0.63cm} % 3.17cm - 1 inch
  165. \setlength{\evensidemargin}{\oddsidemargin}
  166. \setlength{\textwidth}{14.66cm}
  167. \setlength{\textheight}{24.00cm} % 24.62
  168. %%%% 下面的命令设置行间距与段落间距 %%%%
  169. \linespread{1.4}
  170. % \setlength{\parskip}{1ex}
  171. \setlength{\parskip}{0.5\baselineskip}
  172. \begin{document}
  173. %%%% 定理类环境的定义 %%%%
  174. \newtheorem{example}{例} % 整体编号
  175. \newtheorem{algorithm}{算法}
  176. \newtheorem{theorem}{定理}[section] % 按 section 编号
  177. \newtheorem{definition}{定义}
  178. \newtheorem{axiom}{公理}
  179. \newtheorem{property}{性质}
  180. \newtheorem{proposition}{命题}
  181. \newtheorem{lemma}{引理}
  182. \newtheorem{corollary}{推论}
  183. \newtheorem{remark}{注解}
  184. \newtheorem{condition}{条件}
  185. \newtheorem{conclusion}{结论}
  186. \newtheorem{assumption}{假设}
  187. %%%% 重定义 %%%%
  188. \renewcommand{\contentsname}{目录} % 将Contents改为目录
  189. \renewcommand{\abstractname}{摘要} % 将Abstract改为摘要
  190. \renewcommand{\refname}{参考文献} % 将References改为参考文献
  191. \renewcommand{\indexname}{索引}
  192. \renewcommand{\figurename}{图}
  193. \renewcommand{\tablename}{表}
  194. \renewcommand{\appendixname}{附录}
  195. \maketitle
  196. $for(include-before)$
  197. $include-before$
  198. $endfor$
  199. $if(toc)$
  200. {
  201. \newpage
  202. \hypersetup{linkcolor=black}
  203. \setcounter{tocdepth}{$toc-depth$}
  204. \tableofcontents
  205. }
  206. \newpage
  207. $endif$
  208. $body$
  209. $if(natbib)$
  210. $if(biblio-files)$
  211. $if(biblio-title)$
  212. $if(book-class)$
  213. \renewcommand\bibname{$biblio-title$}
  214. $else$
  215. \renewcommand\refname{$biblio-title$}
  216. $endif$
  217. $endif$
  218. \bibliography{$biblio-files$}
  219. $endif$
  220. $endif$
  221. $if(biblatex)$
  222. \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
  223. $endif$
  224. $for(include-after)$
  225. $include-after$
  226. $endfor$
  227. \end{document}