mcmthesis 文档类∗ → English Version 王昭礼 黄晨成 [email protected] [email protected] 2015/02/05 摘要 这份模板是美国大学生数学建模竞赛(MCM/ICM)的论文模板。模板 遵循赛事官方的要求,设置了页眉页脚、字体和摘要页等内容。本文档对模板 的使用做出了说明。 1 模板介绍 这份模板最早由王昭礼设计,并在往年参赛者的建议下不断改进。2014 年 年初,黄晨成接手模板,用 key-value 语法重构了文档选项,并修复了一些 bug。 2015 年年初,黄晨成将模板使用 DocStrip 的语法重构,并上传至 CTAN。 2 安装说明 2.1 下载 你可以到项目主页下载模板的最新版本,也可以关注 LATEXStudio 的相关更 新,除去项目主页之外,不再维护任何镜像。 https://gitcafe.com/ChinaTeX/mcmthesis 此外,文档类也已上传至 CTAN,你可以在 TEX Live 等发行版的宏包管理 器中下载。 ∗ 这份文档是 mcmthesis v5.1.0d 的说明文档,更新日期 2015/02/05。 1 3 使用说明 2.2 2 安装 我们以 SOURCE 代表你下载的源文件目录,在终端下执行以下命令。 cd SOURCE xetex mcmthesis.dtx xelatex -shell-escape mcmthesis.dtx xelatex -shell-escape mcmthesis.dtx xelatex mcmthesis-demo.tex xelatex mcmthesis-demo.tex 你可以将生成的 mcmthesis.cls 拷贝至 TEXMF/tex/latex/mcmthesis/ 目录, 将 mcmthesis.dtx 拷 贝 至 TEXMF/source/latex/mcmthesis/, 将 mcmthesis.pdf、 mcmthesis-demo.tex、mcmthesis-demo.pdf、figures/ 和 code/ 拷贝至 TEXMF/doc/latex/mcmthesis/, 然后在终端执行 texhash;也可以将 mcmthesis.cls 放在当前目录直接使用。 生成的 mcmthesis-demo.tex 是一个示例文件,你可以参照这个文件来构建你 的论文;也可以直接修改这个文件。 3 使用说明 3.1 依赖 mcmthesis 依赖于以下宏包,这些宏包在常见的 TEX 发行版中都已包含,在 安装使用之前,请确认你的 TEX 发行版中正确安装了这些宏包。 kvoptions fancyhdr fancybox ifthen etoolbox lastpage listings appendix amsmath amssymb amsbsy bm longtable mathrsfs amsfonts latexsym multirow hhline tabularx ctex xeCJK tabu array minted CJK longtable xCJK2uni hologo calc colortbl booktabs hyperref pifont geometry fontenc ifpdf ifxetex epstopdf bmpsize longtable tabu hologo xcolor palatino mwe environ berasans graphicx flafter paralist 3 使用说明 3 如果你尚未安装这些宏包,可以启动你的 TEX 发行版的宏包管理器来安装; 或者到 http://www.ctan.org 上搜索下载并安装。 3.2 选项 mcmthesis 定义了一些选项,用来控制模板的行为。你可以在载入文档类的时 候指定这些选项的值,例如 \documentclass[tcn = 12345, problem = B, titlepage = false]{mcmthesis} \mcmsetup �你也可以使用 \mcmsetup{⟨key-value 列表⟩} 来指定这些值,例如 \documentclass{mcmthesis} \mcmsetup{tcn = 12345, problem = B, titlepage = false} 两种做法效果等同。 当前,mcmthesis 有七个选项: tcn 队伍控制号码,接受一个字符串作为值;输入的值将显示在摘要页上和每一 页的页眉上;默认为 0000。 problem 选题,接受一个字符串作为值;输入的值将显示在摘要页上;默认为 A。 sheet 布尔值;为真时将输出摘要页,否则不输出;默认为 true。 titleinsheet 布尔值;为真时将在摘要页输出标题,否则不输出;默认为 false。 keywordsinsheet 布尔值;为真时将在摘要页输出关键字,否则不输出;默认为 false。 titlepage 布尔值;为真时将输出标题页,否则不输出;默认为 true。 abstract 布尔值;为真时将在标题页输出摘要和关键词,否则不输出;默认值为 true。 注意,titleinsheet 和 keywordsinsheet 的效果受 sheet 的影响。若 sheet = false,则不论前二者的真假,均不会在摘要页上输出标题和/或关键字。另一方 面,若 sheet = true,则摘要部分总是会出现在摘要页。abstract 与 titlepage 选项的关系于前述类似。 3.3 \problem 题号 除了使用 \mcmsetup 来指定题号,你还可以使用 \problem{⟨题号⟩} 命令来 选择题号。后一种方式是为了兼容而提供的,不推荐使用。 4 版本历史 3.4 4 环境 abstract mcmthesis 重新定义了 abstract 环境,并且定义了 keywords 环境。需要注意 keywords 的是,他们的行为和 LATEX 标准的 \title 命令类似——在使用的时候,只是记 录内容,而并不输出内容;内容的实际输出要等到 \maketitle 命令。 3.5 编译方式 模板支持多种编译方式: • XƎLATEX 这是推荐的方式; • pdfLATEX; • LATEX + DVIPDFMx。 3.6 中文支持 由于 MCM/ICM 要求以英文写作,所以模板没有内建的中文支持。如果你在 文章中需要使用个别中文字符,可以自行使用合适中文支持方式。 对于 XƎLATEX 来说,可以使用 xeCJK 宏包。 \usepackage{xeCJK} \setCJKmainfont{SimSun} 这里,Mac OS X 的用户可以使用 STSong 来代替 SimSun;Linux 用户则可以使 用 FandolSong。 对于 pdfLATEX 和 LATEX + DVIPDFMx 来说,可以使用 zhmCJK 宏包。 \usepackage{zhmCJK} \setCJKmainfont{SimSun.ttc} 对 Mac OS X 和 Linux 的说明同上。 4 版本历史 5.1.0a 首次上传到 CTAN。 5.1.0b 修复 CheckSum 和一些拼写错误。 5.1.0c 新增 titleinsheet 等选项。 4 版本历史 5 5.1.0d 修改 problem 的定义方式,定义 \mcmsetup{⟨key-val 列表⟩} 以修改选项, 调高了摘要页表格的位置,修复摘要页和标题页页码的问题,修复标题、摘 要和关键字过长时分行、分页的问题。 The mcmthesis class∗ → 中文版 Zhaoli Wang Liam Huang [email protected] [email protected] 2015/02/05 摘要 This template is designed for MCM/ICM. The template configured fonts, header and footer and summary sheet style, accroding to the requirements of COMAP. This document desicribes the template. 5 Introduction This template was designed by Zhaoli Wang first, and was improved by him following the suggestions from contest takers. In the beginning of the year 2014, Liam Huang redesigned it, by using key-value syntax, and fixed known bugs. Liam reimplemented it at the begining of the year 2015, by DocStrip, and uploaded it to CTAN. 6 Installation Guide 6.1 Download You could find the latest version of this template at the project homepage, as well as the website LATEXStudio. We will not maintain any other mirror. https://github.com/LiamHuang0205/mcmthesis Moreover, this template had been uploaded to CTAN, so that it could be managed by the package manager of your distribution, such as TEX Live. ∗ This Document corresponds to mcmthesis v5.1.0d, dated 2015/02/05. 6 7 USAGE 6.2 7 Installation We denote SOURCE as the folder, who contains the file you’ve just down- loaded. Execute these command in the terminal. cd SOURCE xetex mcmthesis.dtx xelatex -shell-escape mcmthesis.dtx xelatex -shell-escape mcmthesis.dtx xelatex mcmthesis-demo.tex xelatex mcmthesis-demo.tex To finish the installation, you could copy mcmthesis.cls to TEXMF/tex/latex/mcmthesis/, copy mcmthesis.dtx to TEXMF/source/latex/mcmthesis/, copy mcmthesis.pdf, mcmthesisdemo.tex, mcmthesis-demo.pdf, figures/ and code/ to TEXMF/doc/latex/mcmthesis/, and then run texhash in your terminal; you could also put mcmthesis.cls in the same folder of the master file. mcmthesis-demo.tex is a generated demo file, you could write the manuscript of you paper by mimicing this file; you may also modify this file to build your paper. 7 Usage 7.1 Dependence The mcmthesis class depends on the following pakcages. These packages has been installed in common TEX distribution. Before installation, please make sure that you have installed these packages correctly. kvoptions fancyhdr fancybox ifthen etoolbox lastpage listings appendix amsmath amssymb amsbsy bm longtable mathrsfs amsfonts latexsym paralist multirow hhline tabularx ctex xeCJK tabu array minted CJK longtable xCJK2uni hologo calc colortbl booktabs pifont geometry flafter fontenc 7 USAGE 8 berasans graphicx hyperref ifpdf ifxetex epstopdf bmpsize longtable tabu hologo xcolor palatino mwe environ If you haven’t install these packages, you could execute the package manager of your distribution and install them; you could also download them from http: //www.ctan.org. 7.2 Options mcmthesis defined serval options to control the behaviour of the template. You could specify these options while loading the class. \documentclass[tcn = 12345, problem = B, titlepage = false]{mcmthesis} \mcmsetup �You may also use the command \mcmsetup{⟨key-value list⟩} to specify them. \documentclass{mcmthesis} \mcmsetup{tcn = 12345, problem = B, titlepage = false} The two methods share the same effect. mcmthesis has seven options. tcn The team control number, recieves a string as value; this value will be displayed on summary sheet and every page’s header. The default value is 0000. problem The question, recieves a string as value; this value will be displayed on summary sheet. The default value is A. sheet Bool, true to print the summary sheet, default is true. titleinsheet Bool, true to print the title in the summary sheet, default is false. keywordsinsheet Bool, true to print keywords in the summary sheet, default is false. titlepage Bool, true to print the titlepage, default is true. abstract Bool, true to print the abstract on the titlepage, default is true. 8 HISTORY 9 Note that the effect of titleinsheet and keywordsinsheet are under the control of the option sheet, that is, if sheet is set to false, title and/or keywords will not be printed on the summary sheet, whatever the value of these two options are. On the other hand, the abstract will always be printed on the summary sheet, if the sheet is set to true. The relationship between abstract and titlepage is similar to that just mentioned. 7.3 Question Besides using \mcmsetup to choose question, you could also use \problem{⟨Question⟩} \problem to do this. However, the later one is here just because of backward compatibility, and is not recommended any longer. 7.4 Environment abstract mcmthesis redefined the abstract environment, and defined a new environment keywords named keywords. Note that these two environments behave like the standard \title — they will not print any contents to the PDF file when they are used but just record them; the output task belongs to \maketitle. 7.5 Compilation Workflow The template supports various kinds of compilation workflow: • XƎLATEX (recommend); • pdfLATEX; • LATEX + DVIPDFMx。 8 History 5.1.0a First release to CTAN. 5.1.0b Fix the bug of CheckSum and typos. 5.1.0c Import options, such as titleinsheet. 9 THE IMPLEMENTATION 10 5.1.0d Change the way to define problem, create \mcmsetup{⟨key-val list⟩} to modify the option, slightly lift the table on the summary sheet, fix the bug of page number and fix the bug of title, abstract and keywords. 9 9.1 The Implementation Basic Information 1 ⟨∗class⟩ 2 \NeedsTeXFormat{LaTeX2e}[1999/12/01] 3 \ProvidesClass{mcmthesis} [2015/02/05 v5.1.0d Thesis Template For MCM/ICM] 4 5 \typeout{Thesis Template For MCM/ICM} 6 \def\MCMversion{v5.1.0d} 9.2 Options Loading kvoptions and etoolbox to handle key-value options. 7 \RequirePackage{kvoptions} 8 \RequirePackage{etoolbox} 9 \SetupKeyvalOptions{family=MCM, prefix=MCM@opt@, setkeys=\kvsetkeys} \mcmsetup 10 \newcommand{\mcmsetup}[1]{\kvsetkeys{MCM}{#1}} Declaring options. 11 \DeclareBoolOption[true]{sheet} 12 \DeclareComplementaryOption{nosheet}{sheet} 13 \DeclareBoolOption[false]{titleinsheet} 14 \DeclareComplementaryOption{notitleinsheet}{titleinsheet} 15 \DeclareBoolOption[false]{keywordsinsheet} 16 \DeclareComplementaryOption{nokeywordsinsheet}{keywordsinsheet} 17 \DeclareBoolOption[true]{titlepage} 18 \DeclareComplementaryOption{notitlepage}{titlepage} 19 \DeclareBoolOption[true]{abstract} 20 \DeclareComplementaryOption{noabstract}{abstract} 21 \DeclareStringOption[0000]{tcn}[0000] 22 \DeclareStringOption[A]{problem}[A] 23 \DeclareDefaultOption{\relax} 9 THE IMPLEMENTATION Processing options. 24 \ProcessKeyvalOptions*\relax Loading document class. 25 \LoadClass[a4paper, 11pt]{article} User interface. 26 \newcommand{\team}{Team \#\ \MCM@opt@tcn} 9.3 Loading Packages 27 \RequirePackage{fancyhdr, fancybox} 28 \RequirePackage{ifthen} 29 \RequirePackage{lastpage} 30 \RequirePackage{listings} 31 \RequirePackage[toc, page, title, titletoc, header]{appendix} 32 \RequirePackage{paralist} 33 \RequirePackage{amsthm, amsfonts} 34 \RequirePackage{amsmath, bm} 35 \RequirePackage{amssymb, mathrsfs} 36 \RequirePackage{latexsym} 37 \RequirePackage{longtable, multirow, hhline, tabularx, array} 38 \RequirePackage{flafter} 39 \RequirePackage{pifont, calc} 40 \RequirePackage{colortbl, booktabs} 41 \RequirePackage{geometry} 42 \RequirePackage[T1]{fontenc} 43 \RequirePackage[scaled]{berasans} 44 \RequirePackage{hyperref} 45 \RequirePackage{ifpdf, ifxetex} 46 \RequirePackage{environ} Loading graphicx and its relations after checking drivers. 47 \ifpdf 48 \RequirePackage{graphicx} 49 \RequirePackage{epstopdf} 50 51 52 53 \else \ifxetex \RequirePackage{graphicx} \else 11 9 THE IMPLEMENTATION \RequirePackage[dvipdfmx]{graphicx} 54 \RequirePackage{bmpsize} 55 \fi 56 57 \fi 58 \RequirePackage{xcolor} 9.4 59 \ifpdf \hypersetup{hidelinks} 60 61 hyperref Settings \else \ifxetex 62 \hypersetup{hidelinks} 63 \else 64 \hypersetup{dvipdfm, hidelinks} 65 \fi 66 67 \fi 9.5 Page Layout Setting paper size and margin sep. 68 \geometry{a4paper, margin = 1.2in} Making the footer and header. 69 \pagestyle{fancy} 70 \fancyhf{} 71 \lhead{\small \team} 72 \rhead{\small Page \thepage\ of \pageref{LastPage}} Setting \parskip. 73 \setlength\parskip{.5\baselineskip} 9.6 74 75 Redefining TOC \renewcommand\tableofcontents{% \centerline{\normalfont\Large\bfseries\contentsname \@mkboth{% 76 \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% 77 78 \vskip 5ex% 79 \@starttoc{toc}% 80 } 12 9 THE IMPLEMENTATION 9.7 13 Mastering Floats, Figures and Tables Setting counters. Here totalnumber is the maximum number of floats on a text page, topnumber is the maximum number of floats at top of a text page and bottomnumber is the maximum number of floats at bottom of a text page. Obviously, we have totalnumber = topnumber + bottomnumber. 81 \setcounter{totalnumber}{4} 82 \setcounter{topnumber}{2} 83 \setcounter{bottomnumber}{2} Setting float fractions. 84 \renewcommand{\textfraction}{0.15} 85 \renewcommand{\topfraction}{0.85} 86 \renewcommand{\bottomfraction}{0.65} 87 \renewcommand{\floatpagefraction}{0.60} Setting caption names. 88 \renewcommand{\figurename}{Figure} 89 \renewcommand{\tablename}{Table} Setting graphic paths. 90 \graphicspath{{./}{./img/}{./fig/}{./image/}{./figure/}{./picture/} 91 {./imgs/}{./figs/}{./images/}{./figures/}{./pictures/}} 9.8 Designing Sheets and their Relations Redefining \maketitle, which will check if the control sheet and titlepage should be printed. 92 \def\maketitle{% 93 \let\saved@thepage\thepage 94 \let\thepage\relax 95 \ifMCM@opt@sheet 96 \makesheet 97 \fi 98 \newpage 99 \ifMCM@opt@titlepage 100 \MCM@maketitle 101 \fi 102 \let\thepage\saved@thepage 103 \setcounter{page}{0} 9 THE IMPLEMENTATION \clearpage 104 \pagestyle{fancy} 105 106 } Making the abstract environment. 107 \def\abstractname{Summary} 108 \RenewEnviron{abstract}{\xdef\@abstract{\expandonce\BODY}} 109 \def\make@abstract{% \begin{center} 110 \textbf{\abstractname} 111 112 \end{center} 113 \@abstract\par 114 \let\@abstract\relax 115 } Making the keywords environment. 116 \def\keywordsname{Keywords} 117 \NewEnviron{keywords}{\xdef\@keywords{\expandonce\BODY}} 118 \def\make@keywords{% 119 \par\noindent\textbf{\keywordsname}: 120 \@keywords\par \let\@keywords\relax 121 122 } Defining the \makesheet. 123 \newcommand{\problem}[1]{\mcmsetup{problem = #1}} 124 \def\makesheet{% 125 \pagestyle{empty}% 126 \null% 127 \vskip -3em% 128 \begingroup\fontfamily{fvs}\fontseries{m}\selectfont% 129 \noindent\begin{tabularx}{0.3\textwidth}{lX}% 130 \multicolumn{2}{l}{For office use only}\\ 131 T1&\rule{3cm}{0.5pt}\\ 132 T2&\rule{3cm}{0.5pt}\\ 133 T3&\rule{3cm}{0.5pt}\\ 134 T4&\rule{3cm}{0.5pt}\\ 135 \end{tabularx}\hspace{\fill} 136 \begin{minipage}{0.33\textwidth} 137 \centering 14 9 THE IMPLEMENTATION 138 Team Control Number\\[10pt] 139 {\fontsize{38pt}{25pt}\selectfont 15 \textbf{\MCM@opt@tcn} }% \normalsize\\[10pt] 140 141 Problem Chosen\\[10pt] 142 {\fontsize{20pt}{\baselineskip}\selectfont 143 \textbf{\MCM@opt@problem}}\normalsize\\ 144 \end{minipage}\hspace{\fill} 145 \begin{tabularx}{0.28\textwidth}{lX}% 146 \multicolumn{2}{l}{For office use only}\\ 147 F1&\rule{3cm}{0.5pt}\\ 148 F2&\rule{3cm}{0.5pt}\\ 149 F3&\rule{3cm}{0.5pt}\\ 150 F4&\rule{3cm}{0.5pt}\\ 151 \end{tabularx}\par 152 \noindent\rule{\textwidth}{0.5pt}\par 153 \begin{center} 154 \textbf{{\Large\the\year}\\% 155 Mathematical Contest in Modeling (MCM/ICM) Summary Sheet}% 156 \par 157 \vskip 1.5ex% 158 \begingroup 159 \ifMCM@opt@titleinsheet \normalfont \LARGE \@title \par 160 161 162 \fi \endgroup 163 \end{center} 164 \ifMCM@opt@keywordsinsheet 165 166 167 168 \make@abstract \make@keywords \else \make@abstract 169 \fi 170 \endgroup} Defining the \MCM@maketitle 171 \newcommand{\MCM@maketitle}{% 172 \begin{center}% 173 \let \footnote \thanks 174 {\LARGE \@title \par}% 9 THE IMPLEMENTATION 175 \vskip 1.5em% 176 {\large 177 \lineskip .5em% 178 \begin{tabular}[t]{c}% \@author 179 \end{tabular}\par}% 180 181 \vskip 1em% 182 {\large \@date}% 183 \end{center}% 184 \par 185 \vskip 1.5em% 186 \ifMCM@opt@abstract% 187 \make@abstract 188 \make@keywords 189 \fi% 190 } 9.9 Mathematics Theorems. 191 \newtheorem{Theorem}{Theorem}[section] 192 \newtheorem{Lemma}[Theorem]{Lemma} 193 \newtheorem{Corollary}[Theorem]{Corollary} 194 \newtheorem{Proposition}[Theorem]{Proposition} 195 \newtheorem{Definition}[Theorem]{Definition} 196 \newtheorem{Example}[Theorem]{Example} Other definitions. 197 \providecommand{\dif}{\mathop{}\!\mathrm{d}} 198 \providecommand{\me}{\mathrm{e}} 199 \providecommand{\mi}{\mathrm{i}} 9.10 Listing Settings 200 \definecolor{grey}{rgb}{0.8,0.8,0.8} 201 \definecolor{darkgreen}{rgb}{0,0.3,0} 202 \definecolor{darkblue}{rgb}{0,0,0.3} 203 \def\lstbasicfont{\fontfamily{pcr}\selectfont\footnotesize} 204 \lstset{% 16 9 205 THE IMPLEMENTATION % indexing 206 % numbers=left, 207 % numberstyle=\small,% 208 % character display 209 showstringspaces=false, 210 showspaces=false,% tabsize=4,% 211 212 % style 213 frame=lines,% 214 basicstyle={\footnotesize\lstbasicfont},% 215 keywordstyle=\color{darkblue}\bfseries,% 216 identifierstyle=,% 217 commentstyle=\color{darkgreen},%\itshape,% 218 stringstyle=\color{black}% 219 } 220 \lstloadlanguages{C,C++,Java,Matlab,Mathematica} 221 ⟨/class⟩ 222 ⟨class⟩\endinput 17
© Copyright 2024