From cee1b7f2580148a33ae6cc0631c56c7e35ce0bff Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 8 Nov 2019 21:40:58 +0000 Subject: jnuexam (8nov19) git-svn-id: svn://tug.org/texlive/trunk@52696 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls | 178 ++++++++++++++++++------ 1 file changed, 139 insertions(+), 39 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls b/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls index e839799d0e8..84e36954a50 100644 --- a/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls +++ b/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls @@ -6,18 +6,22 @@ % ---------------------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{jnuexam}[2018/11/21 v0.5 An exam class for Jinan University] +\ProvidesClass{jnuexam}[2019/11/08 v0.7 An exam class for Jinan University] \newif\ifsidebyside \sidebysidefalse % 是否 A3 纸张 \newif\ifreverse \reversefalse % 是否逆序出题 \newif\ifanswer \answertrue % 是否显示答案 +\newif\ifamsfonts \amsfontsfalse % 切换数学字体 \newif\ifsourcehan \sourcehanfalse % 切换思源字体 +\newif\ifdisplay \displayfalse % 切换展示公式 \newif\ifcollection \collectionfalse % 用于试卷题库 \DeclareOption{a3paper}{\sidebysidetrue} \DeclareOption{reverse}{\reversetrue} \DeclareOption{noanswer}{\answerfalse} +\DeclareOption{amsfonts}{\amsfontstrue} \DeclareOption{sourcehan}{\sourcehantrue} +\DeclareOption{display}{\displaytrue} \DeclareOption{collection}{\collectiontrue} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexart}} %其它选项 @@ -28,14 +32,22 @@ % 14bp 12bp 10.5bp 9bp \LoadClass[cs4size,UTF8,noindent]{ctexart} +\ifamsfonts + \RequirePackage{amssymb} +\else + \RequirePackage[utopia]{mathdesign} % charter, utopia + \renewcommand\bfdefault{bx} + \let\oldoiint\oiint\renewcommand{\oiint}{\oldoiint\nolimits} + \DeclareTextCommandDefault{\nobreakspace}{\leavevmode\nobreak\ } +\fi + \ifsidebyside \RequirePackage[a3paper,landscape,twocolumn,columnsep=40mm,left=50mm,right=30mm,top=25mm,bottom=25mm]{geometry} \else \RequirePackage[a4paper,left=30mm,right=30mm,top=25mm,bottom=25mm]{geometry} \fi -\RequirePackage{tabu} -\RequirePackage{amssymb} +\RequirePackage{tabularx} \RequirePackage{lastpage} \RequirePackage{fancyhdr} \RequirePackage{xcolor} @@ -44,9 +56,12 @@ \RequirePackage{etoolbox} \RequirePackage{calc} +\newcolumntype{Y}{>{\centering\arraybackslash}X} +\newcolumntype{n}[1]{>{\centering\arraybackslash}m{#1}} + \setlength{\parindent}{0em} -\setlength{\lineskiplimit}{3pt} -\setlength{\lineskip}{3pt} +\setlength{\lineskiplimit}{4pt} +\setlength{\lineskip}{4pt} %% --------------------------------------------------------------------------- %% 密封线命令 \mifengxian @@ -116,10 +131,10 @@ \newcommand{\head@table@a}{% \begin{tabular}{l} - \underbox{11em}{\niandu}学年度第\underbox{5.5em}{\xueqi}学期 \\ - 课程名称:\underbox{17.5em}{\kecheng\ifx\zhuanye\my@empty\else\kern0pt(\zhuanye)\fi} \\ - 授课教师:\underparbox{17.5em}{\centering\rule{0pt}{3ex}\jiaoshi} \\ - 考试时间:\underbox{17.5em}{\shijian} \\ + \underbox{11\ccwd}{\niandu}学年度第\underbox{5.5\ccwd}{\xueqi}学期 \\ + 课程名称:\underbox{17.5\ccwd}{\kecheng\ifx\zhuanye\my@empty\else\kern0pt(\zhuanye)\fi} \\ + 授课教师:\underparbox{17.5\ccwd}{\centering\rule{0pt}{3ex}\jiaoshi} \\ + 考试时间:\underbox{17.5\ccwd}{\shijian} \\ \end{tabular} } @@ -136,9 +151,9 @@ \newcommand{\head@table@c}{% \begin{tabular}{l} - \underspace{10em}学院\underspace{8em}专业\underspace{7.5em}班\kern0pt(\kern0pt{}级\kern0pt) \\[1em] - 姓名\underspace{8em}学号\underspace{10em}\hfill - \bfseries 内招~[\ischeck{\neizhao}] 外招~[\ischeck{\waizhao}] %\\[0.8em] + \underspace{10\ccwd}学院\underspace{8\ccwd}专业\underspace{7.5\ccwd}班\kern0pt(\kern0pt{}级\kern0pt) \\[1em] + 姓名\underspace{8\ccwd}学号\underspace{10\ccwd}\hfill + \bfseries 内招~[\ischeck{\neizhao}]~~外招~[\ischeck{\waizhao}] %\\[0.8em] \end{tabular} } @@ -151,25 +166,25 @@ \ifx\shijuan\my@temp@c\renewcommand{\shijuan}{D}\fi \fi \noindent - \begin{tabu}{|@{}X@{}|} + \begin{tabularx}{\linewidth}{|@{}X@{}|} \hline\renewcommand{\arraystretch}{1.5}% - \begin{tabu}{@{}>{\bfseries}l@{}|@{}X@{}|@{}l@{}} + {\begin{tabularx}{\linewidth}{@{}>{\bfseries}l@{}|@{}X@{}|@{}l@{}} \begin{tabular}{l}教\\ 师\\ 填\\ 写\end{tabular} & \head@table@a & \head@table@b - \end{tabu}\\ + \end{tabularx}}\\ \hline\renewcommand{\arraystretch}{0.9}% - \begin{tabu}{@{}>{\bfseries}l@{}|@{}X@{}} + {\begin{tabularx}{\linewidth}{@{}>{\bfseries}l@{}|@{}X@{}} \begin{tabular}{l}考\\ 生\\ 填\\ 写\end{tabular} & \head@table@c - \end{tabu}\\ + \end{tabularx}}\\ \hline - \end{tabu} - \vspace{1em} - \noindent\begin{tabu}{|*{8}{X[c]|}} + \end{tabularx} + \par\vspace{1em} + \noindent\begin{tabularx}{\linewidth}{|*{8}{Y|}} \hline - \bfseries{题 号} & 一 & 二 & 三 & 四 & 五 & 六 & 总 分\\ + \textbf{题号} & 一 & 二 & 三 & 四 & 五 & 六 & 总分\\ \hline - \bfseries{得 分} & & & & & & & \\ + \parbox[c][2em][c]{2.2em}{\bfseries 得分} & & & & & & & \\ \hline - \end{tabu} + \end{tabularx} } %% --------------------------------------------------------------------------- @@ -218,6 +233,7 @@ \xdef\allproblems{} \xdef\lastproblem{} \newcounter{problem} +\newcommand{\solutionname}{解} \newcounter{choice} % 后面选择题的 abcd 环境要用到 \newcounter{step} % 后面解答题的 \step 命令要用到 @@ -228,14 +244,14 @@ \setcounter{problem}{0}% \stepcounter{section}% \vspace{1em}% - \noindent\begin{tabu}{|X[c]|X[c]|X[6]} + \noindent\begin{tabularx}{\linewidth}{|n{1.7cm}|n{1.7cm}|X} \cline{1-2} 得分 & 评阅人 & \textbf{\Chinese{section}、#1}\\ \cline{1-2} & & (#2) \\ \cline{1-2} - \end{tabu} - \vspace{1em} + \end{tabularx} + \par\vspace{1em} } \newcommand{\makedata}[1]{% @@ -249,11 +265,11 @@ \newenvironment{problemreal}{% \stepcounter{problem}\setcounter{choice}{0}\setcounter{step}{0}% - \textsf{\color{blue}\arabic{problem}}.\;\,\ignorespaces + \textbf{\textsf{{\color{blue}\arabic{problem}}.}}\;\,\ignorespaces }{\par} \newenvironment{solutionreal}{% \setcounter{step}{0}% - \textsf{\color{blue}解答}\quad\ignorepars + \textbf{\textsf{{\color{blue}\solutionname}.}}\;\,\ignorepars }{\par} \let \oldnewpage = \newpage @@ -373,15 +389,16 @@ \newcommand{\answertable}[3][1em]{% 答题须知:本题答案必须写在如下表格中,否则不给分.\par - \begin{tabu}{|c|*{#3}{X[c]|}} + \begin{tabularx}{\linewidth}{|c|*{#3}{Y|}} \hline \answer@lines{#1}{#2}{#3} - \end{tabu}% + \end{tabularx}% \par\vspace{0.8em}% } %% --------------------------------------------------------------------------- %% 答案切换命令 \answer +%% 判断命令 \true 和 \false %% 填空命令 \fillin 和 \fillout %% 选择命令 \pickin 和 \pickout %% 四个选项排版环境 abcd,根据四个选项的长度自动排成一行、两行或四行 @@ -389,11 +406,14 @@ \newcommand{\answer}[1]{\ifanswer#1\else\phantom{#1}\fi} +\newcommand{\cdotfill}{\leavevmode\xleaders\hbox to 0.5em{\hss$\cdot$\hss}\hfill\kern0pt\relax} +\newcommand{\true}{\unskip\nobreak\cdotfill(\makebox[1.5em]{\color{blue}\answer{$\checkmark$}})} +\newcommand{\false}{\unskip\nobreak\cdotfill(\makebox[1.5em]{\color{blue}\answer{\sffamily x}})} + \newcommand{\ulinefill}[1]{\xleaders\hbox{\underline{\vphantom{#1}\kern1pt}}\hfill\kern0pt} \newcommand{\fillout}[1]{\allowbreak\hbox{}\nobreak\ulinefill{#1}\underline{\color{blue}\answer{#1}}\ulinefill{#1}} \newcommand{\fillin}[1]{\underline{\hspace{1em}\color{blue}\answer{#1}\hspace{1em}}} -\newcommand{\cdotfill}{\leavevmode\xleaders\hbox to 0.5em{\hss$\cdot$\hss}\hfill\kern0pt\relax} \newcommand{\pickout}[1]{\unskip\nobreak\cdotfill(\makebox[1.5em]{\color{blue}\answer{#1}})} \newcommand{\pickin}[1]{\unskip\nobreak\hspace{0.3em}(\makebox[1.5em]{\color{blue}\answer{#1}})\hspace{0.3em}\ignorespaces} @@ -431,20 +451,85 @@ \fi } -%\newcommand{\my@item}{\ifnum\value{choice}=0\par\fi\stepcounter{choice}} -%\newcommand{\fullitem}[1]{\my@item\parbox{\linewidth}{(\Alph{choice})\ #1\rule[-0.5em]{0pt}{0.5em}}\hfill\ignorespaces} -%\newcommand{\halfitem}[2][0.5]{\my@item\makebox[#1\linewidth][l]{(\Alph{choice})\ #2}\hfill\ignorespaces} -%\newcommand{\quaritem}[2][0.25]{\my@item\makebox[#1\linewidth][l]{(\Alph{choice})\ #2}\hfill\ignorespaces} - %% --------------------------------------------------------------------------- %% 解答题步骤命令 \step %% --------------------------------------------------------------------------- \newcommand{\step}{% \stepcounter{step}% - \makebox[2em][l]{\ttfamily(\arabic{step})}% + \textsf{(\arabic{step})}\;\,% } +%% --------------------------------------------------------------------------- +%% 自由对齐命令 \tabpoint, \tabto, \tableft +%% 命令 \tabpoint 记录当前的水平位置,也可以简写为 \? +%% 命令 \tabto 跳到之前记录的位置,也可以简写为 \+ +%% 命令 \tableft 跳到之前记录的位置的左侧,也可以简写为 \< +%% 这些自由对齐命令需要编译两次才能生效 +%% --------------------------------------------------------------------------- + +\usepackage{zref-savepos} + +\@ifundefined{zsaveposx}{\let\zsaveposx\zsavepos}{} % 旧版本无 \zsaveposx 命令 + +\newcounter{saveposcnt} +\newcounter{useposcnt} +\renewcommand*{\thesaveposcnt}{savepos\number\value{saveposcnt}} +\renewcommand*{\theuseposcnt}{usepos\number\value{useposcnt}} + +\def\my@alignment@offset{} + +\def\my@alignment@list{} +\forcsvlist{\listadd\my@alignment@list}{=,<,>,\le,\ge,\leq,\geq,\approx} + +\newlength{\my@alignment@kern} + +\newcommand*{\my@alignment@check}[1]{% + \ifx\my@let@token #1% + \def\my@alignment@offset{5}% + \listbreak + \fi +} + +\newcommand{\my@alignment@next}{% + \ifdefempty{\my@alignment@offset}{% + \def\my@alignment@offset{0}% + \forlistloop{\my@alignment@check}{\my@alignment@list}% + }{}% + \settowidth{\my@alignment@kern}{$\mkern\my@alignment@offset mu$}% + \stepcounter{saveposcnt}% + \rlap{\kern\my@alignment@kern\zsaveposx{\thesaveposcnt}}% +} + +\newcommand*{\tabpoint}[1][]{% + \leavevmode + \def\my@alignment@offset{#1}% + \futurelet\my@let@token\my@alignment@next +} +\let \? = \tabpoint + +\newcommand*{\tabto}{% + \stepcounter{useposcnt}% + \zsaveposx{\theuseposcnt}% + \noindent + \hskip\zposx{\thesaveposcnt}sp\relax + \hskip-\zposx{\theuseposcnt}sp\relax + \ignorespaces +} +\let \+ = \tabto + +\newcommand*{\tableft}{% + \settowidth{\my@alignment@kern}{$=\mkern5mu$}% + \stepcounter{useposcnt}% + \zsaveposx{\theuseposcnt}% + \noindent + \hskip\zposx{\thesaveposcnt}sp\relax + \hskip-\zposx{\theuseposcnt}sp\relax + \hskip-\my@alignment@kern + \ignorespaces +} +\let \< = \tableft + %% --------------------------------------------------------------------------- %% 评分命令 \score %% --------------------------------------------------------------------------- @@ -466,6 +551,14 @@ }% } +%% --------------------------------------------------------------------------- +%% 文档选项 display 将全部公式都设为展示公式 +%% 命令 \display 将当前环境的公式都设为展示公式 +%% --------------------------------------------------------------------------- + +\newcommand{\display}{\everymath\expandafter{\the\everymath\displaystyle}} +\ifbool{display}{\display}{} + %% --------------------------------------------------------------------------- %% 载入个人定制文件 jnuexam.cfg %% 中文字体切换选项 sourcehan @@ -526,6 +619,7 @@ \RequirePackage{CJKfntef} \RequirePackage{multirow} \RequirePackage{diagbox} +\RequirePackage{tabu} \RequirePackage{relsize} \newcommand{\Int}{\mathop{\mathlarger{\int}}} @@ -557,9 +651,15 @@ \renewrobustcmd{\d}{\ifbool{mmode}{\diff}{\oldd}}% } -\newcommand{\va}{\vec{a\vphantom{b}}} +% from mathabx package +\DeclareFontFamily{U}{mathx}{\hyphenchar\font45} +\DeclareFontShape{U}{mathx}{m}{n}{<-> mathx10}{} +\DeclareSymbolFont{mathx}{U}{mathx}{m}{n} +\DeclareMathAccent{\widebar}{0}{mathx}{"73} + +\newcommand{\va}{\vec{a}} \newcommand{\vb}{\vec{b}} -\newcommand{\vc}{\vec{c\vphantom{b}}} +\newcommand{\vc}{\vec{c}} \newcommand{\vd}{\vec{d}} \newcommand{\ve}{\vec{e}} \newcommand{\vi}{\vec{i}} -- cgit v1.2.3