|
| 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 | + |
| 86 | +\usepackage{graphicx} |
| 87 | +\usepackage{caption} |
| 88 | +% We will generate all images so they have a width \maxwidth. This means |
| 89 | +% that they will get their normal width if they fit onto the page, but |
| 90 | +% are scaled down if they would overflow the margins. |
| 91 | +\makeatletter |
| 92 | +\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth |
| 93 | +\else\Gin@nat@width\fi} |
| 94 | +\makeatother |
| 95 | +\let\Oldincludegraphics\includegraphics |
| 96 | +\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}} |
| 97 | +\ifxetex |
| 98 | + \usepackage[setpagesize=false, % page size defined by xetex |
| 99 | + unicode=false, % unicode breaks when used with xetex |
| 100 | + xetex]{hyperref} |
| 101 | +\else |
| 102 | + \usepackage[unicode=true]{hyperref} |
| 103 | +\fi |
| 104 | +\hypersetup{breaklinks=true, |
| 105 | + bookmarks=true, |
| 106 | + pdfauthor={$author-meta$}, |
| 107 | + pdftitle={$title-meta$}, |
| 108 | + colorlinks=true, |
| 109 | + urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$, |
| 110 | + linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$, |
| 111 | + pdfborder={0 0 0}} |
| 112 | +\urlstyle{same} % don't use monospace font for urls |
| 113 | +$if(links-as-notes)$ |
| 114 | +% Make links footnotes instead of hotlinks: |
| 115 | +\renewcommand{\href}[2]{#2\footnote{\url{#1}}} |
| 116 | +$endif$ |
| 117 | +$if(strikeout)$ |
| 118 | +\usepackage[normalem]{ulem} |
| 119 | +% avoid problems with \sout in headers with hyperref: |
| 120 | +\pdfstringdefDisableCommands{\renewcommand{\sout}{}} |
| 121 | +$endif$ |
| 122 | +\setlength{\parindent}{0pt} |
| 123 | +%\setlength{\parskip}{6pt plus 2pt minus 1pt} |
| 124 | +\setlength{\emergencystretch}{3em} % prevent overfull lines |
| 125 | +\usepackage{titling} |
| 126 | +\setlength{\droptitle}{-8em} % 將標題移動至頁面的上面 |
| 127 | + |
| 128 | +\usepackage{fancyhdr} |
| 129 | +\usepackage{lastpage} |
| 130 | +\pagestyle{fancyplain} |
| 131 | + |
| 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 | + |
| 152 | +$if(title)$ |
| 153 | +\title{$title$} |
| 154 | +$endif$ |
| 155 | +\author{$for(author)$$author$$sep$ \and $endfor$} |
| 156 | +\date{$date$} |
| 157 | + |
| 158 | +%%%% 段落首行缩进两个字 %%%% |
| 159 | +\makeatletter |
| 160 | +\let\@afterindentfalse\@afterindenttrue |
| 161 | +\@afterindenttrue |
| 162 | +\makeatother |
| 163 | +\setlength{\parindent}{2em} %中文缩进两个汉字位 |
| 164 | + |
| 165 | + |
| 166 | +%%%% 下面的命令重定义页面边距,使其符合中文刊物习惯 %%%% |
| 167 | +\addtolength{\topmargin}{-2pt} |
| 168 | +\setlength{\oddsidemargin}{0.63cm} % 3.17cm - 1 inch |
| 169 | +\setlength{\evensidemargin}{\oddsidemargin} |
| 170 | +\setlength{\textwidth}{14.66cm} |
| 171 | +\setlength{\textheight}{24.00cm} % 24.62 |
| 172 | + |
| 173 | +%%%% 下面的命令设置行间距与段落间距 %%%% |
| 174 | +\linespread{1.4} |
| 175 | +% \setlength{\parskip}{1ex} |
| 176 | +\setlength{\parskip}{0.5\baselineskip} |
| 177 | + |
| 178 | + |
| 179 | +\begin{document} |
| 180 | +%%%% 定理类环境的定义 %%%% |
| 181 | +\newtheorem{example}{例} % 整体编号 |
| 182 | +\newtheorem{algorithm}{算法} |
| 183 | +\newtheorem{theorem}{定理}[section] % 按 section 编号 |
| 184 | +\newtheorem{definition}{定义} |
| 185 | +\newtheorem{axiom}{公理} |
| 186 | +\newtheorem{property}{性质} |
| 187 | +\newtheorem{proposition}{命题} |
| 188 | +\newtheorem{lemma}{引理} |
| 189 | +\newtheorem{corollary}{推论} |
| 190 | +\newtheorem{remark}{注解} |
| 191 | +\newtheorem{condition}{条件} |
| 192 | +\newtheorem{conclusion}{结论} |
| 193 | +\newtheorem{assumption}{假设} |
| 194 | + |
| 195 | +%%%% 重定义 %%%% |
| 196 | +\renewcommand{\contentsname}{目录} % 将Contents改为目录 |
| 197 | +\renewcommand{\abstractname}{摘要} % 将Abstract改为摘要 |
| 198 | +\renewcommand{\refname}{参考文献} % 将References改为参考文献 |
| 199 | +\renewcommand{\indexname}{索引} |
| 200 | +\renewcommand{\figurename}{图} |
| 201 | +\renewcommand{\tablename}{表} |
| 202 | +\renewcommand{\appendixname}{附录} |
| 203 | + |
| 204 | +$for(include-before)$ |
| 205 | +$include-before$ |
| 206 | + |
| 207 | +$endfor$ |
| 208 | +$if(toc)$ |
| 209 | +{ |
| 210 | +\newpage |
| 211 | +\hypersetup{linkcolor=black} |
| 212 | +\setcounter{tocdepth}{$toc-depth$} |
| 213 | +\tableofcontents |
| 214 | +} |
| 215 | +\newpage |
| 216 | +$endif$ |
| 217 | +$body$ |
| 218 | + |
| 219 | +$if(natbib)$ |
| 220 | +$if(biblio-files)$ |
| 221 | +$if(biblio-title)$ |
| 222 | +$if(book-class)$ |
| 223 | +\renewcommand\bibname{$biblio-title$} |
| 224 | +$else$ |
| 225 | +\renewcommand\refname{$biblio-title$} |
| 226 | +$endif$ |
| 227 | +$endif$ |
| 228 | +\bibliography{$biblio-files$} |
| 229 | + |
| 230 | +$endif$ |
| 231 | +$endif$ |
| 232 | +$if(biblatex)$ |
| 233 | +\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ |
| 234 | + |
| 235 | +$endif$ |
| 236 | +$for(include-after)$ |
| 237 | +$include-after$ |
| 238 | + |
| 239 | +$endfor$ |
| 240 | +\end{document} |
0 commit comments