加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lessonplan.cls 12.04 KB
一键复制 编辑 原始数据 按行查看 历史
wangxu 提交于 2022-03-07 09:03 . init commit
% !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{lessonplan}[2021/11/01 4.0 NUDT lesson plan Template for teachers -- TeX Live 2019 version, author-wangxu]
\newif\iflib\libfalse
\DeclareOption{forlib}{\libtrue}
\newif\ifprint\printfalse
\DeclareOption{forprint}{\printtrue}
\ProcessOptions
\LoadClass[12pt, a4paper]{article}
\RequirePackage{paracol,lipsum}
\RequirePackage{xcolor}
\RequirePackage{eso-pic,calc}
\RequirePackage{pgfmath}
\RequirePackage{tikz}
\RequirePackage{section}
\RequirePackage{graphicx}
\RequirePackage{framed}
\RequirePackage[UTF8]{ctex}
\RequirePackage{ifthen}%这个宏包提供逻辑判断命令
\RequirePackage{fancyhdr}
\RequirePackage{geometry}
\RequirePackage{tabularx}
\RequirePackage{chngpage}
\RequirePackage{lastpage} %总页数
\RequirePackage{amsmath,amssymb}% AMSLaTeX宏包.
\RequirePackage[amsmath,thmmarks]{ntheorem}
\RequirePackage{graphicx} % 图形
\RequirePackage{color} %支持彩色
\RequirePackage{cite} % 参考文献引用, 得到形如 [3-7] 的样式.
\RequirePackage{url}
\RequirePackage{enumerate}
\RequirePackage[newparttoc]{titlesec}
\RequirePackage{titletoc}
\geometry{a4paper,left=20mm,right=20mm,top=27mm,bottom=27mm}
\newcommand{\fmarginleft}{20mm}
\newcommand{\fmarginright}{20.15mm}
\newcommand{\fmargintop}{25mm}
\newcommand{\fmarginbottom}{25mm}
\newcommand{\fleftwidth}{127.42mm}
%\newcommand{\fleftwidth}{\paperwidth-\fmarginleft-\fmarginright-\fleftwidth}
\newcommand{\framethickness}{2pt}
\newcommand\myhline{%
\parbox[b][10pt]{\paperwidth}{%
\begin{tikzpicture}[scale=1]
\draw[color=black][line width=1pt] (0, 8mm)--(0, 0)--(\paperwidth - \fmarginleft - \fmarginright, 0)--(\paperwidth - \fmarginleft - \fmarginright, 8mm);
\end{tikzpicture}
}
}
\newcommand\headline{%
\AddToShipoutPictureBG*{
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\begin{tikzpicture}[scale=1]
\draw[color=black][line width=0.4pt] (0, \paperheight-\fmarginbottom-\fmargintop-150mm)--(0, \paperheight-\fmarginbottom-\fmargintop)--(\paperwidth - \fmarginleft - \fmarginright, \paperheight-\fmarginbottom-\fmargintop)--(\paperwidth - \fmarginleft - \fmarginright, \paperheight-\fmarginbottom-\fmargintop-150mm);
\draw[color=black][line width=0.4pt] (\fleftwidth, \paperheight-\fmarginbottom-\fmargintop-150mm)--(\fleftwidth, \paperheight-\fmarginbottom-\fmargintop);
\draw[color=white] (-\fmarginleft,-\fmarginbottom) -- (0, 0);
\end{tikzpicture}
}
}
}
}
\newcommand\bottomline{%
\AddToShipoutPictureBG*{
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\begin{tikzpicture}[scale=1]
\draw[color=white] (-\fmarginleft,-\fmarginbottom) -- (0, 0);
\draw[color=black][line width=0.4pt] (0, 10mm)--(0, 0)--(\paperwidth - \fmarginleft - \fmarginright, 0)--(\paperwidth - \fmarginleft - \fmarginright, 10mm);
\draw[color=black][line width=0.4pt] (\fleftwidth, 10mm)--(\fleftwidth, 0mm);
\end{tikzpicture}
}
}
}
}
%首页的外线框
\newcommand{\titleheight}{36pt}
\newcommand\frameblockfirstpage{%
\AddToShipoutPictureBG*{
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\begin{tikzpicture}[scale=1]
\draw[color=white] (-\fmarginleft,-\fmarginbottom) -- (0, 0);
\draw[color=black][line width=\framethickness] (0, \paperheight-\fmarginbottom-\fmargintop-\titleheight)--(0, 0)--(\paperwidth - \fmarginleft - \fmarginright, 0)--(\paperwidth - \fmarginleft - \fmarginright, \paperheight-\fmarginbottom-\fmargintop-\titleheight)--(-1pt, \paperheight-\fmarginbottom-\fmargintop-\titleheight);
\draw[color=black][line width=0.4pt] (\fleftwidth, 10mm)--(\fleftwidth, 0mm);
\end{tikzpicture}
}
}
}
}
%外线框 除去首页和最后一页
\newcommand\fullframeblock{%
\AddToShipoutPictureBG*{
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\begin{tikzpicture}[scale=1]
\draw[color=white] (-\fmarginleft,-\fmarginbottom) -- (0, 0);
\draw[color=black][line width=\framethickness] (0, \paperheight-\fmarginbottom-\fmargintop)--(0, 0)--(\paperwidth - \fmarginleft - \fmarginright, 0)--(\paperwidth - \fmarginleft - \fmarginright, \paperheight-\fmarginbottom-\fmargintop)--(-1pt, \paperheight-\fmarginbottom-\fmargintop);
\draw[color=black][line width=0.4pt] (\fleftwidth, 10mm)--(\fleftwidth, 0mm);
\draw[color=black][line width=0.4pt] (\fleftwidth, \paperheight-\fmarginbottom-\fmargintop-10mm)--(\fleftwidth, \paperheight-\fmarginbottom-\fmargintop);
\end{tikzpicture}
}
}
}
}
\newcommand\frameblocklastpage[3]{%
\AddToShipoutPictureBG*{
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\begin{tikzpicture}[scale=1]
\draw[color=white] (-\fmarginleft,-\fmarginbottom) -- (0, 0);
\draw[color=black][line width=\framethickness] (0, \paperheight-\fmarginbottom-\fmargintop)--(0, #1)--(\paperwidth - \fmarginleft - \fmarginright, #1)--(\paperwidth - \fmarginleft - \fmarginright, \paperheight-\fmarginbottom-\fmargintop)--(-1pt, \paperheight-\fmarginbottom-\fmargintop);
\end{tikzpicture}
}
}
}
}
\newboolean{first}%定义一个布尔变量用于判断是否为首页
\setboolean{first}{true}%设定fist变量初值为true
%正文页眉页脚设定
\pagestyle{fancy}
\fancyhf{}
\lhead{} \chead{} \rhead{}
\lfoot{} \cfoot{-~\thepage~-} \rfoot{}
%首页页眉页脚设定
\fancypagestyle{plain}{%
\setboolean{first}{false}%在plain样式的定义中将first重置为false
\lhead{} \chead{} \rhead{}
\lfoot{} \cfoot{-~\thepage~-} \rfoot{}
}
\fancypagestyle{name}{style}
\newcommand{\makefirstpageheadrule}{%定义首页页眉线绘制命令,这里为等宽双线
\makebox[0pt][l]{\rule[0.55\baselineskip]{\headwidth}{0.4pt}}%
\rule[0.7\baselineskip]{\headwidth}{0.4pt}}
\newcommand{\makeheadrule}{%定义正文页页眉线绘制命令,单线
\rule[-8.2mm]{\headwidth}{0.4pt}}
\newcommand{\makefootrule}{%定义正文页页脚线绘制命令,单线
\rule[10mm]{\headwidth}{0.4pt}}
\renewcommand{\headrule}{%重定义headrule命令
\ifthenelse{\boolean{first}}{\ifthenelse{\equal{\thepage}{\pageref{LastPage}}}{}{\fullframeblock}}{\frameblockfirstpage}%
}%根据布尔变量first为true或false分别执行不同的页眉线绘制命令
%\renewcommand{\footrule}{%重定义headrule命令
% \ifthenelse{\equal{\thepage}{\pageref{LastPage}}}{}{\fullframeblock}
%}%根据布尔变量first为true或false分别执行不同的页眉线绘制命令
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
\newcommand{\headcolwidth}{0.97}
\newcommand{\weekth}{11} %第几周
\newcommand{\week}{} %星期几
\newcommand{\classsec}{1} %第几节
\newcommand{\classtimes}{1} %课次
\newcommand{\techmode}{1} %授课方式
\newcommand{\classlong}{40分钟} %课时安排
\newcommand{\classtitle}{题目} %授课题目
\newcommand{\makehead}[7]{
\renewcommand{\weekth}{#1} %第几周
\renewcommand{\week}{#2} %星期几
\renewcommand{\classsec}{#3} %第几节
\renewcommand{\classtimes}{#4} %课次
\renewcommand{\techmode}{#5} %授课方式
\renewcommand{\classlong}{#6} %课时安排
\renewcommand{\classtitle}{#7} %授课题目
}
%\titlecontents{section}[4.1em]{\sffamily\bfseries}{\contentslabel{2.1em}}
\newenvironment{plancontent}
{\begin{paracol}{2}\begin{leftcolumnplan}\vspace{10pt}}
{\end{leftcolumnplan}\end{paracol}}
%设置小结标题
\titleformat{\section}[block]{\heiti}{\chinese{section}}{0em}{}[\vspace{-10pt}] %{sep}{before-code}[after-code]
\titleformat{\subsection}[block]{\songti\bfseries}{\chinese{subsection}}{0.2em}{} %{sep}{before-code}[after-code]
\titleformat{\subsubsection}[block]{\songti\bfseries}{~~\arabic{subsubsection}.}{0.2em}{}
\titlespacing{\subsection}{15pt}{0pt}{0pt}
\titlespacing{\subsubsection}{15pt}{0pt}{0pt}
\newcommand{\topsection}[1]{\noindent{\kaishu 【#1】 }}
\newcommand{\dingyi}[2]{{\kaishu 定义(#1)~~#2}}
%{sep}{before-code}[after-code]
%----------------------- Theorems -----------------------------------
\theoremstyle{plain}
\theoremheaderfont{\heiti}
\theorembodyfont{\songti} \theoremindent0em
\theorempreskip{0pt}
\theorempostskip{0pt}
%\theoremseparator{\hspace{1em}}
\theoremnumbering{arabic}
%\theoremsymbol{} %定理结束时自动添加的标志
\newtheorem{theorem}{\hspace{2em}定理}[section]
\newtheorem{definition}{\hspace{2em}定义}[section]
\newtheorem{lemma}{\hspace{2em}引理}[section]
\newtheorem{corollary}{\hspace{2em}推论}[section]
\newtheorem{proposition}{\hspace{2em}性质}[section]
\newtheorem{example}{\hspace{2em}}[section]
\newtheorem{remark}{\hspace{2em}}[section]
\theoremstyle{nonumberplain}
\theoremheaderfont{\heiti}
\theorembodyfont{\normalfont \rm \songti}
\theoremindent0em \theoremseparator{\hspace{1em}}
\theoremsymbol{$\square$}
\newtheorem{proof}{\hspace{2em}证明}
%
%%%%--- Publications -------------------------------
%\newenvironment{publications}[1]
%{\renewcommand\bibname{}\begin{thebibliography}{#1}}
% {\end{thebibliography}}
%
%%%%--- \upcite ----------------------------------------
%\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}} %自定义新命令\upcite, 使参考文献引用以上标出现
%
%%%%%%%%--判断是否需要彩色链接-----------------------------
%\iflib
%\hypersetup{allcolors=black}
%\else
%\fi
%%%%%%%%-------------------------------------------------
%%%%%%%%--判断是否需要彩色链接-----------------------------
%\ifprint
%\hypersetup{allcolors=black}
%\else
%\fi
%%%%%%%%-------------------------------------------------
%%%%=== suppress extra inter-line spacing in \list environments
%\makeatletter \setlength\partopsep{0pt}
%\def\@listI{\leftmargin\leftmargini
% \parsep 0pt
% \topsep \parsep
% \itemsep \parsep}
%\@listI
%\def\@listii {\leftmargin\leftmarginii
% \labelwidth\leftmarginii
% \advance\labelwidth-\labelsep
% \parsep \z@ \@plus\z@ \@minus\z@
% \topsep \parsep
% \itemsep \parsep}
%\def\@listiii{\leftmargin\leftmarginiii
% \labelwidth\leftmarginiii
% \advance\labelwidth-\labelsep
% \parsep \z@ \@plus\z@ \@minus\z@
% \topsep \parsep
% \itemsep \parsep}
%\def\@listiv{\leftmargin\leftmarginiv
% \labelwidth\leftmarginiv
% \advance\labelwidth-\labelsep
% \parsep \z@ \@plus\z@ \@minus\z@
% \topsep \parsep
% \itemsep \parsep}
%\def\@listv{\leftmargin\leftmarginv
% \labelwidth\leftmarginv
% \advance\labelwidth-\labelsep
% \parsep \z@ \@plus\z@ \@minus\z@
% \topsep \parsep
% \itemsep \parsep}
%\def\@listvi{\leftmargin\leftmarginvi
% \labelwidth\leftmarginvi
% \advance\labelwidth-\labelsep
% \parsep \z@ \@plus\z@ \@minus\z@
% \topsep \parsep
% \itemsep \parsep}
%%
%% Change default margins for \list environments
%\setlength\leftmargini {2\ccwd} \setlength\leftmarginii
%{\leftmargini} \setlength\leftmarginiii {\leftmargini}
%\setlength\leftmarginiv {\leftmargini} \setlength\leftmarginv
%{\ccwd} \setlength\leftmarginvi {\ccwd} \setlength\leftmargin
%{\leftmargini} \setlength\labelsep {.5\ccwd}
%\setlength\labelwidth {\leftmargini}
%%
%\setlength\listparindent{2\ccwd}
%% Change \listparindent to 2\ccwd in \list
%\def\list#1#2{\ifnum \@listdepth >5\relax \@toodeep
% \else \global\advance\@listdepth\@ne \fi
% \rightmargin \z@ \listparindent2\ccwd \itemindent \z@
% \csname @list\romannumeral\the\@listdepth\endcsname
% \def\@itemlabel{#1}\let\makelabel\@mklab \@nmbrlistfalse #2\relax
% \@trivlist
% \parskip\parsep \parindent\listparindent
% \advance\linewidth -\rightmargin \advance\linewidth -\leftmargin
% \advance\@totalleftmargin \leftmargin
% \parshape \@ne \@totalleftmargin \linewidth
% \ignorespaces}
%
%\makeatother
%%% ---- 章节标题设置 ----- %%%%
%\CTEXsetup[nameformat={\zihao{-2}\bfseries\raggedright},titleformat={\zihao{-2}\bfseries\raggedright},%
%number={\arabic{chapter}},name={,},afterskip={30pt},beforeskip={20pt}]{chapter}
%\CTEXsetup[format+={\zihao{3}\raggedright}]{section}
%\CTEXsetup[format+={\zihao{4}\raggedright}]{subsection}
%\CTEXsetup[format={\zihao{-4}\kaishu\raggedright}]{subsubsection}
%\CTEXoptions[bibname={\large 参考文献}]
%\setcounter{tocdepth}{4}
%\setcounter{secnumdepth}{4}
%\RequirePackage[font=small,textfont=it]{caption}
%%%=== 图片路径=== %%%
\graphicspath{{figures/}} % 图片放在 figures 文件夹.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化