diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/jnuexam |
Initial commit
Diffstat (limited to 'macros/latex/contrib/jnuexam')
20 files changed, 1361 insertions, 0 deletions
diff --git a/macros/latex/contrib/jnuexam/README b/macros/latex/contrib/jnuexam/README new file mode 100644 index 0000000000..6dfda47e55 --- /dev/null +++ b/macros/latex/contrib/jnuexam/README @@ -0,0 +1,4 @@ +Package: An exam class for Jinan University +Author: Jianrui Lyu <tolvjr@163.com> +Website: https://lvjr.bitbucket.io/jnuexam.html +License: The LaTeX Project Public License 1.3
\ No newline at end of file diff --git a/macros/latex/contrib/jnuexam/exam-a-a3input.pdf b/macros/latex/contrib/jnuexam/exam-a-a3input.pdf Binary files differnew file mode 100644 index 0000000000..5c185d3fc7 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a-a3input.pdf diff --git a/macros/latex/contrib/jnuexam/exam-a-a3input.tex b/macros/latex/contrib/jnuexam/exam-a-a3input.tex new file mode 100644 index 0000000000..5c75d8e502 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a-a3input.tex @@ -0,0 +1,9 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 直接包含 A4 试卷的 PDF 文件,生成双栏的 A3 试卷 +\documentclass[a3paper]{jnuexam} +\begin{document} +\includepdf[pages=-,nup=2x1,offset=1cm 0,delta=-2cm 0]{exam-a-empty} +%\includepdf[pages=-,nup=2x1,offset=1cm 0,delta=-2cm 0,frame]{exam-a} +\end{document} diff --git a/macros/latex/contrib/jnuexam/exam-a-a3split.pdf b/macros/latex/contrib/jnuexam/exam-a-a3split.pdf Binary files differnew file mode 100644 index 0000000000..f17c0ce2e3 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a-a3split.pdf diff --git a/macros/latex/contrib/jnuexam/exam-a-a3split.tex b/macros/latex/contrib/jnuexam/exam-a-a3split.tex new file mode 100644 index 0000000000..140cb573ca --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a-a3split.tex @@ -0,0 +1,6 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 将原有的 A4 试卷改为 A3 试卷双栏排版 +\PassOptionsToClass{a3paper,noanswer}{jnuexam} +\input{exam-a} diff --git a/macros/latex/contrib/jnuexam/exam-a-empty.pdf b/macros/latex/contrib/jnuexam/exam-a-empty.pdf Binary files differnew file mode 100644 index 0000000000..846854d86d --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a-empty.pdf diff --git a/macros/latex/contrib/jnuexam/exam-a-empty.tex b/macros/latex/contrib/jnuexam/exam-a-empty.tex new file mode 100644 index 0000000000..6da2c24a85 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a-empty.tex @@ -0,0 +1,6 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 重新排版原有的 A4 试卷,不显示答案 +\PassOptionsToClass{noanswer}{jnuexam} +\input{exam-a} diff --git a/macros/latex/contrib/jnuexam/exam-a.pdf b/macros/latex/contrib/jnuexam/exam-a.pdf Binary files differnew file mode 100644 index 0000000000..c57592e675 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a.pdf diff --git a/macros/latex/contrib/jnuexam/exam-a.tex b/macros/latex/contrib/jnuexam/exam-a.tex new file mode 100644 index 0000000000..44bc600fae --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-a.tex @@ -0,0 +1,357 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex +\documentclass{jnuexam} + +%\answerfalse %不显示答案 + +\begin{document} + +\renewcommand{\niandu}{2017--2018} +\renewcommand{\xueqi}{2} +\renewcommand{\kecheng}{大学数学} +\renewcommand{\zhuanye}{理工四学分} % 可以为空白 +\renewcommand{\jiaoshi}{张三,李四,王五} % 教师姓名 +\renewcommand{\shijian}{2018~年~06~月~28~日} +\renewcommand{\bixiu}{1} % 1 为必修,0 为选修 +\renewcommand{\bijuan}{1} % 1 为闭卷,0 为开卷 +\renewcommand{\shijuan}{A} % A 或 B 或 C 卷 +\renewcommand{\neizhao}{1} % 1 打勾,0 不勾 +\renewcommand{\waizhao}{0} % 1 打勾,0 不勾 + +\makehead % 生成试卷表头 + +\makepart{填空题}{共~6~小题,每小题~3~分,共~18~分} + +\answertable[3em]{6}{3} % 生成答题栏:行高3em,总共6题,每行3题 + +\newpageb % B卷分页点 + +\begin{problem} +设常数$k>0$,函数$f(x)=\ln x-\dfrac{x}{\e}+k$在$(0,+\infty)$内零点的个数为 \fillout{$2$}. +\end{problem} + +\vfill + +\begin{problem} +设$\va=(2,1,2)$,$\vb=(4,-1,10)$,$\vc=\vb-\lambda\va$,且$\va\bot\vc$,则$\lambda=$ \fillout{$3$}. +\end{problem} + +\vfill + +\begin{problem} +已知二阶行列式 $\text{$\left|\begin{array}{cc} + 1 & 2\\ + - 3 & x +\end{array}\right|$=0}$,则 $x=$ \fillout{$-6$}. +\end{problem} + +\vfill + +\begin{problem} +向量组 $\alpha_1=(1,1,0), \alpha_2=(0,1,1), \alpha_3=(1,0,1)$, +则将向量 $\beta=(4, 5, 3)$ 表示为 $\alpha_1, \alpha_2, \alpha_3$ +的线性组合为 $\beta=$ \fillout{$3\alpha_1+2\alpha_2+\alpha_3$}. +\end{problem} + +\vfill + +\begin{problem} +已知随机变量$\xi$的期望和方差各为$E\xi=3, D\xi=2$, 则$E\xi^2=$ \fillout{$11$}. +\end{problem} + +\vfill + +\begin{problem} +已知$\xi$和$\eta$相互独立且$\xi\sim N(1,4), \eta\sim N(2,5)$,则$\xi-2\eta\sim$ \fillout{$N(-3,24)$}. +\end{problem} + +\vfill + +\newpagea % A卷分页点 + +\makepart{单选题}{共~6~小题,每小题~3~分,共~18~分} + +\answertable{6}{6} % 生成答题栏:默认行高,总共8题,每行8题 + +\newpageb % B卷分页点 + +\begin{problem} +在下列等式中,正确的结果是\pickout{C} +\begin{abcd} +\item $\int f'(x)\dx=f(x)$ +\item $\int \d f(x)=f(x)$ +\item $\frac{\d}{\dx}\big(\int f(x)\dx\big)=f(x)$ +\item $\d\big(\int f(x)\dx\big)=f(x)$ +\end{abcd} +\end{problem} + +\bigskip + +\begin{problem} +假设$F(x)$是连续函数$f(x)$的一个原函数,则必有\pickout{A} +\begin{abcd} +\item $F(x)$是偶函数 $\Leftrightarrow$ $f(x)$是奇函数 +\item $F(x)$是奇函数 $\Leftrightarrow$ $f(x)$是偶函数 +\item $F(x)$是周期函数 $\Leftrightarrow$ $f(x)$是周期函数 +\item $F(x)$是单调函数 $\Leftrightarrow$ $f(x)$是单调函数 +\end{abcd} +\end{problem} + +\bigskip + +\begin{problem} +设矩阵 $A = \left(\begin{array}{ccc} + 1 & 1 & 0\\ + 1 & x & 0\\ + 0 & 0 & 1 +\end{array}\right)$ 其中两个特征值为 $\lambda_1 = 1$ 和 $\lambda_2 += 2$,则 $x=$ \pickout{B} +\begin{abcd} +\item $2$ +\item $1$ +\item $0$ +\item $-1$ +\end{abcd} +\end{problem} + +\bigskip + +\begin{problem} +二次型 $f = 4 x_1^2 - 2 x_1 x_2 + 6 x_2^2$ 对应的矩阵等于 \pickout{C} +\begin{abcd} +\item $\left(\begin{array}{cc} + 4 & - 2\\ + - 2 & 6 +\end{array}\right)$ +\item $\left(\begin{array}{cc} + 2 & - 2\\ + - 2 & 3 +\end{array}\right)$ +\item $\left(\begin{array}{cc} + 4 & - 1\\ + - 1 & 6 +\end{array}\right)$ +\item $\left(\begin{array}{cc} + 2 & - 1\\ + - 1 & 3 +\end{array}\right)$ +\end{abcd} +\end{problem} + +\bigskip + +\begin{problem} +下列说法\CJKunderline{不正确}的是\pickout{B} +\begin{abcd} +\item 大数定律说明了大量相互独立且同分布的随机变量的均值的稳定性 +\item 大数定律说明大量相互独立且同分布的随机变量的均值近似于正态分布 +\item 中心极限定理说明了大量相互独立且同分布的随机变量的和的稳定性 +\item 中心极限定理说明大量相互独立且同分布的随机变量的和近似于正态分布 +\end{abcd} +\end{problem} + +\bigskip + +\begin{problem} +对总体$X$和样本$(X_1,\cdots,X_n)$的说法哪个是\CJKunderline{不正确}的\pickout{D} +\begin{abcd} +\item 总体是随机变量 +\item 样本是$n$元随机变量 +\item $X_1, \cdots, X_n$相互独立 +\item $X_1 = X_2 =\cdots = X_n$ +\end{abcd} +\end{problem} + +\bigskip + +\newpagea % A卷分页点 + +\makepart{计算题}{共~6~小题,每小题~8~分,共~48~分} + +\newpageb % B卷分页点 + +\begin{problem} +求不定积分$\displaystyle\int\e^{2x}\,(\tan x+1)^2\dx$。 +\end{problem} + +\bigskip + +\begin{solution} +\everymath{\displaystyle}% +原式$=\int\e^{2x}\,\sec^2 x\dx+2\int\e^{2x}\,\tan x\dx$ \score{2} +\hspace{5em}${}=\int\e^{2x}\,\d(\tan x)+ 2\int\e^{2x}\,\tan x\dx$ \score{4} +\hspace{5em}${}=\e^{2x}\,\tan x - 2\int\e^{2x}\,\tan x\dx+ 2\int\e^{2x}\,\tan x\dx$ \score{6} +\hspace{5em}${}=\e^{2x}\,\tan x + C$ \score{8} +\end{solution} + +\vfill + +\begin{problem} +求过点$A(1,2,-1), B(2,3,0),C(3,3,2)$ 的三角形$\triangle ABC$ 的面积和它们确定的平面方程. +\end{problem} + +\bigskip + +\begin{solution} +由题设$\overrightarrow{AB}=(1,1,1),\overrightarrow{AC}=(2,1,3)$, \score{2} +故$\overrightarrow{AB}\times \overrightarrow{AC}=\begin{vmatrix} +\vec{i}&\vec{j} &\vec{k}\\ +1&1&1\\ +2&1&3\\ +\end{vmatrix}=(2,-1,-1)$, \score{4} +三角形$\triangle ABC$ 的面积为$S_{\triangle ABC}=\dfrac{1}{2}\big|\overrightarrow{AB}\times +\overrightarrow{AC}\big|=\dfrac{1}{2}\sqrt{6}.$ \score{6} +所求平面的方程为$2(x-2)-(y-3)-z=0$, 即$2x-y-z-1=0$ \score{8} +\end{solution} + +\vfill + +\newpage % A,B卷共同分页点 + +\begin{problem} +计算四阶行列式 $A = \left|\begin{array}{cccc} + 0 & 1 & 2 & 3\\ + 1 & 2 & 3 & 0\\ + 2 & 3 & 0 & 1\\ + 3 & 0 & 1 & 2 +\end{array}\right|$ 的值. +\end{problem} + +\bigskip + +\begin{solution} +$A = \left|\begin{array}{cccc} + 0 & 1 & 2 & 3\\ + 1 & 2 & 3 & 0\\ + 2 & 3 & 0 & 1\\ + 3 & 0 & 1 & 2 + \end{array}\right| = \left|\begin{array}{cccc} + 0 & 1 & 2 & 3\\ + 1 & 2 & 3 & 0\\ + 0 & - 1 & - 6 & 1\\ + 0 & - 6 & - 8 & 2 + \end{array}\right| = 1 \cdot (- 1)^{2 + 1} \left|\begin{array}{ccc} + 1 & 2 & 3\\ + - 1 & - 6 & 1\\ + - 6 & - 8 & 2 + \end{array}\right|$ \score{4} +\qquad $= -\left|\begin{array}{ccc} + 1 & 2 & 3\\ + 0 & - 4 & 4\\ + 0 & 4 & 20 + \end{array}\right| = - \left|\begin{array}{cc} + - 4 & 4\\ + 4 & 20 + \end{array}\right| = -(-4\cdot20-4\cdot4) = 96$ \score{8} +\end{solution} + +\vfill + +\begin{problem} +用配方法将二次型 $f = x_1^2 + 2 x_1 x_2 - 6 x_1 x_3 + 2 x_2^2 - 12 +x_2 x_3 + 9 x^2_3$ 化为标准形 $f = d_1 y^2_1 + d_2 y^2_2 + d_3 y^2_3$ . +\end{problem} + +\bigskip + +\begin{solution} +$f = x_1^2 + 2 x_1 x_2 - 6 x_1 x_3 + 2 x_2^2 - 12 x_2 x_3 + 9 x^2_3$ \par +\qquad$= x_1^2 + 2 x_1 (x_2 - 3 x_3) + (x_2 - 3 x_3)^2 + x_2^2 - 6 x_2 x_3 $ \par +\qquad$= (x_1 + x_2 - 3 x_3)^2 + x_2^2 - 6 x_2 x_3$ \score{3} +\qquad$= (x_1 + x_2 - 3 x_3)^2 + x_2^2 - 2 x_2 \cdot 3 x_3 + (3 x_3)^2 - 9x_3^2$ \par +\qquad$= (x_1 + x_2 - 3 x_3)^2 + (x_2 - 3 x_3)^2 - 9 x_3^2$ \score{6} +令$y_1 = x_1 + x_2 - 3 x_3, y_2 = x_2 - 3 x_3, y_3 = x_3$, \newline +则$f = y_1^2 + y_2^2 - 9y_3^2$为标准形.\score{8} +\end{solution} + +\vfill + +\newpage % A,B卷共同分页点 + +\begin{problem} +设每发炮弹命中飞机的概率是0.2且相互独立,现在发射100发炮弹.\par +\step 用切贝谢夫不等式估计命中数目$\xi$在10发到30发之间的概率.\par +\step 用中心极限定理估计命中数目$\xi$在10发到30发之间的概率. +\end{problem} + +\bigskip + +\begin{solution} +$E\xi = n p = 100 \cdot 0.2 = 20, D\xi = n p q = 100 \cdot 0.2 \cdot 0.8 = 16$. \score{2} +\step $P (10 < \xi < 30) = P (| \xi - E \xi | < 10) \ge 1 - \frac{D\xi}{10^2} + = 1 - \frac{16}{100} = 0.84$. \score{4} +\step $P (10 < \xi < 30) \approx \Phi_0 \left( \frac{30 - 20}{\sqrt{16}}\right) + - \Phi_0 \left( \frac{10 - 20}{\sqrt{16}} \right)$ \score{6} +\qquad $= 2 \Phi_0 (2.5) - 1 = 2 \cdot 0.9938 - 1 =0.9876$ \score{8} +\end{solution} + +\vfill + +\begin{problem} +从正态总体$N(\mu,\sigma^2)$中抽出样本容量为16的样本,算得其平均数为3160,标准差为100. +试检验假设$H_0:\mu=3140$是否成立($\alpha = 0.01$). +\end{problem} + +\bigskip + +\begin{solution} +\step 待检假设 $H_0 : \mu = 3140$. \score{1} +\step 选取统计量 $T = \frac{\bar{X}-\mu}{S / \sqrt{n}} \sim t(n-1)$. \score{3} +\step 查表得到 $t_{\alpha} = t_{\alpha} (n - 1) = t_{0.01} (15) =2.947$. \score{5} +\step 计算统计值 $t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} =\frac{3160-3140}{100/4} = 0.8$.\score{7} +\step 由于 $| t | < t_{\alpha}$, 故接受 $H_0$, 即假设成立. \score{8} +\end{solution} + +\vfill + +\newpagea % A卷分页点 + +\makepart{证明题}{共~2~小题,每小题~8~分,共~16~分} + +\begin{problem} +设数列$\{x_n\}$满足$x_1=\sqrt2$,$x_{n+1}=\sqrt{2+x_n}$.证明数列收敛,并求出极限. +\end{problem} + +\bigskip + +\begin{solution} +\step 事实上,由于$x_1<2$,且$x_k<2$时 +$$x_{k+1}=\sqrt{2+x_k}<\sqrt{2+2}=2,$$ +由数学归纳法知对所有$n$都有$x_n<2$,即数列有上界. +又由于 +$$\frac{x_{n+1}}{x_n}=\sqrt{\frac{2}{x_n^2}+\frac{1}{x_n}}>\sqrt{\frac{2}{2^2}+\frac{1}{2}}=1,$$ +所以数列单调增加.由极限存在准则II,数列必定收敛.\score{4} +\step 设数列的极限为$A$,对递推公式两边同时取极限得到 +$$A=\sqrt{2+A}.$$ +解得$A=2$,即数列$\{x_n\}$的极限为$2$.\score{8} +\end{solution} + +\vfill + +\begin{problem} +设事件$A$和$B$相互独立,证明$A$和$\bar{B}$相互独立. +\end{problem} + +\bigskip + +\begin{solution} +$P (A \cdot \bar{B}) = P (A - B) = P (A - A B)$ \score{2} +\qquad $= P (A) - P (A B) = P (A) - P (A) P (B)$ \score{4} +\qquad $= P (A) (1 - P (B)) = P (A) P (\bar{B})$ \score{6} +所以$A$和$\bar{B}$相互独立.\score{8} +\end{solution} + +\vfill + +\makedata{一些可能用到的数据} %附录数据 + +\begin{tabu}{*{4}{X[l,$]}} +\hline +\Phi_0(0.5)=0.6915 & \Phi_0(1)=0.8413 & \Phi_0(2)=0.9773 & \Phi_0(2.5)=0.9938 \\ +t_{0.01}(8)=3.355 & t_{0.01}(9)=3.250 & t_{0.01}(15)=2.947 & t_{0.01}(16)=2.921 \\ +\chi_{0.005}^2(8)=22.0 & \chi_{0.005}^2(9)=23.6 & \chi_{0.005}^2(15)=32.8 & \chi_{0.005}^2(16)=34.3 \\ +\chi_{0.995}^2(8)=1.34 & \chi_{0.995}^2(9)=1.73 & \chi_{0.995}^2(15)=4.60 & \chi_{0.995}^2(16)=5.14 \\ +\hline +\end{tabu} + +\end{document} diff --git a/macros/latex/contrib/jnuexam/exam-b-a3input.pdf b/macros/latex/contrib/jnuexam/exam-b-a3input.pdf Binary files differnew file mode 100644 index 0000000000..9b0fd8d18d --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b-a3input.pdf diff --git a/macros/latex/contrib/jnuexam/exam-b-a3input.tex b/macros/latex/contrib/jnuexam/exam-b-a3input.tex new file mode 100644 index 0000000000..5b0ade2fef --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b-a3input.tex @@ -0,0 +1,9 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 直接包含 A4 试卷的 PDF 文件,生成双栏的 A3 试卷 +\documentclass[a3paper]{jnuexam} +\begin{document} +\includepdf[pages=-,nup=2x1,offset=1cm 0,delta=-2cm 0]{exam-b-empty} +%\includepdf[pages=-,nup=2x1,offset=1cm 0,delta=-2cm 0,frame]{exam-b} +\end{document} diff --git a/macros/latex/contrib/jnuexam/exam-b-a3split.pdf b/macros/latex/contrib/jnuexam/exam-b-a3split.pdf Binary files differnew file mode 100644 index 0000000000..c224b9ab33 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b-a3split.pdf diff --git a/macros/latex/contrib/jnuexam/exam-b-a3split.tex b/macros/latex/contrib/jnuexam/exam-b-a3split.tex new file mode 100644 index 0000000000..fd39ae4b49 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b-a3split.tex @@ -0,0 +1,6 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 将原有的 A4 试卷改为 A3 试卷双栏排版 +\PassOptionsToClass{a3paper,noanswer}{jnuexam} +\input{exam-b} diff --git a/macros/latex/contrib/jnuexam/exam-b-empty.pdf b/macros/latex/contrib/jnuexam/exam-b-empty.pdf Binary files differnew file mode 100644 index 0000000000..1b27aa32c8 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b-empty.pdf diff --git a/macros/latex/contrib/jnuexam/exam-b-empty.tex b/macros/latex/contrib/jnuexam/exam-b-empty.tex new file mode 100644 index 0000000000..41db22542c --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b-empty.tex @@ -0,0 +1,6 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 重新排版原有的 A4 试卷,不显示答案 +\PassOptionsToClass{noanswer}{jnuexam} +\input{exam-b} diff --git a/macros/latex/contrib/jnuexam/exam-b.pdf b/macros/latex/contrib/jnuexam/exam-b.pdf Binary files differnew file mode 100644 index 0000000000..8a378a7e3d --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b.pdf diff --git a/macros/latex/contrib/jnuexam/exam-b.tex b/macros/latex/contrib/jnuexam/exam-b.tex new file mode 100644 index 0000000000..78b04a6bd0 --- /dev/null +++ b/macros/latex/contrib/jnuexam/exam-b.tex @@ -0,0 +1,6 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +% 从 A 卷自动生成 B 卷,将题目逆序排列 +\PassOptionsToClass{reverse}{jnuexam} +\input{exam-a} diff --git a/macros/latex/contrib/jnuexam/jnuexam.cls b/macros/latex/contrib/jnuexam/jnuexam.cls new file mode 100644 index 0000000000..e839799d0e --- /dev/null +++ b/macros/latex/contrib/jnuexam/jnuexam.cls @@ -0,0 +1,585 @@ +% -*- coding: utf-8 -*- +% ---------------------------------------------------------------------------- +% Author: Jianrui Lyu <tolvjr@163.com> +% Website: https://lvjr.bitbucket.io/jnuexam.html +% License: The LaTeX Project Public License 1.3 +% ---------------------------------------------------------------------------- + +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{jnuexam}[2018/11/21 v0.5 An exam class for Jinan University] + +\newif\ifsidebyside \sidebysidefalse % 是否 A3 纸张 +\newif\ifreverse \reversefalse % 是否逆序出题 +\newif\ifanswer \answertrue % 是否显示答案 +\newif\ifsourcehan \sourcehanfalse % 切换思源字体 +\newif\ifcollection \collectionfalse % 用于试卷题库 + +\DeclareOption{a3paper}{\sidebysidetrue} +\DeclareOption{reverse}{\reversetrue} +\DeclareOption{noanswer}{\answerfalse} +\DeclareOption{sourcehan}{\sourcehantrue} +\DeclareOption{collection}{\collectiontrue} + +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexart}} %其它选项 + +\ProcessOptions %不可省略 + +% 四号 小四号 五号 小五号 +% 14bp 12bp 10.5bp 9bp +\LoadClass[cs4size,UTF8,noindent]{ctexart} + +\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{lastpage} +\RequirePackage{fancyhdr} +\RequirePackage{xcolor} +\RequirePackage{comment} +\RequirePackage{environ} +\RequirePackage{etoolbox} +\RequirePackage{calc} + +\setlength{\parindent}{0em} +\setlength{\lineskiplimit}{3pt} +\setlength{\lineskip}{3pt} + +%% --------------------------------------------------------------------------- +%% 密封线命令 \mifengxian +%% 草稿纸命令 \caogaozhi +%% 这两个命令仅在 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); +\end{tikzpicture}} + +\newcommand{\caogaozhi}{% +\begin{tikzpicture}[remember picture,overlay,font=\sffamily\fontsize{180pt}{180pt}\selectfont] + \node[text=lightgray!40] at (current page.center) {草\quad 稿\quad 纸}; +\end{tikzpicture}} + +\ifsidebyside + \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}} + \RequirePackage{pdfpages} + % 新版本 pdfpages 将 \includepdf 放在文档开头时会有命令未定义的错误 + % 见 https://tex.stackexchange.com/questions/352007/ieeetran-and-pdfpages + % 另外从 LaTeX release 2018 开始 \@ifundefined 不再将未定义命令定义为 \relax + % 见 https://www.latex-project.org/news/latex2e-news/ltnews28.pdf + \@ifundefined{@setmarks}{\let\@setmarks\relax}{} +\fi + +%% --------------------------------------------------------------------------- +%% 试卷表头命令 \makehead +%% --------------------------------------------------------------------------- + +\newcommand{\niandu}{2016-2017} +\newcommand{\xueqi}{2} +\newcommand{\kecheng}{数学课程} +\newcommand{\zhuanye}{} % 专业学分 +\newcommand{\jiaoshi}{吕荐瑞} +\newcommand{\shijian}{} % 考试日期 +\newcommand{\bixiu}{1} % 1 为必修,0 为选修 +\newcommand{\bijuan}{1} % 1 为闭卷,0 为开卷 +\newcommand{\shijuan}{A} % A 或 B 或 C 卷 +\newcommand{\neizhao}{1} % 1 打勾,0 不勾 +\newcommand{\waizhao}{1} % 1 打勾,0 不勾 + +\newcommand{\underspace}[1]{\kern0pt\underline{\hspace{#1}}\kern0pt\relax} +\newcommand{\underbox}[2]{\kern0pt\underline{\makebox[#1]{#2}}\kern0pt\relax} +\newcommand{\underparbox}[2]{\kern0pt\underline{\parbox[b]{#1}{#2}}\kern0pt\relax} + +\newcommand{\ischeck}[1]{\ifnum#1>0\,$\checkmark$\,\else\quad\fi} +\newcommand{\isquad}[1]{\ifnum#1=0\,$\checkmark$\,\else\quad\fi} + +\newcommand\my@temp@a{A} +\newcommand\my@temp@c{C} +\newcommand\my@empty{} + +\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} \\ + \end{tabular} +} + +\newcommand{\head@table@b}{% + \renewcommand{\arraystretch}{1}% + \begin{tabular}{l} + \textbf{课程类别} \\ 必修~[\ischeck{\bixiu}]\quad 选修~[\isquad{\bixiu}] \\ + \hline + \textbf{考试方式} \\ 开卷~[\isquad{\bijuan}]\quad 闭卷~[\ischeck{\bijuan}] \\ + \hline + \textbf{试卷类别}~(\,A, B, C\,)\\\relax [\,\shijuan\,]\hfill 共~\pageref{LastPage}~页 + \end{tabular} +} + +\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] + \end{tabular} +} + +\newcommand{\makehead}{ + \thispagestyle{plain} + \centerline{\LARGE\bfseries 暨\quad 南\quad 大\quad 学\quad 考\quad 试\quad 试\quad 卷} + \vspace{2em}% + \ifreverse + \ifx\shijuan\my@temp@a\renewcommand{\shijuan}{B}\fi + \ifx\shijuan\my@temp@c\renewcommand{\shijuan}{D}\fi + \fi + \noindent + \begin{tabu}{|@{}X@{}|} + \hline\renewcommand{\arraystretch}{1.5}% + \begin{tabu}{@{}>{\bfseries}l@{}|@{}X@{}|@{}l@{}} + \begin{tabular}{l}教\\ 师\\ 填\\ 写\end{tabular} & \head@table@a & \head@table@b + \end{tabu}\\ + \hline\renewcommand{\arraystretch}{0.9}% + \begin{tabu}{@{}>{\bfseries}l@{}|@{}X@{}} + \begin{tabular}{l}考\\ 生\\ 填\\ 写\end{tabular} & \head@table@c + \end{tabu}\\ + \hline + \end{tabu} + \vspace{1em} + \noindent\begin{tabu}{|*{8}{X[c]|}} + \hline + \bfseries{题 号} & 一 & 二 & 三 & 四 & 五 & 六 & 总 分\\ + \hline + \bfseries{得 分} & & & & & & & \\ + \hline + \end{tabu} +} + +%% --------------------------------------------------------------------------- +%% 页眉页脚设定 +%% --------------------------------------------------------------------------- + +\newcommand{\my@columnbox}[1]{\makebox[\columnwidth]{#1}} +\newcommand{\my@headleft}{暨南大学\kern-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}~页} + +\fancypagestyle{plain}{ + \renewcommand{\headrulewidth}{0pt}% + \fancyhf{} + \ifsidebyside + \rhead{\small\underline{\my@columnbox{\my@headtext\strut}}} + \lfoot{\small\my@columnbox{\my@foottext}} + \rfoot{\small\my@columnbox{\stepcounter{page}\my@foottext}} + \else + \cfoot{\small\my@foottext} + \fi +} +\fancyhf{} +\pagestyle{fancy} +\ifsidebyside + \renewcommand{\headrulewidth}{0pt}% + \lhead{\small\underline{\my@columnbox{\my@headtext}\strut}} + \rhead{\small\underline{\my@columnbox{\my@headtext}\strut}} + \lfoot{\small\my@columnbox{\my@foottext}} + \rfoot{\small\my@columnbox{\stepcounter{page}\my@foottext}} +\else + \lhead{\small\my@headleft} + \rhead{\small\my@headright} + \cfoot{\small\my@foottext} +\fi + +%% --------------------------------------------------------------------------- +%% 题型命令 \makepart +%% 附录命令 \makedata +%% 题目环境 problem +%% 解答环境 solution +%% 逆序选项 reverse +%% --------------------------------------------------------------------------- + +\xdef\allproblems{} +\xdef\lastproblem{} +\newcounter{problem} +\newcounter{choice} % 后面选择题的 abcd 环境要用到 +\newcounter{step} % 后面解答题的 \step 命令要用到 + +\newcommand{\printproblems}{\ifreverse\lastproblem\allproblems\fi\xdef\allproblems{}\xdef\lastproblem{}} + +\newcommand{\makepart}[2]{% + \printproblems + \setcounter{problem}{0}% + \stepcounter{section}% + \vspace{1em}% + \noindent\begin{tabu}{|X[c]|X[c]|X[6]} + \cline{1-2} + 得分 & 评阅人 & \textbf{\Chinese{section}、#1}\\ + \cline{1-2} + & & (#2) \\ + \cline{1-2} + \end{tabu} + \vspace{1em} +} + +\newcommand{\makedata}[1]{% + \printproblems\my@stop@reverse + \centerline{\textbf{附录}\quad #1}\smallskip +} + +\preto{\@enddocumenthook}{\printproblems\my@stop@reverse} + +\newcommand\ignorepars{\@ifnextchar\par{\expandafter\ignorepars\@gobble}{}} + +\newenvironment{problemreal}{% + \stepcounter{problem}\setcounter{choice}{0}\setcounter{step}{0}% + \textsf{\color{blue}\arabic{problem}}.\;\,\ignorespaces +}{\par} +\newenvironment{solutionreal}{% + \setcounter{step}{0}% + \textsf{\color{blue}解答}\quad\ignorepars +}{\par} + +\let \oldnewpage = \newpage +\let \oldvfill = \vfill +\let \oldsmallskip = \smallskip +\let \oldmedskip = \medskip +\let \oldbigskip = \bigskip + +\ifreverse + \NewEnviron{problem}{% + \xdef\allproblems{% + \unexpanded\expandafter{\lastproblem}% + \unexpanded\expandafter{\allproblems}% + }% + \xdef\lastproblem{% + \unexpanded{\begin{problemreal}}% + \unexpanded\expandafter{\BODY}% + \unexpanded{\end{problemreal}}% + }% + } + \NewEnviron{solution}{% + \xdef\lastproblem{% + \unexpanded\expandafter{\lastproblem}% + \unexpanded{\begin{solutionreal}}% + \unexpanded\expandafter{\BODY}% + \unexpanded{\end{solutionreal}}% + }% + } + \renewcommand{\newpage}{\xdef\lastproblem{\noexpand\oldnewpage\unexpanded\expandafter{\lastproblem}}} + \renewcommand{\vfill}{\xdef\lastproblem{\unexpanded\expandafter{\lastproblem\oldvfill}}} + \renewcommand{\smallskip}{\xdef\lastproblem{\unexpanded\expandafter{\lastproblem\oldsmallskip}}} + \renewcommand{\medskip}{\xdef\lastproblem{\unexpanded\expandafter{\lastproblem\oldmedskip}}} + \renewcommand{\bigskip}{\xdef\lastproblem{\unexpanded\expandafter{\lastproblem\oldbigskip}}} + \let \newpagea = \relax + \let \newpageb = \newpage +\else + \newenvironment{problem}{\problemreal}{\endproblemreal} + \newenvironment{solution}{\solutionreal}{\endsolutionreal} + \let \newpagea = \newpage + \let \newpageb = \relax +\fi + +\newcommand{\my@stop@reverse}{% + \ifreverse + \renewenvironment{problem}{\problemreal}{\endproblemreal}% + \renewenvironment{solution}{\solutionreal}{\endsolutionreal}% + \let \newpage = \oldnewpage + \let \vfill = \oldvfill + \let \smallskip = \oldsmallskip + \let \medskip = \oldmedskip + \let \bigskip = \oldbigskip + \fi +} + +\def\CommentCutFile{\jobname.cut} + +\AtBeginDocument{% + \ifanswer\else + \excludecomment{solution} + \fi +} + +%% --------------------------------------------------------------------------- +%% 答题栏命令 \answertable +%% --------------------------------------------------------------------------- + +\gdef\answer@lines@temp{}% +\newcommand{\answer@lines@add}[1]{% + \xdef\answer@lines@temp{\answer@lines@temp#1}% +} + +\newrobustcmd{\answer@number@hided}[1]{小题} % 在 PDFLaTeX 中需要保护中文 +\newrobustcmd{\answer@cell@strut}[1]{\parbox[c][#1][c]{2em}{\hbox{答案}}} + +\newcounter{answer@col} +\newcounter{answer@row} +\newcounter{answer@total} + +\newcommand{\answer@lines}[3]{% + % #1 答题栏各栏指定高度 + % #2 答题栏总共答案个数 + % #3 答题栏每行答案个数 + \setcounter{answer@row}{(#2-1)/#3+1}% 除法向下取整,改为向上取整 + \begingroup + \let\hline=\relax \let\\=\relax % 禁止展开 + \gdef\answer@lines@temp{}% + \setcounter{answer@total}{1}% + \whileboolexpr{ + test{\ifnumgreater{\value{answer@row}}{0}} + }{% + \addtocounter{answer@row}{-1}% + \answer@lines@add{\answer@number@hided}% + \setcounter{answer@col}{1}% + \unlessboolexpr{% + test{\ifnumgreater{\value{answer@col}}{#3}}% + }{% + \answer@lines@add{&}% + \ifnumgreater{\value{answer@total}}{#2}{}{% + \answer@lines@add{\arabic{answer@total}}% + }% + \stepcounter{answer@col}% + \stepcounter{answer@total}% + }% + \answer@lines@add{\\ \hline \answer@cell@strut{#1}}% + \setcounter{answer@col}{1}% + \unlessboolexpr{ + test{\ifnumgreater{\value{answer@col}}{#3}} + }{% + \answer@lines@add{&}% + \stepcounter{answer@col}% + }% + \answer@lines@add{\\ \hline}% + }% + \endgroup + \answer@lines@temp +} + +\newcommand{\answertable}[3][1em]{% + 答题须知:本题答案必须写在如下表格中,否则不给分.\par + \begin{tabu}{|c|*{#3}{X[c]|}} + \hline + \answer@lines{#1}{#2}{#3} + \end{tabu}% + \par\vspace{0.8em}% +} + +%% --------------------------------------------------------------------------- +%% 答案切换命令 \answer +%% 填空命令 \fillin 和 \fillout +%% 选择命令 \pickin 和 \pickout +%% 四个选项排版环境 abcd,根据四个选项的长度自动排成一行、两行或四行 +%% --------------------------------------------------------------------------- + +\newcommand{\answer}[1]{\ifanswer#1\else\phantom{#1}\fi} + +\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} + +\newlength{\my@item@len} +\newcommand\my@item@temp{% + \unskip\cr\stepcounter{choice}(\Alph{choice})\ % +} +\newcommand\my@item@box{% + \hfill\egroup\hfill\hbox to \my@item@len\bgroup + \stepcounter{choice}(\Alph{choice})\ \ignorespaces +} +\newcommand\my@item@par{% + \par\stepcounter{choice}(\Alph{choice})\ \ignorespaces +} +\NewEnviron{abcd}{ + \unskip + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt}% + \setcounter{choice}{0}% + \let\item=\my@item@temp + \settowidth{\my@item@len}{\vbox{\halign{##\hfil\cr\BODY\crcr}}}% + \setcounter{choice}{0}% + \ifdim\my@item@len>0.486\linewidth + \setlength{\my@item@len}{\linewidth}% + \let\item=\my@item@par + \BODY\par + \else + \ifdim\my@item@len>.243\linewidth + \setlength{\my@item@len}{0.5\linewidth}% + \else + \setlength{\my@item@len}{0.25\linewidth}% + \fi + \let\item=\my@item@box + \par\bgroup\BODY\hfill\egroup\par + \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})}% +} + +%% --------------------------------------------------------------------------- +%% 评分命令 \score +%% --------------------------------------------------------------------------- + +\PassOptionsToPackage{tbtags}{amsmath} +\RequirePackage{amsmath} + +\newcommand{\myscore}[1]{\textcolor{blue}{#1\kern0.2em 分}} + +\newcommand{\scoretext}[1]{\cdotfill\myscore{#1}\par\noindent\ignorespaces} +\newcommand{\scoreeqno}[1]{\eqno{\cdots\cdots\text{\myscore{#1}}}} +\newcommand{\scoretag}[1]{\tag*{$\cdots\cdots$\myscore{#1}}} + +\newrobustcmd{\score}[1]{% + \ifbool{mmode}{% + \ifdefstrequal{\tag}{\dft@tag}{\scoreeqno{#1}}{\scoretag{#1}}% + }{% + \scoretext{#1}% + }% +} + +%% --------------------------------------------------------------------------- +%% 载入个人定制文件 jnuexam.cfg +%% 中文字体切换选项 sourcehan +%% --------------------------------------------------------------------------- + +\InputIfFileExists{jnuexam.cfg}{}{} + +\newcommand{\my@set@sourcehan}{ + \setCJKmainfont[BoldFont=Source Han Sans SC]{Source Han Serif SC} + \setCJKsansfont{Source Han Sans SC} + % 用中文字体名时 LuaTeX 找不到该字体,XeTeX 正常 + %\setCJKmainfont[BoldFont=思源黑体]{思源宋体} + %\setCJKsansfont{思源黑体} +} + +\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} + }{} + \ifbool{LuaTeX}{\my@set@sourcehan}{} +}{} + +%% --------------------------------------------------------------------------- +%% 试卷题库选项 collection +%% --------------------------------------------------------------------------- + +\ifcollection + \RequirePackage{hyperref} + \hypersetup{ + pdfstartview={FitH}, + bookmarksnumbered=true, + unicode=true, + hidelinks=true + %colorlinks=true, + %linkcolor=black + } + \appto{\endproblem}{\medskip} + \appto{\endsolution}{\medskip} + \preto{\problem}{\ifnum\value{problem}=9 \setcounter{problem}{-1}\fi} + \pagestyle{plain} +\fi + +%% --------------------------------------------------------------------------- +%% 载入常用宏包,定义常用命令 +%% --------------------------------------------------------------------------- + +\AtBeginDocument{ + \setlength{\abovedisplayskip}{4pt minus 2pt} + \setlength{\belowdisplayskip}{4pt minus 2pt} + \setlength{\abovedisplayshortskip}{2pt} + \setlength{\belowdisplayshortskip}{2pt} +} + +\setlength\arraycolsep{4pt} + +\RequirePackage{CJKfntef} +\RequirePackage{multirow} +\RequirePackage{diagbox} + +\RequirePackage{relsize} +\newcommand{\Int}{\mathop{\mathlarger{\int}}} + +\newcommand{\e}{\mathrm{e}} +\newcommand{\limit}{\lim\limits} +\newcommand{\R}{\mathbb{R}} + +\DeclareMathOperator{\Corr}{\rho} +\DeclareMathOperator{\Cov}{Cov} +\DeclareMathOperator{\grad}{grad} +\DeclareMathOperator{\Prj}{Prj} +\DeclareMathOperator{\Var}{Var} + +\newcommand{\diff}{\mathop{}\!\mathrm{d}} +\newcommand{\dx}{\diff x} +\newcommand{\dy}{\diff y} +\def\dz{\diff z} % 不确定命令是否已经定义 +\newcommand{\du}{\diff u} +\newcommand{\dv}{\diff v} +\newcommand{\dr}{\diff r} +\newcommand{\ds}{\diff s} +\newcommand{\dt}{\diff t} +\newcommand{\dS}{\diff S} +% 有些宏包比如 hyperref 会修改 \d 的定义,所以放在 document 开始处 +% 利用 etoolbox 将 \d 定义为健壮命令,以避免在 align 等环境中错误地展开 +\AtBeginDocument{% + \let\oldd=\d + \renewrobustcmd{\d}{\ifbool{mmode}{\diff}{\oldd}}% +} + +\newcommand{\va}{\vec{a\vphantom{b}}} +\newcommand{\vb}{\vec{b}} +\newcommand{\vc}{\vec{c\vphantom{b}}} +\newcommand{\vd}{\vec{d}} +\newcommand{\ve}{\vec{e}} +\newcommand{\vi}{\vec{i}} +\newcommand{\vj}{\vec{j}} +\newcommand{\vk}{\vec{k}} +\newcommand{\vn}{\vec{n}} +\newcommand{\vs}{\vec{s}} +\newcommand{\vv}{\vec{v}} + +\let\ov=\overrightarrow + +\let\le=\leqslant +\let\ge=\geqslant + +\let\lb=\{ +\let\rb=\} + +\def\T{\mathrm{T}\kern-.5pt} + +\newrobustcmd{\wfrac}[3][2pt]{% + {\begingroup\hspace{#1}#2\hspace{#1}\endgroup\over\hspace{#1}#3\hspace{#1}}% +} + diff --git a/macros/latex/contrib/jnuexam/jnuexam.pdf b/macros/latex/contrib/jnuexam/jnuexam.pdf Binary files differnew file mode 100644 index 0000000000..79517e4623 --- /dev/null +++ b/macros/latex/contrib/jnuexam/jnuexam.pdf diff --git a/macros/latex/contrib/jnuexam/jnuexam.tex b/macros/latex/contrib/jnuexam/jnuexam.tex new file mode 100644 index 0000000000..f41fb784f6 --- /dev/null +++ b/macros/latex/contrib/jnuexam/jnuexam.tex @@ -0,0 +1,367 @@ +% -*- coding: utf-8 -*- +% !TEX program = xelatex + +\documentclass[12pt]{beamer} + +\usepackage[UTF8,noindent]{ctex} +\usepackage{arev} +\usepackage{ragged2e} +\usepackage{listings} +\usepackage{tabu} + +\makeatletter + +\providecommand{\beamer@endinputifotherversion}[1]{} + +\ifxetex + \setCJKsansfont{SimHei} % fix for ctex 2.0 + \setCJKmonofont{SimHei} + \renewcommand\CJKfamilydefault{\CJKsfdefault}% +\else + \@ifpackagelater{ctex}{2014/03/01}{}{\AtBeginDocument{\heiti}} %无效? +\fi + +\makeatother + +\renewcommand{\baselinestretch}{1} % ctex 2.4.1 开始为 1,之前为 1.3 +\renewcommand{\arraystretch}{1.3} + +\setlength{\parskip}{7pt plus 1pt minus 1pt} + +\justifying +\let\oldraggedright\raggedright +\let\raggedright\justifying + +\lstset{ + basicstyle=\ttfamily\color{blue!50!red} +} + +\lstnewenvironment{code}{}{} + +\setbeamersize{text margin left=8mm,text margin right=8mm} + +\newenvironment{framex}{\begin{frame}[fragile=singleslide,environment=framex]}{\end{frame}} + +\setbeamertemplate{frametitle}{\strut\insertframetitle\strut\par} +\setbeamertemplate{navigation symbols}{} + +\newcommand{\ulinefill}[1]{\xleaders\hbox{\underline{\vphantom{#1}\kern1pt}}\hfill\kern0pt} +\newcommand{\fillbox}[1]{\ulinefill{#1}\underline{#1}\ulinefill{#1}} + +\setbeamercolor{normal text}{bg=gray!20} + +\setbeamertemplate{title page}{% + \renewcommand{\arraystretch}{2}% + \usebeamerfont{title} + \begin{tabu}{|X|} + \hline + 模板名称:\fillbox{\usebeamercolor[fg]{title}\inserttitle} \\ + 模板作者:\fillbox{\insertauthor} \\ + 所在单位:\fillbox{\insertinstitute} \\ + 更新日期:\fillbox{\the\year}年\fillbox{\the\month}月\fillbox{\the\day}日\\ + \hline + \end{tabu}% +} + +\begin{document} + +\title{暨南大学试卷 LaTeX 模板} +\author{吕\ 荐\ 瑞} +\institute{暨南大学数学系} + +\begin{frame}[plain] +\titlepage +\end{frame} + +\begin{framex} +\frametitle{简单介绍} +本文档介绍 \verb!jnuexam! 文档类。这个文档类提供暨南大学考试试卷的 LaTeX 模板。 +\par +这个模板将格式和内容分开,而且可以从一份 \verb!tex! 文件编译出四份试卷(A卷 / B卷 / A卷答案 / B卷答案),使用方便。 +\par +这个模板的最新版本可以在下面地址下载:\newline + \href{https://lvjr.bitbucket.io/jnuexam.html?\the\year}{https://lvjr.bitbucket.io/jnuexam.html} +\end{framex} + +\begin{framex} +\frametitle{编译方式} +这个文档类要求所有 \verb!tex! 文件都使用 \verb!UTF8! 编码, +若使用 \verb!GBK! 编码则无法得到正确结果。 +\par +如果对文件编码不熟悉,可以直接复制例子文件,然后在其中修改,即可正常编译。 +\par +这个文档类同时支持 \verb!XeLaTeX! 和 \verb!PDFLaTeX! 方式编译。为得到最好的中文显示效果, +推荐用较先进的 \verb!XeLaTeX! 编译。 +\end{framex} + +\begin{framex} +\frametitle{试卷结构} +\begin{code} +\documentclass{jnuexam} +\begin{document} +...... +\makehead %生成试卷表头 +...... +\makepart{填空题}{题数分值} +...... +\makepart{单选题}{题数分值} +...... +\makepart{计算题}{题数分值} +...... +\makepart{证明题}{题数分值} +...... +\makedata{可能用到的数据} %附录数据 +...... +\end{document} +\end{code} +\end{framex} + +\begin{framex} +\frametitle{试卷表头} +\begin{code} +\renewcommand{\niandu}{2010--2011} +\renewcommand{\xueqi}{2} +\renewcommand{\kecheng}{大学数学} +\renewcommand{\zhuanye}{理工4学分} +\renewcommand{\jiaoshi}{某某某} +\renewcommand{\shijian}{2011年07月08日} +\renewcommand{\bixiu}{1} % 1为必修,0为选修 +\renewcommand{\bijuan}{1} % 1为闭卷,0为开卷 +\renewcommand{\shijuan}{A} % A/B/C卷 +\renewcommand{\neizhao}{1} % 1打勾,0不勾 +\renewcommand{\waizhao}{0} % 1打勾,0不勾 +\makehead %生成试卷表头 +\end{code} +其中 \verb!\zhuanye! 和 \verb!\shijian! 命令的内容可以为空。 +\end{framex} + +\begin{framex} +\frametitle{填空题目} +\begin{code} +\makepart{填空题}{题数分值} + +\begin{problem} +第一道填空题描述\fillout{答案}。 +\end{problem} + +\begin{problem} +第二道填空题描述\fillout{答案}。 +\end{problem} +\end{code} +\verb!\fillout! 命令将用下划线填满整行。另有个 \verb!\fillin! 命令,只留下最小宽度的下划线。 +\par +答案必须放在 \verb!\fillout! 或 \verb!\fillin! 命令里面;这样才能在生成空白试卷时隐藏它。 +\end{framex} + +\begin{framex} +\frametitle{选择题目} +\begin{code} +\makepart{单选题}{题数分值} + +\begin{problem} +第一道单选题描述\pickout{答案}。 +\end{problem} + +\begin{problem} +第二道单选题描述\pickout{答案}。 +\end{problem} +\end{code} +\verb!\pickout! 命令将把选择圆括号放在本行最右边。另外有个 \verb!\pickin! 命令,将选择圆括号放在当前位置。 +\par +答案必须放在 \verb!\pickout! 或 \verb!\pickin! 命令里面;这样才能在生成空白试卷时隐藏它。 +\end{framex} + +\begin{framex} +\frametitle{选项排版} +选择题的四个选项可以用 \verb!abcd! 环境来排版。比如: +\begin{code} +\begin{abcd} + \item 第一个选项 + \item 第二个选项 + \item 第三个选项 + \item 第四个选项 +\end{abcd} +\end{code} +此时 \verb!abcd! 环境将根据各选项长度自动将四个选项分为一行、两行或四行排版,非常方便。 +\end{framex} + + +\begin{framex} +\frametitle{答题表格} +在填空题和选择题前面,还可以用 \verb!\answertable! 命令生成空白答题栏。比如: +\begin{code} +\answertable[3em]{6}{3} +\end{code} +其中 \verb!\answertable! 命令的三个参数含义如下: +\begin{itemize} + \item 第一个可选参数表示空白单元格的高度,默认是 \verb!1em!。 + \item 第二个必选参数表示总共有多少个题目。 + \item 第三个必选参数表示每行排版几个题目。 +\end{itemize} +\end{framex} + +\begin{framex} +\frametitle{计算题目} +\begin{code} +\makepart{计算题}{题数分值} + +\begin{problem} +第一道计算题描述。 +\end{problem} +\begin{solution} +第一道计算题答案。 +\end{solution} + +\begin{problem} +第二道计算题描述。 +\end{problem} +\begin{solution} +第二道计算题答案。 +\end{solution} +\end{code} +\end{framex} + +\begin{framex} +\frametitle{证明题目} +\begin{code} +\makepart{证明题}{题数分值} + +\begin{problem} +第一道证明题描述。 +\end{problem} +\begin{solution} +第一道证明题答案。 +\end{solution} + +\begin{problem} +第二道证明题描述。 +\end{problem} +\begin{solution} +第二道证明题答案。 +\end{solution} +\end{code} +\end{framex} + +\begin{framex} +\frametitle{评分命令} +计算题和证明题等主观题的排版方法是完全一样的。在编写这些主观题的解答时, +可以用 \verb!\score! 命令给出各步骤得分。比如: +\begin{code} +\begin{solution} +$1+1=2$ \score{4} +$2+2=4$ \score{8} +\end{solution} +\end{code} +评分命令 \verb!\score! 也可在 \verb!align*! 等数学环境中使用,此时评分显示在公式编号位置。 +\end{framex} + +\begin{framex} +\frametitle{其它题型} +除了上述四种题型之外,其它题型可以用下面方式编写: +\begin{code} +\makepart{某题型}{题数分值} + +\begin{problem} +第一题描述。\answer{第一题答案} +\end{problem} + +\begin{problem} +第二题描述。\answer{第二题答案} +\end{problem} +\end{code} +其中题目答案必须放在 \verb!\answer! 命令里面;这样才能在生成空白试卷时隐藏它。 +\end{framex} + +\begin{framex} +\frametitle{附录数据} +在试卷最后,可以用下面命令增加附录数据部分: +\begin{code} +\makedata{可能用到的数据} %附录数据 +...... +\end{code} +附录数据必须放在 \verb!\makedata! 命令后面;否则在从A卷生成B卷时会出问题。 +\end{framex} + +\begin{framex} +\frametitle{空白试卷} +假设 \verb!exam-a.tex! 是含答案的试卷。新建一个包含以下内容的 \verb!exam-a-empty.tex! 文档, +编译后将得到不含答案的空白试卷。 +\begin{code} +\PassOptionsToClass{noanswer}{jnuexam} +\input{exam-a} +\end{code} +也就是说,给 \verb!jnuexam! 文档类加上 \verb!noanswer! 选项后,编译时将会自动隐藏试卷答案。 +\end{framex} + +\begin{framex} +\frametitle{逆序出题} +假设 \verb!exam-a.tex! 是含答案的A卷。新建一个包含以下内容的 \verb!exam-b.tex! 文档, +编译后将得到逆序出题的B卷。 +\begin{code} +\PassOptionsToClass{reverse}{jnuexam} +\input{exam-a} +\end{code} +也就是说,给 \verb!jnuexam! 文档类加上 \verb!reverse! 选项后,编译时将会逆序排列各题型的小题。 +\end{framex} + +\begin{framex} +\frametitle{竖直空白} +在试卷的各个小题后面,可以留下一些竖直空白。本文档类支持下列这些竖直空白命令:\par +\renewcommand{\arraystretch}{1.3}% +\begin{tabu}{XX} + \hline + \texttt{\string\smallskip} & 竖直小空白 \\ + \hline + \texttt{\string\medskip} & 竖直中空白 \\ + \hline + \texttt{\string\bigskip} & 竖直大空白 \\ + \hline + \texttt{\string\vfill} & 竖直填充 \\ + \hline +\end{tabu} +当然,竖直空白命令可以连续使用多个,以得到所需的空白。 +\end{framex} + +\begin{framex} +\frametitle{分页命令} +分页命令 \verb!\newpage! 同样可以使用。由于A卷和B卷的小题顺序相反, +其中的分页位置通常也不同。因此这里另外提供 \verb!\newpagea! 和 \verb!\newpageb! 命令, +分别只对 A 卷和 B 卷有效。 +\par +\renewcommand{\arraystretch}{1.3}% +\begin{tabu}{XX[2]} + \hline + \texttt{\string\newpage} & 分页,对A卷和B卷均有效 \\ + \hline + \texttt{\string\newpagea} & 分页,仅对A卷有效 \\ + \hline + \texttt{\string\newpageb} & 分页,仅对B卷有效 \\ + \hline +\end{tabu} +在试卷中\alert{不要}使用其他分页命令,比如 \verb!\clearpage! 等。 +\end{framex} + +\begin{framex} +\frametitle{分页例子} +关于分页命令的使用,可以看下面的典型例子: +\begin{code} +\makepart{某题型}{题型分值} +\newpageb +\begin{problem}第一题\end{problem}\vfill +\begin{problem}第二题\end{problem}\vfill +\newpage +\begin{problem}第三题\end{problem}\vfill +\begin{problem}第四题\end{problem}\vfill +\newpagea +\end{code} +这样编译得到的A卷就是这样的顺序: +\begin{code} +第一题 第二题 分页 第三题 第四题 分页 +\end{code} +而编译得到的B卷就是这样的顺序: +\begin{code} +第四题 第三题 分页 第二题 第一题 分页 +\end{code} +\end{framex} + +\end{document} |