From 64afeb0785b8c195ce3b8101a6af740256ab8ffe Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 6 Nov 2020 21:52:25 +0000
Subject: jnuexam (6nov20)

git-svn-id: svn://tug.org/texlive/trunk@56867 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls | 177 ++++++++++++++++++------
 1 file changed, 138 insertions(+), 39 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls')

diff --git a/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls b/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls
index 84e36954a50..bace8c2a698 100644
--- a/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls
+++ b/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls
@@ -6,8 +6,9 @@
 % ----------------------------------------------------------------------------
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{jnuexam}[2019/11/08 v0.7 An exam class for Jinan University]
+\ProvidesClass{jnuexam}[2020/11/06 v1.0 An exam class for Jinan University]
 
+\newif\ifmifengxian \mifengxiantrue  % 是否加密封线
 \newif\ifsidebyside \sidebysidefalse % 是否 A3 纸张
 \newif\ifreverse    \reversefalse    % 是否逆序出题
 \newif\ifanswer     \answertrue      % 是否显示答案
@@ -17,12 +18,13 @@
 \newif\ifcollection \collectionfalse % 用于试卷题库
 
 \DeclareOption{a3paper}{\sidebysidetrue}
+\DeclareOption{a3input}{\sidebysidetrue\mifengxianfalse}
 \DeclareOption{reverse}{\reversetrue}
 \DeclareOption{noanswer}{\answerfalse}
 \DeclareOption{amsfonts}{\amsfontstrue}
 \DeclareOption{sourcehan}{\sourcehantrue}
 \DeclareOption{display}{\displaytrue}
-\DeclareOption{collection}{\collectiontrue}
+\DeclareOption{collection}{\collectiontrue\mifengxianfalse}
 
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexart}} %其它选项
 
@@ -42,7 +44,7 @@
 \fi
 
 \ifsidebyside
-  \RequirePackage[a3paper,landscape,twocolumn,columnsep=40mm,left=50mm,right=30mm,top=25mm,bottom=25mm]{geometry}
+  \RequirePackage[a3paper,landscape,twocolumn,columnsep=60mm,left=30mm,right=30mm,top=25mm,bottom=25mm]{geometry}
 \else
   \RequirePackage[a4paper,left=30mm,right=30mm,top=25mm,bottom=25mm]{geometry}
 \fi
@@ -55,6 +57,7 @@
 \RequirePackage{environ}
 \RequirePackage{etoolbox}
 \RequirePackage{calc}
