texlive[69161] Master/texmf-dist: jnuexam (18dec23)

commits+karl at tug.org commits+karl at tug.org
Mon Dec 18 21:56:13 CET 2023


Revision: 69161
          https://tug.org/svn/texlive?view=revision&revision=69161
Author:   karl
Date:     2023-12-18 21:56:13 +0100 (Mon, 18 Dec 2023)
Log Message:
-----------
jnuexam (18dec23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/jnuexam/README
    trunk/Master/texmf-dist/doc/latex/jnuexam/exam-a-answer.pdf
    trunk/Master/texmf-dist/doc/latex/jnuexam/exam-a-empty.pdf
    trunk/Master/texmf-dist/doc/latex/jnuexam/exam-b-answer.pdf
    trunk/Master/texmf-dist/doc/latex/jnuexam/exam-b-empty.pdf
    trunk/Master/texmf-dist/doc/latex/jnuexam/jnuexam.pdf
    trunk/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls

Modified: trunk/Master/texmf-dist/doc/latex/jnuexam/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/jnuexam/README	2023-12-18 20:56:00 UTC (rev 69160)
+++ trunk/Master/texmf-dist/doc/latex/jnuexam/README	2023-12-18 20:56:13 UTC (rev 69161)
@@ -1,4 +1,4 @@
 Package: An exam class for Jinan University
 Author:  Jianrui Lyu <tolvjr at 163.com>
 Website: https://lvjr.bitbucket.io/jnuexam.html
-License: The LaTeX Project Public License 1.3
\ No newline at end of file
+License: The LaTeX Project Public License 1.3c
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/jnuexam/exam-a-answer.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/jnuexam/exam-a-empty.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/jnuexam/exam-b-answer.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/jnuexam/exam-b-empty.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/jnuexam/jnuexam.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls	2023-12-18 20:56:00 UTC (rev 69160)
+++ trunk/Master/texmf-dist/tex/latex/jnuexam/jnuexam.cls	2023-12-18 20:56:13 UTC (rev 69161)
@@ -2,11 +2,11 @@
 % ----------------------------------------------------------------------------
 % Author:  Jianrui Lyu <tolvjr at 163.com>
 % Website: https://lvjr.bitbucket.io/jnuexam.html
-% License: The LaTeX Project Public License 1.3
+% License: The LaTeX Project Public License 1.3c
 % ----------------------------------------------------------------------------
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{jnuexam}[2023/12/11 v2.0 An exam class for Jinan University]
+\ProvidesClass{jnuexam}[2023/12/18 v2.1 An exam class for Jinan University]
 
 %% 旧版本的 LaTeX 不能识别 2022-11-01 这种日期格式
 %\@ifl at t@r\fmtversion{2022-11-01}{}{
@@ -397,11 +397,31 @@
 \fi
 
 %% ---------------------------------------------------------------------------
+%% 乱序排列选项 random
+%% 随机种子选项 seed
+%% ---------------------------------------------------------------------------
+
+%% 随机数种子不能超过 2147483647 = "7FFFFFFF
+\def\my at random@seed{19061116}
+\define at key{jnuexam at setup}{seed}[19061116]{\def\my at random@seed{#1}}
+
+\ifrandom
+  \RequirePackage{pgf}
+  \RequirePackage{pgffor}
+  \newcommand*\exam at set@seed{%
+    %% 当\pgfmathrandom的参数为3的倍数时,对相邻种子生成的多个随机数分布不均匀
+    %\pgfmathsetseed{\numexpr\my at random@seed+\value{section}-1\relax}%
+    %% 因此我们改用下面的方法,用随机数种子生成下一个随机数种子
+    \pgfmathsetseed{\my at random@seed}%
+    \pgfmathrandominteger\my at random@seed{1}{2147483647}%
+  }
+\fi
+
+%% ---------------------------------------------------------------------------
 %% 题型命令 \makepart
 %% 附录命令 \makedata
 %% 题目环境 problem
 %% 解答环境 solution
-%% 乱序选项 random
 %% ---------------------------------------------------------------------------
 
 \newif\ifonlyoneproblem \onlyoneproblemfalse % 此部分仅有一道题时不显示题目编号
@@ -418,11 +438,6 @@
 \colorlet{problem number}{blue!80!black}
 \colorlet{solution name}{blue!80!black}
 
-\ifrandom
-  \RequirePackage{pgf}
-  \RequirePackage{pgffor}
-\fi
-
 \newcounter{my at shuffle@temp at cnt}
 \newcounter{my at list@temp at cnt}
 
@@ -448,16 +463,8 @@
   \dolistloop\my at tmpa@list
 }
 
-%% 随机数种子不能超过 2147483647 = "7FFFFFFF
-\def\my at random@seed{19061116}
-\define at key{jnuexam at setup}{seed}[19061116]{\def\my at random@seed{#1}}
-
 \newcommand\my at shuffle@problems{%
-  %% 当\pgfmathrandom的参数为3的倍数时,对相邻种子生成的多个随机数分布不均匀
-  %\pgfmathsetseed{\numexpr\my at random@seed+\value{section}-1\relax}%
-  %% 因此我们改用下面的方法,用随机数种子生成下一个随机数种子
-  \pgfmathsetseed{\my at random@seed}%
-  \pgfmathrandominteger\my at random@seed{1}{2147483647}%
+  \exam at set@seed
   \ifnumgreater{\value{problem}}{2}{%
     \gdef\my at shuffle@list{}%
     \foreach \i in {1,...,\value{problem}} {\listxadd\my at shuffle@list{\i}}%
@@ -715,9 +722,6 @@
 \newcommand*{\tick at text@F}{\sffamily F}
 \newcommand*{\tickin}[1]{\tick at box{\csname tick at text@#1\endcsname}}
 \newcommand*{\tickout}[1]{\unskip\nobreak\cdotfill\tick at box{\csname tick at text@#1\endcsname}}
-% 过时命令,不要再使用
-%\newcommand*{\true}{\tickout{t}}
-%\newcommand*{\false}{\tickout{f}}
 
 \newcommand*{\ulinefill}[1]{\xleaders\hbox{\underline{\vphantom{#1}\kern1pt}}\hfill\kern0pt}
 \newcommand*{\minwidthbox}[2]{\makebox[{\ifdim#1<\width\width\else#1\fi}]{#2}}
@@ -725,9 +729,56 @@
 \newcommand*{\fillout}[1]{\allowbreak\hbox{}\nobreak\ulinefill{#1}\underline{\color{blue}\answer{#1}}\ulinefill{#1}}
 \newcommand*{\fillin}[1]{\underline{\hspace{1em}\color{blue}\minwidthbox{2em}{\answer{#1}}\hspace{1em}}}
 
-\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}
+\newcommand*\pickoutreal[1]{%
+  \unskip\nobreak\cdotfill(\makebox[1.5em]{\color{blue}\answer{#1}})%
+}
+\newcommand*\pickinreal[1]{%
+  \unskip\nobreak
+  \hspace{0.3em}(\makebox[1.5em]{\color{blue}\answer{#1}})\hspace{0.3em}%
+  \ignorespaces
+}
 
+%% 选择题四个选项打乱顺序,用三种方法即可保证答案不同
+%% 1:ABCD -> CDAB; 2:ABCD -> BADC; 3: ABCD -> DCBA
+%% 即在两行排列时仅用到上下交换以及左右交换,这样可以保持两行长度不变
+
+\csdef{my at shuffle@1 at A}{C} \csdef{my at shuffle@2 at A}{B} \csdef{my at shuffle@3 at A}{D}
+\csdef{my at shuffle@1 at B}{D} \csdef{my at shuffle@2 at B}{A} \csdef{my at shuffle@3 at B}{C}
+\csdef{my at shuffle@1 at C}{A} \csdef{my at shuffle@2 at C}{D} \csdef{my at shuffle@3 at C}{B}
+\csdef{my at shuffle@1 at D}{B} \csdef{my at shuffle@2 at D}{C} \csdef{my at shuffle@3 at D}{A}
+
+\def\@my at choice@random{0}
+\newcommand\my at shuffle@abcd[1]{\csuse{my at shuffle@\@my at choice@random @#1}}
+
+\newcommand*\pickout[1]{%
+  \ifbool{random}{%
+    \exam at set@seed
+    \pgfmathrandominteger\@my at choice@random{1}{3}%
+    %\@my at choice@random
+    \pickoutreal{\my at shuffle@abcd{#1}}%
+  }{%
+    \pickoutreal{#1}%
+  }%
+}
+\newcommand*\pickoutfixed[1]{%
+  \pickoutreal{#1}%
+  \randomfalse
+}
+\newcommand*\pickin[1]{%
+  \ifbool{random}{%
+    \exam at set@seed
+    \pgfmathrandominteger\@my at choice@random{1}{3}%
+    %\@my at choice@random
+    \pickinreal{\my at shuffle@abcd{#1}}%
+  }{%
+    \pickinreal{#1}%
+  }%
+}
+\newcommand*\pickinfixed[1]{%
+  \pickinreal{#1}%
+  \randomfalse
+}
+
 %% ---------------------------------------------------------------------------
 %% 选择题四个选项排版环境,根据四个选项的长度自动排成一行、两行或四行
 %% 其中 abcd 环境各列平分整行宽度,而 abcd* 环境各列平分剩余空白
@@ -753,7 +804,7 @@
   \my at label@text\ignorespaces
 }
 
-\NewEnviron{abcd}{
+\NewEnviron{abcdreal}{
   \unskip
   \setlength{\parindent}{0pt}%
   \setlength{\parskip}{0pt}%
@@ -787,7 +838,7 @@
   \stepcounter{choice}(\Alph{choice})\ %
 }
 
-\NewEnviron{abcd*}{
+\NewEnviron{abcd*real}{
   \unskip
   \setlength{\parindent}{0pt}%
   \setlength{\parskip}{0pt}%
@@ -814,6 +865,30 @@
   \fi
 }
 
+\ifbool{random}{%
+  \csdef{my at swap@items at 1}#1#2#3#4{\item#3\item#4\item#1\item#2}
+  \csdef{my at swap@items at 2}#1#2#3#4{\item#2\item#1\item#4\item#3}
+  \csdef{my at swap@items at 3}#1#2#3#4{\item#4\item#3\item#2\item#1}
+  \long\def\my at swap@items#1\item#2\item#3\item#4\item#5\@my at stop@mark{%
+    #1\csuse{my at swap@items@\@my at choice@random}{#2}{#3}{#4}{#5}%
+  }
+}{}
+
+\NewDocumentEnvironment{abcd}{+b}{%
+  \ifbool{random}{%
+    \begin{abcdreal}\my at swap@items#1\@my at stop@mark\end{abcdreal}%
+  }{%
+    \begin{abcdreal}#1\end{abcdreal}%
+  }%
+}{}
+\NewDocumentEnvironment{abcd*}{+b}{%
+  \ifbool{random}{%
+    \begin{abcd*real}\my at swap@items#1\@my at stop@mark\end{abcd*real}%
+  }{%
+    \begin{abcd*real}#1\end{abcd*real}%
+  }%
+}{}
+
 %% ---------------------------------------------------------------------------
 %% 设定有序列表使用悬挂缩进,并指定前两级有序列表的标签格式
 %% 标签宽度按最宽者自动设定,左边距自动计算,竖直空白全部去掉
@@ -914,7 +989,6 @@
     \pointstext{#1}%
   }%
 }
-%\let\score=\points % \score 命令已经废弃,不要再使用
 
 %% ---------------------------------------------------------------------------
 %% 载入个人定制文件 jnuexam.cfg
@@ -1128,7 +1202,6 @@
   \let\my at saved@sum=\sum    \def\sum{\my at saved@sum\limits}%
   \let\my at saved@prod=\prod  \def\prod{\my at saved@prod\limits}%
 }
-%\newcommand{\limit}{\lim\limits} % 废弃命令,不要再使用
 
 \newcommand{\e}{\mathrm{e}}
 \newcommand{\R}{\mathbb{R}}



More information about the tex-live-commits mailing list.