| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2020 by zhaofeng-shu33 <[email protected]> |
| 4 |
% |
| 5 |
% This work may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 7 |
% of this license or (at your option) any later version. |
| 8 |
% The latest version of this license is in |
| 9 |
% http://www.latex-project.org/lppl.txt |
| 10 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 11 |
% version 2005/12/01 or later. |
| 12 |
% |
| 13 |
% This work has the LPPL maintenance status `maintained'. |
| 14 |
% |
| 15 |
% \fi |
| 16 |
% |
| 17 |
%\iffalse |
| 18 |
%<*internal> |
| 19 |
\begingroup |
| 20 |
\input docstrip.tex |
| 21 |
\askforoverwritefalse |
| 22 |
\showprogress |
| 23 |
\keepsilent |
| 24 |
\preamble |
| 25 |
|
| 26 |
This is a generated file. |
| 27 |
|
| 28 |
Copyright (C) \the\year by zhaofeng-shu33 <[email protected]> |
| 29 |
|
| 30 |
This work may be distributed and/or modified under the |
| 31 |
conditions of the LaTeX Project Public License, either version 1.3 |
| 32 |
of this license or (at your option) any later version. |
| 33 |
The latest version of this license is in |
| 34 |
http://www.latex-project.org/lppl.txt |
| 35 |
and version 1.3 or later is part of all distributions of LaTeX |
| 36 |
version 2005/12/01 or later. |
| 37 |
|
| 38 |
To produce the documentation run the original source files ending with `.dtx' |
| 39 |
through LaTeX. |
| 40 |
|
| 41 |
\endpreamble |
| 42 |
\nopostamble |
| 43 |
\generate{ |
| 44 |
\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}} |
| 45 |
\file{iidef.sty}{\from{\jobname.dtx}{sty}} |
| 46 |
} |
| 47 |
|
| 48 |
\ifToplevel{% |
| 49 |
\Msg{***********************************************************} |
| 50 |
\Msg{*} |
| 51 |
\Msg{* To produce the documentation run the files ending with} |
| 52 |
\Msg{* `.dtx' through XeLaTeX.} |
| 53 |
\Msg{*} |
| 54 |
\Msg{* Happy TeXing!} |
| 55 |
\Msg{***********************************************************}} |
| 56 |
\endgroup |
| 57 |
%</internal> |
| 58 |
%<*driver> |
| 59 |
\ProvidesFile{thucoursework.dtx}[2020/09/09 2.6 Tsinghua University Coursework Template] |
| 60 |
\documentclass{ltxdoc} |
| 61 |
\usepackage{dtx-style} |
| 62 |
|
| 63 |
\EnableCrossrefs |
| 64 |
\CodelineIndex |
| 65 |
\RecordChanges |
| 66 |
|
| 67 |
\begin{document} |
| 68 |
\DocInput{\jobname.dtx} |
| 69 |
\end{document} |
| 70 |
%</driver> |
| 71 |
% \fi |
| 72 |
% \DoNotIndex{\NeedsTeXFormat,\ProvidesClass,\RequirePackage} |
| 73 |
% \DoNotIndex{\renewcommand,\underline,\newcommand,\def} |
| 74 |
% \DoNotIndex{\setlist,\hfill,\hrule,\vspace} |
| 75 |
% \DoNotIndex{\begin,\end,\DeclareStringOption} |
| 76 |
% \DoNotIndex{\fancypagestyle,\fancyhead,\pagestyle,\thispagestyle} |
| 77 |
% \DoNotIndex{\protect,\mathpalette,\rlap,\mathrel,\mkern} |
| 78 |
% \GetFileInfo{\jobname.dtx} |
| 79 |
%^^A theses changes are moved from update.md |
| 80 |
%^^A \changes{hversioni}{hdatei}{htexti} |
| 81 |
% \def\xiangxiang{\textit{Xiangxiang}} |
| 82 |
% \def\zhaofeng{\textit{zhaofeng-shu33}} |
| 83 |
% \changes{v1.1}{2017/09/26}{[\xiangxiang] Add mathcal and eucal package.} |
| 84 |
% \changes{v1.1}{2017/09/26}{[\xiangxiang] Add aligned equations in \texttt{iihw.tex}.} |
| 85 |
% \changes{v1.2}{2017/10/09}{[\xiangxiang] Add example for figures in \texttt{iihw.tex}} |
| 86 |
% \changes{v1.2}{2017/10/09}{[\xiangxiang] Add example fro input matlab codes in \texttt{iihw.tex}} |
| 87 |
% \changes{v1.2}{2017/10/09}{[\xiangxiang] No need to set counter style manually} |
| 88 |
% \changes{v1.3}{2017/10/12}{[\xiangxiang] Add example for vector and random vectors(underline) in \texttt{iihw.tex}} |
| 89 |
% \changes{v1.4}{2017/10/30}{[\xiangxiang] Add an example of hypothesis testing in \texttt{iihw.tex}} |
| 90 |
% \def\indexname{索引} |
| 91 |
% \def\glossaryname{修改记录} |
| 92 |
% \IndexPrologue{\section{\indexname}} |
| 93 |
% \GlossaryPrologue{\section{\glossaryname}} |
| 94 |
% \title{\bfseries\color{violet}\thucoursework:清华大学课程作业模板\thanks{本文档在 \textit{xueruini} 的 \href{https://github.com/xueruini/thuthesis}{\enspace \textsc{Thu}\-\textsc{Thesis}} 手册基础上进行改动}} |
| 95 |
% \author{{\fangsong 赵丰\thanks{师兄徐祥祥维护到v1.4}}\\[5pt]\texttt{[email protected]}} |
| 96 |
% \date{v\fileversion\ (\filedate)} |
| 97 |
% \maketitle\thispagestyle{empty} |
| 98 |
% |
| 99 |
% |
| 100 |
% \begin{abstract}\noindent |
| 101 |
% 此宏包旨在建立一个简单易用的清华大学课程作业模板,作业主要针对理论物理、数学、信息科学、通信、理论力学等方面。 |
| 102 |
% \end{abstract} |
| 103 |
% |
| 104 |
% \vskip2cm |
| 105 |
% \def\abstractname{免责声明} |
| 106 |
% \begin{abstract} |
| 107 |
% \noindent |
| 108 |
% \begin{enumerate} |
| 109 |
% \item 本模板的发布遵守 \LaTeX\ Project Public License,使用前请认真阅读协议内 |
| 110 |
% 容。 |
| 111 |
% \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵 |
| 112 |
% 守 \LaTeX\ Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与 |
| 113 |
% 本模板作者无关。 |
| 114 |
% \end{enumerate} |
| 115 |
% \end{abstract} |
| 116 |
% |
| 117 |
% |
| 118 |
% \clearpage |
| 119 |
% \pagestyle{fancy} |
| 120 |
% \begin{multicols}{2}[ |
| 121 |
% \setlength{\columnseprule}{.4pt} |
| 122 |
% \setlength{\columnsep}{18pt}] |
| 123 |
% \tableofcontents |
| 124 |
% \end{multicols} |
| 125 |
% \clearpage |
| 126 |
% |
| 127 |
% \section{模板介绍} |
| 128 |
% \thucoursework\ (\textbf{T}sing\textbf{h}ua \textbf{U}niversity \LaTeX\ |
| 129 |
% \textbf{Coursework} Template) 是为了帮助清华大学学生撰写课程作业而编写 |
| 130 |
% 的 \LaTeX\ 模板。最初由徐祥祥师兄担任\textit{Information Inference} 这门课助教期间设计出来,当时命名为\texttt{idef.sty}。后来由赵丰接手进行拓展和完善。 |
| 131 |
% 本文档将尽量完整的介绍模板的使用方法,如有不清楚之处可以参考示例文档或者根据 |
| 132 |
% 第~\ref{sec:howtoask} 节说明提问,有兴趣者都可以参与完善此手册,也非常欢迎对代 |
| 133 |
% 码的贡献。 |
| 134 |
|
| 135 |
% \section{安装} |
| 136 |
% \label{sec:installation} |
| 137 |
% |
| 138 |
%^^A 发行版 updated , 2018/5/17 https://mirror.ctan.org/systems/texlive/tlnet/tlpkg |
| 139 |
% 阅读文档可以使用以下命令: |
| 140 |
% \begin{shell} |
| 141 |
% $ texdoc thucoursework |
| 142 |
% \end{shell} |
| 143 |
% |
| 144 |
% 如果要使用开发版,需自己下载,\thucoursework\ 相关链接: |
| 145 |
% \begin{itemize} |
| 146 |
% \item 主页:\href{https://github.com/zhaofeng-shu33/THU-coursework-template}{GitHub} |
| 147 |
% \item 下载:\href{https://www.ctan.org/pkg/thucoursework}{CTAN} |
| 148 |
% \end{itemize} |
| 149 |
% |
| 150 |
% \subsection{模板的组成} |
| 151 |
% 下表列出了 \thucoursework\ 的主要文件及其功能介绍: |
| 152 |
% |
| 153 |
% \begin{longtable}{l|p{8cm}} |
| 154 |
% \toprule |
| 155 |
% {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule |
| 156 |
% \endfirsthead |
| 157 |
% \midrule |
| 158 |
% {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule |
| 159 |
% \endhead |
| 160 |
% \endfoot |
| 161 |
% \endlastfoot |
| 162 |
% thucoursework.dtx & \textsc{DocStrip} 源文件(开发用)\\\midrule |
| 163 |
% iihw.tex & \xiangxiang 编写的使用模板的英文作业例子\\ |
| 164 |
% ithw.tex & \zhaofeng 编写的使用模板的中文作业例子\\ \midrule |
| 165 |
% Makefile & Makefile\\ |
| 166 |
% & latexmk 配置文件 \\ |
| 167 |
% README.md & Readme\\ |
| 168 |
% \textbf{thucoursework.pdf} & 用户手册(本文档)\\\bottomrule |
| 169 |
% \end{longtable} |
| 170 |
% |
| 171 |
% |
| 172 |
% \subsection{生成模板sty文件和用户手册} |
| 173 |
% \label{sec:generate-cls} |
| 174 |
% \note[提示:]{若使用 linux 操作系统,可在含有\file{Makefile}的目录下直接运行 \texttt{make doc} 命令 |
| 175 |
% 生成模板sty文件和用户手册} |
| 176 |
% |
| 177 |
% 在使用之前可以用下面的代码生成模板sty文件和用户手册: |
| 178 |
% |
| 179 |
% \begin{shell} |
| 180 |
% $ xelatex thucoursework.dtx |
| 181 |
% $ makeindex -s gind.ist -o thucoursework.ind thucoursework.idx |
| 182 |
% $ makeindex -s gglo.ist -o thucoursework.gls thucoursework.glo |
| 183 |
% $ xelatex thucoursework.dtx |
| 184 |
% $ xelatex thucoursework.dtx % 生成说明文档 thucoursework.pdf |
| 185 |
% \end{shell} |
| 186 |
% |
| 187 |
% |
| 188 |
% |
| 189 |
% \subsection{生成作业} |
| 190 |
% \label{sec:generate-coursework} |
| 191 |
% 本节介绍几种常见的生成作业的方法。用户可根据自己的情况选择,使用前请仿照例子里的tex文件,使用 |
| 192 |
% \begin{latex} |
| 193 |
% \usepackage{iidef} |
| 194 |
% \end{latex} |
| 195 |
% 引用宏包。 |
| 196 |
% \subsubsection{\XeLaTeX} |
| 197 |
% \label{sec:xelatex} |
| 198 |
% 很多用户对 \LaTeX\ 命令执行的次数不太清楚。一个基本的原则是多次运行 \LaTeX\ 命 |
| 199 |
% 令直至不再出现警告。下面给出生成示例文档的详细过程(\texttt{\#} 开头的行为注 |
| 200 |
% 释),首先来看推荐的 \texttt{xelatex} 方式: |
| 201 |
% \begin{shell} |
| 202 |
% # 1. 发现里面的引用关系,文件后缀 .tex 可以省略 |
| 203 |
% $ xelatex main |
| 204 |
% |
| 205 |
% # 2. 编译参考文件源文件,生成 bbl 文件 |
| 206 |
% $ bibtex main |
| 207 |
% |
| 208 |
% # 3. 下面解决引用 |
| 209 |
% $ xelatex main |
| 210 |
% $ xelatex main # 此时生成完整的 pdf 文件 |
| 211 |
% \end{shell} |
| 212 |
% |
| 213 |
% \subsubsection{PDF\LaTeX} |
| 214 |
% \label{sec:pdflatex} |
| 215 |
% 当仅使用英文完成课程作业时,可以使用 PDF\LaTeX,编译速度会快很多。按照第~\ref{sec:xelatex} 节的顺序执行即可,只是将命令中 |
| 216 |
% \texttt{xelatex} 替换为 \texttt{pdflatex}。 |
| 217 |
% |
| 218 |
% 需要注意的是 PDF\LaTeX\ 不能处理常见的 EPS 图形,需要先用 \texttt{epstopdf} 将其转化 |
| 219 |
% 成 PDF。不过 PDF\LaTeX\ 增加了对 png,jpg 等格式的支持,比较方便。\TeX Live |
| 220 |
% 自从 2010 版本起自动调用 \texttt{epstopdf} 将 EPS 图形转化为 PDF。 |
| 221 |
% |
| 222 |
% \subsubsection{latexmk} |
| 223 |
% \label{sec:latexmk} |
| 224 |
% \texttt{latexmk} 命令支持全自动生成 \LaTeX\ 编写的文档,并且支持使用不同的工具 |
| 225 |
% 链来进行生成,它会自动运行多次工具直到交叉引用都被解决。下面给出了一个用 |
| 226 |
% \texttt{latexmk} 调用 \texttt{xelatex} 生成最终文档的示例: |
| 227 |
% \begin{shell} |
| 228 |
% # 一句话就够了! |
| 229 |
% $ latexmk -xelatex Assignment |
| 230 |
% \end{shell} |
| 231 |
% |
| 232 |
% \subsubsection{make} |
| 233 |
% \label{sec:make} |
| 234 |
% \note[提示:]{使用 \texttt{make} 编译,需要配合linux 操作系统。} |
| 235 |
% |
| 236 |
% |
| 237 |
% \subsection{升级} |
| 238 |
% \label{sec:updgrade} |
| 239 |
% |
| 240 |
% \section{使用说明} |
| 241 |
% \label{sec:usage} |
| 242 |
% 本手册假定用户已经能处理一般的 \LaTeX\ 文档。如果 |
| 243 |
% 从来没有接触过 \TeX\ 和 \LaTeX,建议先学习相关的基础知识。 |
| 244 |
% |
| 245 |
% \subsection{关于提问} |
| 246 |
% \label{sec:howtoask} |
| 247 |
% 按照优先级推荐提问的位置如下: |
| 248 |
% |
| 249 |
% \begin{itemize} |
| 250 |
% \item \href{https://github.com/zhaofeng-shu33/thucoursework/issues}{Github Issues} |
| 251 |
% \item \href{https://github.com/CTeX-org/forum/issues}{ctex 论坛} |
| 252 |
% \end{itemize} |
| 253 |
% |
| 254 |
% \subsection{示例文件} |
| 255 |
% \label{sec:userguide} |
| 256 |
% |
| 257 |
% 推荐新用户从模板自带的示例文档入手,里面包括了写作业用到的所有命令及其使用方法, |
| 258 |
% 只需要用自己的内容进行相应替换就可以。对于不清楚的命令可以查阅本手册。下面的例 |
| 259 |
% 子描述了模板中作业的组织形式,来自于示例文档,具体内容可以参考模板附带 |
| 260 |
% \changes{v2.3}{2018/03/30}{[\zhaofeng] Add sample file \file{ithw.tex}} |
| 261 |
% 的 \file{iihw.tex} 和 \file{ithw.tex}。 |
| 262 |
% |
| 263 |
% \lstinputlisting[style=lstStyleLaTeX]{iihw.tex} |
| 264 |
% |
| 265 |
% |
| 266 |
% \subsection{作业选项} |
| 267 |
% \label{sec:option} |
| 268 |
% |
| 269 |
% \DescribeOption{thehwcnt} |
| 270 |
% 指定作业序号, |
| 271 |
% 为可选项。 |
| 272 |
% \begin{latex} |
| 273 |
% % 使用默认序号1 |
| 274 |
% \usepackage{iidef} |
| 275 |
% |
| 276 |
% % 指定序号为6 |
| 277 |
% \usepackage[thehwcnt=6]{iidef} |
| 278 |
% \end{latex} |
| 279 |
% |
| 280 |
% \subsection{基本信息}\label{sec:basic_info} |
| 281 |
% \DescribeMacro{\thecourseinstitute} |
| 282 |
% 指定学校或学院,如果使用中文,请引用\pkg{ctex} 宏包。 |
| 283 |
% \begin{latex} |
| 284 |
% % 指定学院是TBSI |
| 285 |
% \thecourseinstitute{Tsinghua-Berkeley Shenzhen Institute} |
| 286 |
% |
| 287 |
% % 指定中文名 |
| 288 |
% \thecourseinstitute{清华大学电子工程系} |
| 289 |
% \end{latex} |
| 290 |
% |
| 291 |
% \DescribeMacro{\thecoursename} |
| 292 |
% 指定课程名 |
| 293 |
% \begin{latex} |
| 294 |
% % 指定课程名是 Information Inference |
| 295 |
% \thecoursename{Information Inference} |
| 296 |
% % 指定课程名是 "应用信息论" |
| 297 |
% \thecoursename{应用信息论} |
| 298 |
% \end{latex} |
| 299 |
% |
| 300 |
% \DescribeMacro{\theterm} |
| 301 |
% 指定学期 |
| 302 |
% \begin{latex} |
| 303 |
% % English example |
| 304 |
% \theterm{Fall 2017} |
| 305 |
% % 中文示例 |
| 306 |
% \theterm{2018年春季学期} |
| 307 |
% \end{latex} |
| 308 |
% |
| 309 |
% \DescribeMacro{\hwname} |
| 310 |
% 指定作业名,默认是 Homework |
| 311 |
% \begin{latex} |
| 312 |
% % English example |
| 313 |
% \hwname{Coursework} |
| 314 |
% % 中文示例 |
| 315 |
% \hwname{作业} |
| 316 |
% \end{latex} |
| 317 |
% |
| 318 |
% \subsection{标题} |
| 319 |
% \DescribeMacro{\courseheader} |
| 320 |
% 将其放在正文前面生成作业标题 |
| 321 |
% |
| 322 |
% \note[提示:]{使用 \cs{courseheader} 前需使用~\ref{sec:basic_info}节描述的宏指定相关基本信息。并且使用了\cs{courseheader}无需再用 \LaTeX\ 里的\cs{maketitle}} |
| 323 |
% \begin{latex} |
| 324 |
% \begin{document} |
| 325 |
% \courseheader |
| 326 |
% \name{YOUR NAME} |
| 327 |
% \end{latex} |
| 328 |
% \DescribeMacro{\name} |
| 329 |
%^^A manually indentation |
| 330 |
% \indent 生成姓名、作业名、日期 |
| 331 |
% |
| 332 |
% \note[提示:]{使用 \cs{name} 会直接在文档中输出姓名、作业名、日期,因此如果需要自定义作业名,需要在使用\cs{name} 前用 \cs{hwname} 指定作业名称} |
| 333 |
% \subsection{题目自动编号} |
| 334 |
% 建议使用嵌套的\texttt{enumerate} 环境对题目自动编号,可比较好的解决自动缩进的问题。 |
| 335 |
% 本模板设置了一级列表为作业序号加题目序号,比如第6次作业第3题会排版成 \enspace 6.3.\enspace ,对于某一道题目的不同小问,默认是用(a),(b),(c) 进行 |
| 336 |
% 顺序编排。 |
| 337 |
% \begin{latex} |
| 338 |
% \begin{enumerate} |
| 339 |
% \item First Problem |
| 340 |
% \item Second Problem |
| 341 |
% \begin{enumerate} |
| 342 |
% \item first question of the second problem |
| 343 |
% \item second question of the second problem |
| 344 |
% \end{enumerate} |
| 345 |
% \end{enumerate} |
| 346 |
% \end{latex} |
| 347 |
% |
| 348 |
% 如果需要改变默认的设置,比如不同小问使用罗马数字,则可以在正文开始之前使用 |
| 349 |
% \begin{latex} |
| 350 |
% \setlist[enumerate,2]{label=\roman*.} |
| 351 |
% \end{latex} |
| 352 |
% 进行设置。 |
| 353 |
% |
| 354 |
% \subsection{证明和解的环境} |
| 355 |
% \myentry{证明} |
| 356 |
% \DescribeEnv{proof} |
| 357 |
% \texttt{proof} 环境是 \pkg{amsthm} 宏包提供的,引用本模板后可以直接使用。 |
| 358 |
% \begin{latex} |
| 359 |
% \begin{proof} |
| 360 |
% proof contents go here |
| 361 |
% \end{proof} |
| 362 |
% \end{latex} |
| 363 |
% 在中文作业中,引用\pkg{ctex} 宏包 |
| 364 |
% 后 “证明” 的环境会变成 中文,如果需要改变默认文字,可以在序言中使用 \cs{ctexset} 配置 |
| 365 |
% \begin{latex} |
| 366 |
% \ctexset{ |
| 367 |
% proofname = \heiti{证明} |
| 368 |
% } |
| 369 |
% \begin{document} |
| 370 |
% \end{latex} |
| 371 |
% \myentry{解} |
| 372 |
% \DescribeEnv{solution} |
| 373 |
% \texttt{solution} 环境是本模板提供的,用于回答“求解XXX”之类的问题。 |
| 374 |
% \begin{latex} |
| 375 |
% \begin{solution} |
| 376 |
% solution contents go here |
| 377 |
% \end{solution} |
| 378 |
% \end{latex} |
| 379 |
% \DescribeMacro{slname} |
| 380 |
% 在中文作业中,可能需要将 \texttt{solution} 环境默认的 \textit{solution.} 变成中文,为此可以将 |
| 381 |
% \begin{latex} |
| 382 |
% \slname{\heiti{解}} |
| 383 |
% \end{latex} |
| 384 |
% 放在使用 \texttt{solution} 环境之前。 |
| 385 |
% \subsection{常用数学符号} |
| 386 |
% 本文档预先定义了常用的数学符号,在\file{iihw.tex} 示例文件中对这些符号的使用有详细说明。 |
| 387 |
% \section{致谢} |
| 388 |
% \label{sec:thanks} |
| 389 |
% 感谢师兄徐祥祥的最初的作业模板设计, \textsc{Thu}\-\textsc{Thesis} 宏包的文档源码。 |
| 390 |
% \changes{v2.4}{2018/04/09}{[\zhaofeng] finish the chinese pdf manual} |
| 391 |
% \changes{v2.5}{2018/05/20}{[\zhaofeng] make documentation more compact by including \texttt{dtx-style.sty} in the \texttt{dtx} file itself.} |
| 392 |
% \changes{v2.5.1}{2020/02/23}{[\zhaofeng] remove dtx-style source code from manual} |
| 393 |
% \StopEventually{\PrintChanges\PrintIndex} |
| 394 |
% \clearpage |
| 395 |
% |
| 396 |
% \section{实现细节} |
| 397 |
% |
| 398 |
% \subsection{基本信息} |
| 399 |
% \changes{v2.0}{2018/03/22}{[\zhaofeng] Make it a latex package(.sty)} |
| 400 |
% \begin{macrocode} |
| 401 |
%<*sty> |
| 402 |
\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 403 |
\ProvidesClass{iidef} |
| 404 |
[2020/09/09 2.6 Tsinghua University Coursework Template] |
| 405 |
% \end{macrocode} |
| 406 |
% \subsection{装载宏包} |
| 407 |
% \label{sec:loadpackage} |
| 408 |
% |
| 409 |
% 引用的宏包和相应的定义。 |
| 410 |
% \changes{v2.6}{2020/09/09}{[\zhaofeng] support \texttt{exam} document class} |
| 411 |
% \begin{macrocode} |
| 412 |
%% configuration of nested enumerate env |
| 413 |
\RequirePackage{enumitem} |
| 414 |
%% set hwcount key-value option |
| 415 |
\RequirePackage{kvoptions} |
| 416 |
%% required by macro DeclareMathOperator |
| 417 |
\RequirePackage{amsmath} |
| 418 |
%% Set up page headers using with fancyhdr |
| 419 |
\@ifundefined{lhead}{\RequirePackage{fancyhdr}} |
| 420 |
{\def\@thulhead{thulhead}} |
| 421 |
%define the solution env with amsthm proof |
| 422 |
\RequirePackage{amsthm} |
| 423 |
% \end{macrocode} |
| 424 |
% |
| 425 |
% 定义学期、学院、课程名,作业名 |
| 426 |
% \changes{v2.3}{2018/03/30}{[\zhaofeng] User configuration of \cs{hwname}} |
| 427 |
% \begin{macrocode} |
| 428 |
%% semester |
| 429 |
\def\@term{term} |
| 430 |
\newcommand{\theterm}[1]{\renewcommand\@term{#1}} |
| 431 |
%% institute |
| 432 |
\newcommand{\@courseinstitute}[1]{institute} |
| 433 |
\newcommand{\thecourseinstitute}[1]{\renewcommand\@courseinstitute{#1}} |
| 434 |
%% coursename |
| 435 |
\newcommand{\@coursename}[1]{coursename} |
| 436 |
\newcommand{\thecoursename}[1]{\renewcommand\@coursename{\textsc{#1}}} |
| 437 |
%% user can rewrite homework name |
| 438 |
\def\@hwname{Homework} |
| 439 |
\def\hwname#1{\renewcommand\@hwname{#1}} |
| 440 |
% \end{macrocode} |
| 441 |
% \subsection{作业选项} |
| 442 |
% \changes{v2.1}{2018/03/22}{[\zhaofeng] Use kvoptions to set the coursework counter.} |
| 443 |
% \begin{macrocode} |
| 444 |
%% \iidef@thehwcnt = 1 |
| 445 |
\DeclareStringOption[1]{thehwcnt} |
| 446 |
\ProcessKeyvalOptions* |
| 447 |
\def\thehwcnt{\iidef@thehwcnt} |
| 448 |
% \end{macrocode} |
| 449 |
% \subsection{标题} |
| 450 |
% 定义 \cs{courseheader} |
| 451 |
% \changes{v2.2}{2018/03/27}{[\zhaofeng] Use fancyhdr to set the coursework user file header.} |
| 452 |
% \begin{macrocode} |
| 453 |
%% page header setup, distinguish between first page(plain style) |
| 454 |
%% and second page on (runningpage style) |
| 455 |
%%*************************************************************************** |
| 456 |
\newcommand{\courseheader}{ |
| 457 |
\thispagestyle{plain}%first page use native plain style to suppress header |
| 458 |
\vspace*{-1in} |
| 459 |
\begin{center} |
| 460 |
\@courseinstitute\\ |
| 461 |
\@coursename\\ |
| 462 |
\@term |
| 463 |
\vspace*{0.1in} |
| 464 |
\hrule |
| 465 |
\end{center} |
| 466 |
\begin{center} |
| 467 |
\underline{\bf \@hwname\;\thehwcnt} \\ |
| 468 |
\end{center} |
| 469 |
} |
| 470 |
\@ifundefined{@thulhead}{ |
| 471 |
\fancypagestyle{runningpage} |
| 472 |
{ |
| 473 |
\fancyhead[L]{\small\@coursename} |
| 474 |
\fancyhead[R]{\small\@courseinstitute} |
| 475 |
} |
| 476 |
%% use runningpage style from second page on |
| 477 |
\pagestyle{runningpage} |
| 478 |
}{} |
| 479 |
%% ********************************************************************************************* |
| 480 |
% \end{macrocode} |
| 481 |
% |
| 482 |
% 定义 \cs{name} |
| 483 |
% \begin{macrocode} |
| 484 |
%%name command macro |
| 485 |
%%************************* |
| 486 |
\newcommand{\name}[1]{ |
| 487 |
\begin{flushleft} |
| 488 |
#1\hfill |
| 489 |
\today |
| 490 |
\end{flushleft} |
| 491 |
\hrule |
| 492 |
|
| 493 |
\vspace{2em} |
| 494 |
|
| 495 |
\flushleft |
| 496 |
} |
| 497 |
%%************************* |
| 498 |
% \end{macrocode} |
| 499 |
% \subsection{题目自动编号} |
| 500 |
% \begin{macrocode} |
| 501 |
%% enumitem related configuration |
| 502 |
\setlist[enumerate,1]{label=\thehwcnt.\arabic*.} |
| 503 |
\setlist[enumerate,2]{label=(\alph*)} |
| 504 |
\setlist[enumerate,3]{label=\roman*.} |
| 505 |
\setlist[enumerate,4]{label=\greek*} |
| 506 |
% \end{macrocode} |
| 507 |
% \subsection{解的环境} |
| 508 |
% \changes{v2.3}{2018/03/30}{[\zhaofeng] Add \texttt{solution} environment} |
| 509 |
% \changes{v2.3}{2018/03/30}{[\zhaofeng] user configuration of \texttt{solution} environment name} |
| 510 |
% 包装 \pkg{amsthm} 的 \cs{proof},可以通过 \cs{slname} 对默认”解“的文字进行修改。 |
| 511 |
% \begin{macrocode} |
| 512 |
%%****************************** |
| 513 |
\def\@slname{Solution} |
| 514 |
\def\slname#1{\renewcommand\@slname{#1}} |
| 515 |
|
| 516 |
\@ifundefined{solution}{ |
| 517 |
\newenvironment{solution} |
| 518 |
{ |
| 519 |
\proof[\@slname] |
| 520 |
} |
| 521 |
{ |
| 522 |
%% no qed symbol in solution env |
| 523 |
\renewcommand{\qedsymbol}{} |
| 524 |
\endproof |
| 525 |
} |
| 526 |
}{} |
| 527 |
%%****************************** |
| 528 |
% \end{macrocode} |
| 529 |
% \subsection{常用数学符号} |
| 530 |
% \begin{macrocode} |
| 531 |
%%common math symbols go here |
| 532 |
%%************************************************* |
| 533 |
\def\v#1{\underline{#1}} |
| 534 |
\newcommand{\uc}{\underline{c}} % c, vec |
| 535 |
\newcommand{\uv}{\underline{v}} % x, vec |
| 536 |
\newcommand{\uw}{\underline{w}} % w, vec |
| 537 |
\newcommand{\ux}{\underline{x}} % x, vec |
| 538 |
\newcommand{\uy}{\underline{y}} % y, vec |
| 539 |
\newcommand{\uz}{\underline{z}} % z, vec |
| 540 |
\newcommand{\um}{\underline{m}} % m, vec |
| 541 |
\newcommand{\rvx}{\mathsf{x}} % x, r.v. |
| 542 |
\newcommand{\rvy}{\mathsf{y}} % y, r.v. |
| 543 |
\newcommand{\rvz}{\mathsf{z}} % z, r.v. |
| 544 |
\newcommand{\rvw}{\mathsf{w}} % w, r.v. |
| 545 |
\newcommand{\rvH}{\mathsf{H}} % H, r.v. |
| 546 |
\newcommand{\urvx}{\underline{\mathsf{x}}} % x, r.v. vec |
| 547 |
\newcommand{\urvy}{\underline{\mathsf{y}}} % y, r.v. vec |
| 548 |
\newcommand{\urvz}{\underline{\mathsf{z}}} % z, r.v. vec |
| 549 |
\newcommand{\urvw}{\underline{\mathsf{w}}} % w, r.v. vec |
| 550 |
|
| 551 |
\newcommand{\defas}{\triangleq} %\coloneqq |
| 552 |
\newcommand{\reals}{\mathbb{R}} |
| 553 |
\newcommand{\TT}{\mathrm{T}} % transpose |
| 554 |
\DeclareMathOperator*{\argmax}{arg\,max} |
| 555 |
\DeclareMathOperator*{\argmin}{arg\,min} |
| 556 |
\DeclareMathOperator*{\argsup}{arg\,sup} |
| 557 |
\DeclareMathOperator*{\arginf}{arg\,inf} |
| 558 |
\DeclareMathOperator{\diag}{diag} |
| 559 |
\DeclareMathOperator{\Var}{Var} |
| 560 |
\DeclareMathOperator{\Cov}{Cov} |
| 561 |
\DeclareMathOperator{\MSE}{MSE} |
| 562 |
\DeclareMathOperator{\1}{\mathds{1}} |
| 563 |
\DeclareMathOperator{\In}{\mathbb{I}} |
| 564 |
\DeclareMathOperator{\E}{\mathbb{E}} |
| 565 |
\DeclareMathOperator{\Prob}{\mathbb{P}} |
| 566 |
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}} |
| 567 |
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}} |
| 568 |
%%************************************************************************************ |
| 569 |
%</sty> |
| 570 |
% \end{macrocode} |
| 571 |
% \iffalse |
| 572 |
% \begin{macrocode} |
| 573 |
%<*dtx-style> |
| 574 |
\ProvidesPackage{dtx-style} |
| 575 |
\RequirePackage{hypdoc} |
| 576 |
\RequirePackage[UTF8,scheme=chinese]{ctex} |
| 577 |
\RequirePackage{newpxtext} |
| 578 |
\RequirePackage{newpxmath} |
| 579 |
\RequirePackage[ |
| 580 |
top=2.5cm, bottom=2.5cm, |
| 581 |
left=4cm, right=2cm, |
| 582 |
headsep=3mm]{geometry} |
| 583 |
\RequirePackage{array,longtable,booktabs} |
| 584 |
\RequirePackage{listings} |
| 585 |
\RequirePackage{fancyhdr} |
| 586 |
\RequirePackage{xcolor} |
| 587 |
\RequirePackage{enumitem} |
| 588 |
\RequirePackage{etoolbox} |
| 589 |
\RequirePackage{metalogo} |
| 590 |
|
| 591 |
\colorlet{thu@macro}{blue!60!black} |
| 592 |
\colorlet{thu@env}{blue!70!black} |
| 593 |
\colorlet{thu@option}{purple} |
| 594 |
\patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{} |
| 595 |
\patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{} |
| 596 |
\patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{} |
| 597 |
\patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{} |
| 598 |
|
| 599 |
\def\DescribeOption{% |
| 600 |
\leavevmode\@bsphack\begingroup\MakePrivateLetters% |
| 601 |
\Describe@Option} |
| 602 |
\def\Describe@Option#1{\endgroup |
| 603 |
\marginpar{\raggedleft\PrintDescribeOption{#1}}% |
| 604 |
\thu@special@index{option}{#1}\@esphack\ignorespaces} |
| 605 |
\def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{thu@option} #1\ } |
| 606 |
\def\thu@special@index#1#2{\@bsphack |
| 607 |
\begingroup |
| 608 |
\HD@target |
| 609 |
\let\HDorg@encapchar\encapchar |
| 610 |
\edef\encapchar usage{% |
| 611 |
\HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% |
| 612 |
}% |
| 613 |
\index{#2\actualchar{\string\ttfamily\space#2} |
| 614 |
(#1)\encapchar usage}% |
| 615 |
\index{#1:\levelchar#2\actualchar |
| 616 |
{\string\ttfamily\space#2}\encapchar usage}% |
| 617 |
\endgroup |
| 618 |
\@esphack} |
| 619 |
|
| 620 |
\lstdefinestyle{lstStyleBase}{% |
| 621 |
basicstyle=\small\ttfamily, |
| 622 |
aboveskip=\medskipamount, |
| 623 |
belowskip=\medskipamount, |
| 624 |
lineskip=0pt, |
| 625 |
boxpos=c, |
| 626 |
showlines=false, |
| 627 |
extendedchars=true, |
| 628 |
upquote=true, |
| 629 |
tabsize=2, |
| 630 |
showtabs=false, |
| 631 |
showspaces=false, |
| 632 |
showstringspaces=false, |
| 633 |
numbers=none, |
| 634 |
linewidth=\linewidth, |
| 635 |
xleftmargin=4pt, |
| 636 |
xrightmargin=0pt, |
| 637 |
resetmargins=false, |
| 638 |
breaklines=true, |
| 639 |
breakatwhitespace=false, |
| 640 |
breakindent=0pt, |
| 641 |
breakautoindent=true, |
| 642 |
columns=flexible, |
| 643 |
keepspaces=true, |
| 644 |
gobble=2, |
| 645 |
framesep=3pt, |
| 646 |
rulesep=1pt, |
| 647 |
framerule=1pt, |
| 648 |
backgroundcolor=\color{gray!5}, |
| 649 |
stringstyle=\color{green!40!black!100}, |
| 650 |
keywordstyle=\bfseries\color{blue!50!black}, |
| 651 |
commentstyle=\slshape\color{black!60}} |
| 652 |
|
| 653 |
\lstdefinestyle{lstStyleShell}{% |
| 654 |
style=lstStyleBase, |
| 655 |
frame=l, |
| 656 |
rulecolor=\color{purple}, |
| 657 |
language=bash} |
| 658 |
|
| 659 |
\lstdefinestyle{lstStyleLaTeX}{% |
| 660 |
style=lstStyleBase, |
| 661 |
frame=l, |
| 662 |
rulecolor=\color{violet}, |
| 663 |
language=[LaTeX]TeX} |
| 664 |
|
| 665 |
\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{} |
| 666 |
\lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{} |
| 667 |
|
| 668 |
\setlist{nosep} |
| 669 |
|
| 670 |
\DeclareDocumentCommand{\option}{m}{\textsf{#1}} |
| 671 |
\DeclareDocumentCommand{\env}{m}{\texttt{#1}} |
| 672 |
\DeclareDocumentCommand{\pkg}{s m}{% |
| 673 |
\texttt{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}} |
| 674 |
\DeclareDocumentCommand{\file}{s m}{% |
| 675 |
\texttt{#2}\IfBooleanF#1{\thu@special@index{file}{#2}}} |
| 676 |
\newcommand{\myentry}[1]{% |
| 677 |
\marginpar{\raggedleft\color{purple}\bfseries\strut #1}} |
| 678 |
\newcommand{\note}[2][Note]{{% |
| 679 |
\color{magenta}{\bfseries #1}\emph{#2}}} |
| 680 |
|
| 681 |
\def\thucoursework{\textsc{Thu}\-\textsc{Coursework}} |
| 682 |
\endinput |
| 683 |
%</dtx-style> |
| 684 |
% \end{macrocode} |
| 685 |
% \fi |
| 686 |
% \Finale |
| 687 |
% |
| 688 |
\endinput |