+\RequirePackage{iftex}
 
 \newcolumntype{Y}{>{\centering\arraybackslash}X}
 \newcolumntype{n}[1]{>{\centering\arraybackslash}m{#1}}
@@ -69,16 +72,28 @@
 %% 这两个命令仅在 A3 纸张中用到，且需要编译两次才能得到正确结果
 %% ---------------------------------------------------------------------------
 
-\newcommand{\mifengxian}{%
-\def\1{\\[50mm]}\def\2{\\[15mm]}%
-\begin{tikzpicture}[remember picture,overlay,very thick,font=\large]
-  \path (current page.south west) +(2cm,1cm)  coordinate (a1);
-  \path (current page.north west) +(2cm,-1cm) coordinate (a2);
-  \path (current page.south west) +(3cm,1cm)  coordinate (b1);
-  \path (current page.north west) +(3cm,-1cm) coordinate (b2);
-  \draw[dashed] (a1) -- node[left=1mm,text width=1em]{装\1订\1线}
-     node[right=1mm,text width=1em]{学\2生\2答\2卷\2不\2要\2超\2过\2此\2线} (a2);
-  \draw (b1) -- (b2);
+\newcommand{\mifengxianleft}{
+  \path (current page.north west) +(25mm,-25mm) coordinate (a1);
+  \path (current page.south west) +(25mm,25mm)  coordinate (a2);
+  \draw[dashed] (a1) -- node[left=1mm,text width=1em,inner sep=0pt]{\1{线}\0\1{订}\0\1{装}} (a2);
+}
+
+\newcommand{\mifengxianright}{
+  \path (current page.north east) +(-25mm,-25mm) coordinate (b1);
+  \path (current page.south east) +(-25mm,25mm)  coordinate (b2);
+  \draw[dashed] (b1) -- node[right=1mm,text width=1em,inner sep=0pt]{\2{装}\0\2{订}\0\2{线}} (b2);
+}
+
+\newcommand{\mifengxianone}{%
+\def\0{\\[70mm]}\def\1{\rotatebox{90}}\def\2{\rotatebox{-90}}%
+\begin{tikzpicture}[remember picture,overlay,very thick]
+  \ifnumodd{\value{page}}{\mifengxianleft}{\mifengxianright}
+\end{tikzpicture}}
+
+\newcommand{\mifengxiantwo}{%
+\def\0{\\[70mm]}\def\1{\rotatebox{90}}\def\2{\rotatebox{-90}}%
+\begin{tikzpicture}[remember picture,overlay,very thick]
+  \mifengxianleft\mifengxianright
 \end{tikzpicture}}
 
 \newcommand{\caogaozhi}{%
@@ -86,14 +101,21 @@
   \node[text=lightgray!40] at (current page.center) {草\quad 稿\quad 纸};
 \end{tikzpicture}}
 
-\ifsidebyside
+\ifmifengxian
   \RequirePackage{tikz}
   \RequirePackage{everypage}
-  \AddEverypageHook{\mifengxian}
-  % 在 twocolumn 文档中，\newpage 可能是到下一栏，\clearpage 才能保证到下一页
-  \preto{\@enddocumenthook}{\clearpage\pagestyle{empty}\caogaozhi\clearpage\caogaozhi\addtocounter{page}{-2}}
-  % 在旧版本 ctex 宏包中不能用 \AtEndDocument 添加含中文的内容，即不能用 \appto 而要用 \preto
-  %\AtEndDocument{\clearpage\pagestyle{empty}\caogaozhi\clearpage\caogaozhi\addtocounter{page}{-2}}
+  \ifsidebyside
+    \AddEverypageHook{\mifengxiantwo}
+    % 在 twocolumn 文档中，\newpage 可能是到下一栏，\clearpage 才能保证到下一页
+    \preto{\@enddocumenthook}{\clearpage\pagestyle{empty}\caogaozhi\clearpage\caogaozhi\addtocounter{page}{-2}}
+    % 在旧版本 ctex 宏包中不能用 \AtEndDocument 添加含中文的内容，即不能用 \appto 而要用 \preto
+    %\AtEndDocument{\clearpage\pagestyle{empty}\caogaozhi\clearpage\caogaozhi\addtocounter{page}{-2}}
+  \else
+    \AddEverypageHook{\mifengxianone}
+  \fi
+\fi
+
+\ifsidebyside
   \RequirePackage{pdfpages}
   % 新版本 pdfpages 将 \includepdf 放在文档开头时会有命令未定义的错误
   % 见 https://tex.stackexchange.com/questions/352007/ieeetran-and-pdfpages
@@ -180,9 +202,11 @@
   \par\vspace{1em}
   \noindent\begin{tabularx}{\linewidth}{|*{8}{Y|}}
     \hline
-    \textbf{题号} & 一 & 二 & 三 & 四 & 五 & 六 & 总分\\
+    \textbf{题\quad 号} & 一 & 二 & 三 & 四 & 五 & 六 & 总分\\
+    \hline
+    \textbf{得\quad 分} &  &  &  &  &  &  & \\
     \hline
-    \parbox[c][2em][c]{2.2em}{\bfseries 得分} &  &  &  &  &  &  & \\
+    \textbf{评阅人} &  &  &  &  &  &  & \\
     \hline
   \end{tabularx}
 }
@@ -192,7 +216,7 @@
 %% ---------------------------------------------------------------------------
 
 \newcommand{\my@columnbox}[1]{\makebox[\columnwidth]{#1}}
-\newcommand{\my@headleft}{暨南大学\kern-0.3em《\kecheng》\kern-0.3em 试卷\,\shijuan}
+\newcommand{\my@headleft}{\hspace{-0.3em}《\kecheng》\kern-0.3em 试卷\,\shijuan}
 \newcommand{\my@headright}{姓名\hspace{6em}学号\hspace{6em}}
 \newcommand{\my@headtext}{\my@headleft\hfill \my@headright}
 \newcommand{\my@foottext}{第~\thepage~页\quad 共~\pageref{LastPage}~页}
@@ -240,18 +264,12 @@
 \newcommand{\printproblems}{\ifreverse\lastproblem\allproblems\fi\xdef\allproblems{}\xdef\lastproblem{}}
 
 \newcommand{\makepart}[2]{%
-    \printproblems
-    \setcounter{problem}{0}%
-    \stepcounter{section}%
-    \vspace{1em}%
-    \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{tabularx}
-    \par\vspace{1em}
+  \printproblems
+  \setcounter{problem}{0}%
+  \stepcounter{section}%
+  \vspace{1em}%
+  \noindent\textbf{\Chinese{section}、#1}（#2）%
+  \par\vspace{1em}%
 }
 
 \newcommand{\makedata}[1]{%
@@ -401,7 +419,6 @@
 %% 判断命令 \true 和 \false
 %% 填空命令 \fillin 和 \fillout
 %% 选择命令 \pickin 和 \pickout
-%% 四个选项排版环境 abcd，根据四个选项的长度自动排成一行、两行或四行
 %% ---------------------------------------------------------------------------
 
 \newcommand{\answer}[1]{\ifanswer#1\else\phantom{#1}\fi}
@@ -417,7 +434,13 @@
 \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}
 
+%% ---------------------------------------------------------------------------
+%% 选择题四个选项排版环境，根据四个选项的长度自动排成一行、两行或四行
+%% 其中 abcd 环境各列平分整行宽度，而 abcd* 环境各列平分剩余空白
+%% ---------------------------------------------------------------------------
+
 \newlength{\my@item@len}
+
 \newcommand\my@item@temp{%
   \unskip\cr\stepcounter{choice}(\Alph{choice})\ %
 }
@@ -428,6 +451,7 @@
 \newcommand\my@item@par{%
   \par\stepcounter{choice}(\Alph{choice})\ \ignorespaces
 }
+
 \NewEnviron{abcd}{
   \unskip
   \setlength{\parindent}{0pt}%
@@ -451,6 +475,44 @@
   \fi
 }
 
+\newcommand\my@item@one@line{%
+  \unskip
+  \ifnumequal{\value{choice}}{0}{}{\hfill}
+  \stepcounter{choice}(\Alph{choice})\ %
+}
+\newcommand\my@item@two@line{%
+  \unskip
+  \ifnumodd{\value{choice}}{&}{\unskip\cr}%
+  \stepcounter{choice}(\Alph{choice})\ %
+}
+
+\NewEnviron{abcd*}{
+  \unskip
+  \setlength{\parindent}{0pt}%
+  \setlength{\parskip}{0pt}%
+  \setcounter{choice}{0}%
+  \let\item=\my@item@one@line
+  \settowidth{\my@item@len}{\BODY}%
+  \ifdim\my@item@len<0.95\linewidth
+    \setcounter{choice}{0}%
+    \par\bgroup\BODY\hfill\hfill\par\egroup\par
+  \else
+    \setcounter{choice}{0}%
+    \let\item=\my@item@two@line
+    \settowidth{\my@item@len}{\vbox{\halign{##&##\hfil\cr\BODY\crcr}}}%
+    \ifdim\my@item@len<0.975\linewidth
+      \setcounter{choice}{0}%
+      \par\bgroup\nointerlineskip
+      \vbox{\halign to\linewidth{##\hfil\tabskip=0pt plus 1fil&##\hfil\cr\BODY\crcr}}%
+      \egroup\par
+    \else
+      \setcounter{choice}{0}%
+      \let\item=\my@item@par
+      \par\bgroup\BODY\hfill\egroup\par
+    \fi
+  \fi
+}
+
 %% ---------------------------------------------------------------------------
 %% 解答题步骤命令 \step
 %% ---------------------------------------------------------------------------
@@ -537,9 +599,9 @@
 \PassOptionsToPackage{tbtags}{amsmath}
 \RequirePackage{amsmath}
 
-\newcommand{\myscore}[1]{\textcolor{blue}{#1\kern0.2em 分}}
+\newcommand{\myscore}[1]{\textcolor{red}{#1\kern0.15em 分}}
 
-\newcommand{\scoretext}[1]{\cdotfill\myscore{#1}\par\noindent\ignorespaces}
+\newcommand{\scoretext}[1]{\mbox{}\nobreak\hfill$\cdots\cdots$\myscore{#1}\par\noindent\ignorespaces}
 \newcommand{\scoreeqno}[1]{\eqno{\cdots\cdots\text{\myscore{#1}}}}
 \newcommand{\scoretag}[1]{\tag*{$\cdots\cdots$\myscore{#1}}}
 
@@ -557,7 +619,18 @@
 %% ---------------------------------------------------------------------------
 
 \newcommand{\display}{\everymath\expandafter{\the\everymath\displaystyle}}
-\ifbool{display}{\display}{}
+\ifbool{display}{
+  \RequirePackage[math]{cellspace}
+  \setlength\cellspacetoplimit{2pt}
+  \setlength\cellspacebottomlimit{2pt}
+  \addparagraphcolumntypes{X}
+  % Fix cellspace bug before version 1.7
+  % See https://tex.stackexchange.com/a/385581
+  \@ifpackagelater{cellspace}{2017/08/12}{}{
+    \patchcmd{\@endpbox}{\color@endgroup}{\expandafter\color@endgroup}{}{}
+  }
+  \display
+}{}
 
 %% ---------------------------------------------------------------------------
 %% 载入个人定制文件 jnuexam.cfg
@@ -575,7 +648,6 @@
 }
 
 \ifbool{sourcehan}{
-  \RequirePackage{iftex}
   % https://sourceforge.net/p/xetex/code/ci/master/tree/source/texk/web2c/xetexdir/NEWS
   \ifbool{XeTeX}{ % TeXLive 2015
     \ifdimless{\the\XeTeXversion\XeTeXrevision pt}{0.99992pt}{}{\my@set@sourcehan}
@@ -601,6 +673,23 @@
   \appto{\endsolution}{\medskip}
   \preto{\problem}{\ifnum\value{problem}=9 \setcounter{problem}{-1}\fi}
   \pagestyle{plain}
+  \let\chapter=\part
+  \@addtoreset{section}{part}
+  \RequirePackage{xkeyval}
+  \define@key{jnuexam}{level}[]{\def\my@collection@level{#1}}
+  \define@key{jnuexam}{year}[]{\def\my@collection@year{#1}}
+  \define@key{jnuexam}{name}[]{\def\my@collection@name{#1}}
+  \newcommand{\info}[1]{%
+    \setkeys{jnuexam}{level,year,name,#1}% 重置之前的数据
+    \my@collection@info@do
+  }
+  \newcommand{\my@collection@info@do}{%
+    \bigskip\hrule\nopagebreak\vspace{0.4em}\nopagebreak
+    \ifdefempty{\my@collection@level}{}{Level = \my@collection@level\quad}%
+    \ifdefempty{\my@collection@year}{}{Year = \my@collection@year\quad}%
+    \ifdefempty{\my@collection@name}{}{Name = \my@collection@name\quad}%
+    \nopagebreak\vspace{0.4em}\nopagebreak\hrule\medskip
+  }
 \fi
 
 %% ---------------------------------------------------------------------------
@@ -616,11 +705,21 @@
 
 \setlength\arraycolsep{4pt}
 
+\ifbool{XeTeX}{
+  % https://en.wikipedia.org/wiki/Number_Forms
+  % Ⅰ、Ⅱ、Ⅲ、Ⅳ、Ⅴ、Ⅵ、Ⅶ、Ⅷ、Ⅸ、Ⅹ、Ⅺ、Ⅻ
+  \xeCJKsetcharclass{"2150}{"218F}{1} % 斜线分数，全角罗马数字等
+  % https://en.wikipedia.org/wiki/Enclosed_Alphanumerics
+  \xeCJKsetcharclass{"2460}{"24FF}{1} % 带圈数字字母，括号数字字母，带点数字等
+}{}
+
 \RequirePackage{CJKfntef}
 \RequirePackage{multirow}
 \RequirePackage{diagbox}
 \RequirePackage{tabu}
 
+\RequirePackage{extarrows}
+
 \RequirePackage{relsize}
 \newcommand{\Int}{\mathop{\mathlarger{\int}}}
 
-- 
cgit v1.2.3

