├── exam.pdf ├── makerecord.dat ├── makeclear.bat ├── makefile.bat ├── makefileeg.bat ├── questionliba.tex ├── examnone.tex ├── examsheetsize.tex ├── examchapter.tex ├── examsection.tex ├── examoptions.tex ├── questionlibc.tex ├── examanswertrue.tex ├── examanswerfalse.tex ├── exam.tex ├── readme.md ├── questionlibb.tex ├── questionlibd.tex └── simplexam.cls /exam.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hushidong/simplexam/HEAD/exam.pdf -------------------------------------------------------------------------------- /makerecord.dat: -------------------------------------------------------------------------------- 1 | exam.tex 2 | examanswerfalse.tex 3 | examanswertrue.tex 4 | examchapter.tex 5 | examnone.tex 6 | examsection.tex 7 | -------------------------------------------------------------------------------- /makeclear.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.userbak *.nav *.snm *.vrb 3 | 4 | del /q *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk -------------------------------------------------------------------------------- /makefile.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) 2012-2018 hzz 2 | 3 | @echo off 4 | 5 | 6 | :: compile the tex file 7 | 8 | call makeclear 9 | 10 | ::pause 11 | 12 | xelatex.exe --synctex=-1 exam.TEX 13 | xelatex.exe --synctex=-1 exam.TEX 14 | xelatex.exe --synctex=-1 exam.TEX 15 | 16 | ::call makeclear 17 | 18 | -------------------------------------------------------------------------------- /makefileeg.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | 4 | 5 | setlocal enabledelayedexpansion 6 | for %%a in ( exam*.tex ) do ( 7 | call makeclear 8 | set jobfile=%%a 9 | set jobname=!jobfile:~0,-4! 10 | echo %%a 11 | echo !jobfile! 12 | echo !jobname! 13 | echo !jobfile! >> makerecord.dat 14 | xelatex.exe --synctex=-1 !jobfile! 15 | xelatex.exe --synctex=-1 !jobfile! 16 | xelatex.exe --synctex=-1 !jobfile! 17 | ) 18 | setlocal DISABLEDELAYEDEXPANSION 19 | 20 | 21 | 22 | ::call makeclear 23 | 24 | ::pause 25 | -------------------------------------------------------------------------------- /questionliba.tex: -------------------------------------------------------------------------------- 1 | \begin{question} 2 | 人类一思考,上帝就发笑。\answer{right} 3 | \end{question} 4 | 5 | \begin{question} 6 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗?\answer{wrong} 7 | \end{question} 8 | 9 | \begin{question} 10 | 马克思复活后说道:“全世界无产者,原谅我!”, 11 | 马克思是全盘否定了自己吗?\answer{wrong} 12 | \end{question} 13 | 14 | \begin{question} 15 | 你的人生就是一个笑话吗?\answer{right} 16 | \end{question} 17 | 18 | 19 | \begin{question} 20 | (扁舟)中的(扁)的正确读音是\pinyin{bian3}。\answer{wrong} 21 | \end{question} 22 | 23 | \begin{question} 24 | 铁比木头重。\answer{wrong} 25 | \end{question} 26 | 27 | -------------------------------------------------------------------------------- /examnone.tex: -------------------------------------------------------------------------------- 1 | \documentclass[answer=true,countunit=none,sheetsize=A4,paperprint=double,scoretable]{simplexam} 2 | 3 | \begin{document} 4 | 5 | \begin{center} 6 | \zihao{-3}\heiti 2018年火星高等学校招生统一考试\\ % 7 | \zihao{4} 文理综合 % 8 | \end{center} 9 | 10 | %{\bfseries \heiti 注意事项}: 11 | %\begin{enumerate} 12 | %\item 作弊请不要被老师发现。 13 | %\item 一旦被发现作弊,不要试图以空口求情或小恩小惠来逃避处罚。 14 | %\item “每个人都有一个他无法拒绝的价格。” 15 | %\end{enumerate} 16 | 17 | \iftoggle{auxinfoused}{\assesstaball}{} 18 | 19 | \iftoggle{auxinfoused}{\noindent\assesstabunit{1}}{} 20 | 21 | %\includequestions{questionliba}%[random=3] 22 | 23 | %测试answer的换行 24 | \begin{question} 25 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 26 | 你好好好 \answer{wrong} 27 | \end{question} 28 | 29 | 30 | \includequestions[random=2]{questionlibb}%[random=3] 31 | 32 | 33 | %测试blank命令中中文字符和数学字符连在一起时可能出现错误 34 | \begin{question} 35 | 真空中无线电磁波传播速度为\answerblank{光速或 $3*10^8$m/s}。 36 | \end{question} 37 | 38 | 39 | \includequestions[random=1]{questionlibc}%[random=3] 40 | 41 | 42 | \includequestions[random=2]{questionlibd}% 43 | 44 | 45 | 46 | %如果要增加汉字之间的间距,可以设置CJKglue,但必须要在字号命令改变命令之后设置 47 | \begin{question} 48 | 请根据拼音把句中的汉字填写出来。\vskip 1em 49 | 50 | \Large 51 | \xeCJKsetup{ 52 | CJKglue = {\hskip 0.2em plus .1em} 53 | } 54 | 55 | 段落中的\answerhanzi{拼音}文字 \answerpoints 56 | \end{question} 57 | 58 | %对比上一题可以看到,先设glue后设字号,无法增加汉字间距 59 | \begin{question} 60 | 请根据米字格中汉字把拼音填写出来。\vskip 1em 61 | 62 | \xeCJKsetup{ 63 | CJKglue = {\hskip 0.2em plus .1em} 64 | } 65 | 66 | \Large 67 | 68 | 段落中的\answerpinyin{拼音}文字 \answerpoints 69 | \end{question} 70 | 71 | 72 | \begin{question} 73 | 请根据拼音把下面的唐诗填写出来。\vskip 1em 74 | 75 | \centering 76 | \huge 77 | 78 | \answerhanzi{春晓} 79 | 80 | \Large 81 | 82 | \answerhanzi{孟浩然} 83 | 84 | \answerhanzi{春眠不觉晓},\answerhanzi{处处闻啼鸟}。 85 | 86 | \answerhanzi{夜来风雨声},\answerhanzi{花落知多少}。 87 | 88 | \answerpoints 89 | \end{question} 90 | 91 | 92 | 93 | %\SetupExSheets{ 94 | % headings ={runin-nonumber}, 95 | %} 96 | 97 | \begin{question} 98 | 作文题 99 | \begin{quotation} 100 | \large \kaishu 经验或曰历史给我们的教训却是,人民和政府从来就没有从历史学到任何东西,从未依照本应从从历史中抽绎出来的教训行事。每个时代都有它特殊的处境,都具有一种个别的情况,使它的举动行事,不得不全由自己来考虑、自己来解决。当重大事件纷乘交迫的时候,一般笼统的信条毫无裨益。回忆过去的同样情形,也是徒劳无功的。一个灰色的回忆不能抗衡``现在''的生动和自由。 101 | \end{quotation} 102 | \answerpoints 103 | \end{question} 104 | 105 | \drawcomposition[0.7]{20}{13} 106 | % 107 | \end{document} 108 | -------------------------------------------------------------------------------- /examsheetsize.tex: -------------------------------------------------------------------------------- 1 | \documentclass[answer=true,countunit=section,paperprint,sheetsize,scoretable]{simplexam} 2 | 3 | \begin{document} 4 | 5 | \begin{center} 6 | \zihao{-3}\heiti 2018年火星高等学校招生统一考试\\ % 7 | \zihao{4} 文理综合 % 8 | \end{center} 9 | 10 | %{\bfseries \heiti 注意事项}: 11 | %\begin{enumerate} 12 | %\item 作弊请不要被老师发现。 13 | %\item 一旦被发现作弊,不要试图以空口求情或小恩小惠来逃避处罚。 14 | %\item “每个人都有一个他无法拒绝的价格。” 15 | %\end{enumerate} 16 | 17 | \iftoggle{auxinfoused}{\assesstaball}{} 18 | 19 | \section{判断题:本大题共4小题,每小题5分,共20分。判断下列各题,正确的在题后括号内打\ding{52},错的打\ding{56}。} 20 | 21 | \includequestions{questionliba}%[random=3] 22 | 23 | %测试answer的换行 24 | \begin{question} 25 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 26 | 你好好好 \answer{wrong} 27 | \end{question} 28 | 29 | \section{选择题:本大题共4小题,每小题10分,共40分。在每小题给出的四个选项中,只有一项是符合题目要求的。} 30 | 31 | \includequestions[random=3]{questionlibb}%[random=3] 32 | 33 | 34 | \section{填空题:本题共4小题,每小题5分,共20分。} 35 | 36 | %测试blank命令中中文字符和数学字符连在一起时可能出现错误 37 | \begin{question} 38 | 真空中无线电磁波传播速度为\answerblank{光速或 $3*10^8$m/s}。 39 | \end{question} 40 | 41 | 42 | \includequestions[random=3]{questionlibc}%[random=3] 43 | 44 | 45 | \section{简答题。} 46 | 47 | 48 | \includequestions[random=3]{questionlibd}% 49 | 50 | 51 | \section{填字题:本题共4小题,每小题5分,共20分。} 52 | 53 | %如果要增加汉字之间的间距,可以设置CJKglue,但必须要在字号命令改变命令之后设置 54 | \begin{question} 55 | 请根据拼音把句中的汉字填写出来。\vskip 1em 56 | 57 | \Large 58 | \xeCJKsetup{ 59 | CJKglue = {\hskip 0.2em plus .1em} 60 | } 61 | 62 | 段落中的\answerhanzi{拼音}文字 \answerpoints 63 | \end{question} 64 | 65 | %对比上一题可以看到,先设glue后设字号,无法增加汉字间距 66 | \begin{question} 67 | 请根据米字格中汉字把拼音填写出来。\vskip 1em 68 | 69 | \xeCJKsetup{ 70 | CJKglue = {\hskip 0.2em plus .1em} 71 | } 72 | 73 | \Large 74 | 75 | 段落中的\answerpinyin{拼音}文字 \answerpoints 76 | \end{question} 77 | 78 | 79 | \begin{question} 80 | 请根据拼音把下面的唐诗填写出来。\vskip 1em 81 | 82 | \centering 83 | \huge 84 | 85 | \answerhanzi{春晓} 86 | 87 | \Large 88 | 89 | \answerhanzi{孟浩然} 90 | 91 | \answerhanzi{春眠不觉晓},\answerhanzi{处处闻啼鸟}。 92 | 93 | \answerhanzi{夜来风雨声},\answerhanzi{花落知多少}。 94 | 95 | \answerpoints 96 | \end{question} 97 | 98 | 99 | \section{作文题。阅读下面黑格尔《历史哲学》中的一段话,思考并提出你对这段话的理解话的理解} 100 | 101 | \SetupExSheets{ 102 | headings ={runin-nonumber}, 103 | } 104 | 105 | \begin{question} 106 | \begin{quotation} 107 | \large \kaishu 经验或曰历史给我们的教训却是,人民和政府从来就没有从历史学到任何东西,从未依照本应从从历史中抽绎出来的教训行事。每个时代都有它特殊的处境,都具有一种个别的情况,使它的举动行事,不得不全由自己来考虑、自己来解决。当重大事件纷乘交迫的时候,一般笼统的信条毫无裨益。回忆过去的同样情形,也是徒劳无功的。一个灰色的回忆不能抗衡``现在''的生动和自由。 108 | \end{quotation} 109 | \answerpoints 110 | \end{question} 111 | 112 | \drawcomposition[0.7]{20}{13} 113 | % 114 | \end{document} 115 | -------------------------------------------------------------------------------- /examchapter.tex: -------------------------------------------------------------------------------- 1 | \documentclass[answer=true,countunit=chapter,sheetsize=A4,paperprint=double,scoretable]{simplexam} 2 | 3 | \begin{document} 4 | 5 | \begin{center} 6 | \zihao{-3}\heiti 2018年火星高等学校招生统一考试\\ % 7 | \zihao{4} 文理综合 % 8 | \end{center} 9 | 10 | %{\bfseries \heiti 注意事项}: 11 | %\begin{enumerate} 12 | %\item 作弊请不要被老师发现。 13 | %\item 一旦被发现作弊,不要试图以空口求情或小恩小惠来逃避处罚。 14 | %\item “每个人都有一个他无法拒绝的价格。” 15 | %\end{enumerate} 16 | 17 | \iftoggle{auxinfoused}{\assesstaball}{} 18 | 19 | \chapter{判断题:本大题共4小题,每小题5分,共20分。判断下列各题,正确的在题后括号内打\ding{52},错的打\ding{56}。} 20 | 21 | \includequestions{questionliba}%[random=3] 22 | 23 | %测试answer的换行 24 | \begin{question} 25 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 26 | 你好好好 \answer{wrong} 27 | \end{question} 28 | 29 | \chapter{选择题:本大题共4小题,每小题10分,共40分。在每小题给出的四个选项中,只有一项是符合题目要求的。} 30 | 31 | \includequestions[random=3]{questionlibb}%[random=3] 32 | 33 | 34 | \chapter{填空题:本题共4小题,每小题5分,共20分。} 35 | 36 | %测试blank命令中中文字符和数学字符连在一起时可能出现错误 37 | \begin{question} 38 | 真空中无线电磁波传播速度为\answerblank{光速或 $3*10^8$m/s}。 39 | \end{question} 40 | 41 | 42 | \includequestions[random=3]{questionlibc}%[random=3] 43 | 44 | 45 | \chapter{简答题。} 46 | 47 | 48 | \includequestions[random=3]{questionlibd}% 49 | 50 | 51 | \chapter{填字题:本题共4小题,每小题5分,共20分。} 52 | 53 | %如果要增加汉字之间的间距,可以设置CJKglue,但必须要在字号命令改变命令之后设置 54 | \begin{question} 55 | 请根据拼音把句中的汉字填写出来。\vskip 1em 56 | 57 | \Large 58 | \xeCJKsetup{ 59 | CJKglue = {\hskip 0.2em plus .1em} 60 | } 61 | 62 | 段落中的\answerhanzi{拼音}文字 \answerpoints 63 | \end{question} 64 | 65 | %对比上一题可以看到,先设glue后设字号,无法增加汉字间距 66 | \begin{question} 67 | 请根据米字格中汉字把拼音填写出来。\vskip 1em 68 | 69 | \xeCJKsetup{ 70 | CJKglue = {\hskip 0.2em plus .1em} 71 | } 72 | 73 | \Large 74 | 75 | 段落中的\answerpinyin{拼音}文字 \answerpoints 76 | \end{question} 77 | 78 | 79 | \begin{question} 80 | 请根据拼音把下面的唐诗填写出来。\vskip 1em 81 | 82 | \centering 83 | \huge 84 | 85 | \answerhanzi{春晓} 86 | 87 | \Large 88 | 89 | \answerhanzi{孟浩然} 90 | 91 | \answerhanzi{春眠不觉晓},\answerhanzi{处处闻啼鸟}。 92 | 93 | \answerhanzi{夜来风雨声},\answerhanzi{花落知多少}。 94 | 95 | \answerpoints 96 | \end{question} 97 | 98 | 99 | \chapter{作文题。阅读下面黑格尔《历史哲学》中的一段话,思考并提出你对这段话的理解话的理解} 100 | 101 | \SetupExSheets{ 102 | headings ={runin-nonumber}, 103 | } 104 | 105 | \begin{question} 106 | \begin{quotation} 107 | \large \kaishu 经验或曰历史给我们的教训却是,人民和政府从来就没有从历史学到任何东西,从未依照本应从从历史中抽绎出来的教训行事。每个时代都有它特殊的处境,都具有一种个别的情况,使它的举动行事,不得不全由自己来考虑、自己来解决。当重大事件纷乘交迫的时候,一般笼统的信条毫无裨益。回忆过去的同样情形,也是徒劳无功的。一个灰色的回忆不能抗衡``现在''的生动和自由。 108 | \end{quotation} 109 | \answerpoints 110 | \end{question} 111 | 112 | \drawcomposition[0.7]{20}{13} 113 | % 114 | \end{document} 115 | -------------------------------------------------------------------------------- /examsection.tex: -------------------------------------------------------------------------------- 1 | \documentclass[answer=true,countunit=section,sheetsize=A3,paperprint=double,scoretable]{simplexam} 2 | 3 | \begin{document} 4 | 5 | \begin{center} 6 | \zihao{-3}\heiti 2018年火星高等学校招生统一考试\\ % 7 | \zihao{4} 文理综合 % 8 | \end{center} 9 | 10 | %{\bfseries \heiti 注意事项}: 11 | %\begin{enumerate} 12 | %\item 作弊请不要被老师发现。 13 | %\item 一旦被发现作弊,不要试图以空口求情或小恩小惠来逃避处罚。 14 | %\item “每个人都有一个他无法拒绝的价格。” 15 | %\end{enumerate} 16 | 17 | \iftoggle{auxinfoused}{\assesstaball}{} 18 | 19 | \section{判断题:本大题共4小题,每小题5分,共20分。判断下列各题,正确的在题后括号内打\ding{52},错的打\ding{56}。} 20 | 21 | \includequestions{questionliba}%[random=3] 22 | 23 | %测试answer的换行 24 | \begin{question} 25 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 26 | 你好好好 \answer{wrong} 27 | \end{question} 28 | 29 | \section{选择题:本大题共4小题,每小题10分,共40分。在每小题给出的四个选项中,只有一项是符合题目要求的。} 30 | 31 | \includequestions[random=3]{questionlibb}%[random=3] 32 | 33 | 34 | \section{填空题:本题共4小题,每小题5分,共20分。} 35 | 36 | %测试blank命令中中文字符和数学字符连在一起时可能出现错误 37 | \begin{question} 38 | 真空中无线电磁波传播速度为\answerblank{光速或 $3*10^8$m/s}。 39 | \end{question} 40 | 41 | 42 | \includequestions[random=3]{questionlibc}%[random=3] 43 | 44 | 45 | \section{简答题。} 46 | 47 | 48 | \includequestions[random=3]{questionlibd}% 49 | 50 | 51 | \section{填字题:本题共4小题,每小题5分,共20分。} 52 | 53 | %如果要增加汉字之间的间距,可以设置CJKglue,但必须要在字号命令改变命令之后设置 54 | \begin{question} 55 | 请根据拼音把句中的汉字填写出来。\vskip 1em 56 | 57 | \Large 58 | \xeCJKsetup{ 59 | CJKglue = {\hskip 0.2em plus .1em} 60 | } 61 | 62 | 段落中的\answerhanzi{拼音}文字 \answerpoints 63 | \end{question} 64 | 65 | %对比上一题可以看到,先设glue后设字号,无法增加汉字间距 66 | \begin{question} 67 | 请根据米字格中汉字把拼音填写出来。\vskip 1em 68 | 69 | \xeCJKsetup{ 70 | CJKglue = {\hskip 0.2em plus .1em} 71 | } 72 | 73 | \Large 74 | 75 | 段落中的\answerpinyin{拼音}文字 \answerpoints 76 | \end{question} 77 | 78 | 79 | \begin{question} 80 | 请根据拼音把下面的唐诗填写出来。\vskip 1em 81 | 82 | \centering 83 | \huge 84 | 85 | \answerhanzi{春晓} 86 | 87 | \Large 88 | 89 | \answerhanzi{孟浩然} 90 | 91 | \answerhanzi{春眠不觉晓},\answerhanzi{处处闻啼鸟}。 92 | 93 | \answerhanzi{夜来风雨声},\answerhanzi{花落知多少}。 94 | 95 | \answerpoints 96 | \end{question} 97 | 98 | 99 | \section{作文题。阅读下面黑格尔《历史哲学》中的一段话,思考并提出你对这段话的理解话的理解} 100 | 101 | \SetupExSheets{ 102 | headings ={runin-nonumber}, 103 | } 104 | 105 | \begin{question} 106 | \begin{quotation} 107 | \large \kaishu 经验或曰历史给我们的教训却是,人民和政府从来就没有从历史学到任何东西,从未依照本应从从历史中抽绎出来的教训行事。每个时代都有它特殊的处境,都具有一种个别的情况,使它的举动行事,不得不全由自己来考虑、自己来解决。当重大事件纷乘交迫的时候,一般笼统的信条毫无裨益。回忆过去的同样情形,也是徒劳无功的。一个灰色的回忆不能抗衡``现在''的生动和自由。 108 | \end{quotation} 109 | \answerpoints 110 | \end{question} 111 | 112 | \drawcomposition[0.7]{20}{13} 113 | % 114 | \end{document} 115 | -------------------------------------------------------------------------------- /examoptions.tex: -------------------------------------------------------------------------------- 1 | \documentclass[answer=true,countunit=section,paperprint,sheetsize,scoretable,scratchpaper=false,sealrule=false,headfoot=false]{simplexam} 2 | 3 | \begin{document} 4 | 5 | \begin{center} 6 | \zihao{-3}\heiti 2018年火星高等学校招生统一考试\\ % 7 | \zihao{4} 文理综合 % 8 | \end{center} 9 | 10 | %{\bfseries \heiti 注意事项}: 11 | %\begin{enumerate} 12 | %\item 作弊请不要被老师发现。 13 | %\item 一旦被发现作弊,不要试图以空口求情或小恩小惠来逃避处罚。 14 | %\item “每个人都有一个他无法拒绝的价格。” 15 | %\end{enumerate} 16 | 17 | \iftoggle{auxinfoused}{\assesstaball}{} 18 | 19 | \section{判断题:本大题共4小题,每小题5分,共20分。判断下列各题,正确的在题后括号内打\ding{52},错的打\ding{56}。} 20 | 21 | \includequestions{questionliba}%[random=3] 22 | 23 | %测试answer的换行 24 | \begin{question} 25 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 26 | 你好好好 \answer{wrong} 27 | \end{question} 28 | 29 | \section{选择题:本大题共4小题,每小题10分,共40分。在每小题给出的四个选项中,只有一项是符合题目要求的。} 30 | 31 | \includequestions[random=3]{questionlibb}%[random=3] 32 | 33 | 34 | \section{填空题:本题共4小题,每小题5分,共20分。} 35 | 36 | %测试blank命令中中文字符和数学字符连在一起时可能出现错误 37 | \begin{question} 38 | 真空中无线电磁波传播速度为\answerblank{光速或 $3*10^8$m/s}。 39 | \end{question} 40 | 41 | 42 | \includequestions[random=3]{questionlibc}%[random=3] 43 | 44 | 45 | \section{简答题。} 46 | 47 | 48 | \includequestions[random=3]{questionlibd}% 49 | 50 | 51 | \section{填字题:本题共4小题,每小题5分,共20分。} 52 | 53 | %如果要增加汉字之间的间距,可以设置CJKglue,但必须要在字号命令改变命令之后设置 54 | \begin{question} 55 | 请根据拼音把句中的汉字填写出来。\vskip 1em 56 | 57 | \Large 58 | \xeCJKsetup{ 59 | CJKglue = {\hskip 0.2em plus .1em} 60 | } 61 | 62 | 段落中的\answerhanzi{拼音}文字 \answerpoints 63 | \end{question} 64 | 65 | %对比上一题可以看到,先设glue后设字号,无法增加汉字间距 66 | \begin{question} 67 | 请根据米字格中汉字把拼音填写出来。\vskip 1em 68 | 69 | \xeCJKsetup{ 70 | CJKglue = {\hskip 0.2em plus .1em} 71 | } 72 | 73 | \Large 74 | 75 | 段落中的\answerpinyin{拼音}文字 \answerpoints 76 | \end{question} 77 | 78 | 79 | \begin{question} 80 | 请根据拼音把下面的唐诗填写出来。\vskip 1em 81 | 82 | \centering 83 | \huge 84 | 85 | \answerhanzi{春晓} 86 | 87 | \Large 88 | 89 | \answerhanzi{孟浩然} 90 | 91 | \answerhanzi{春眠不觉晓},\answerhanzi{处处闻啼鸟}。 92 | 93 | \answerhanzi{夜来风雨声},\answerhanzi{花落知多少}。 94 | 95 | \answerpoints 96 | \end{question} 97 | 98 | 99 | \section{作文题。阅读下面黑格尔《历史哲学》中的一段话,思考并提出你对这段话的理解话的理解} 100 | 101 | \SetupExSheets{ 102 | headings ={runin-nonumber}, 103 | } 104 | 105 | \begin{question} 106 | \begin{quotation} 107 | \large \kaishu 经验或曰历史给我们的教训却是,人民和政府从来就没有从历史学到任何东西,从未依照本应从从历史中抽绎出来的教训行事。每个时代都有它特殊的处境,都具有一种个别的情况,使它的举动行事,不得不全由自己来考虑、自己来解决。当重大事件纷乘交迫的时候,一般笼统的信条毫无裨益。回忆过去的同样情形,也是徒劳无功的。一个灰色的回忆不能抗衡``现在''的生动和自由。 108 | \end{quotation} 109 | \answerpoints 110 | \end{question} 111 | 112 | \drawcomposition[0.7]{20}{13} 113 | % 114 | \end{document} 115 | -------------------------------------------------------------------------------- /questionlibc.tex: -------------------------------------------------------------------------------- 1 | 2 | \begin{question} 3 | 用$4,2,0,7$这四个数字写出一个不读零的四位数是\answerblank{4270},写出一个读零 4 | 的数字是\answerblank{4027}。 5 | \end{question} 6 | 7 | 8 | \begin{question} 9 | 小明有两件颜色不同的上衣和两条颜色不同的裤子,他可以有\answerblank{4}种不同 10 | 的穿法。 11 | \end{question} 12 | 13 | \begin{question} 14 | 有语文、数学、品德三种书,小明、小丽、小红各拿一本;小明说:“我拿的是语文 15 | 书”。小丽说:“我拿的不是数学书”。小红拿的是\answerblank{数学}书。 16 | \end{question} 17 | 18 | \begin{question} 19 | 给下面句子添加标点符号: 20 | “咦,是谁救了小白兔\answerblank{?}”小动物们说\answerblank{,}“真得谢谢他呢 \answerblank{!}” 21 | \end{question} 22 | 23 | 24 | \begin{question} 25 | 若函数~$f(x)=x^{6m^2-5m-4}\,(m\in\mathbb{Z})$~的图像关于~$y$~轴对称, 26 | 且~$f(2)\sqrt{\frac{2}{2^2}+\frac{1}{2}}=1,\] 105 | 所以数列单调增加.由极限存在准则II,数列必定收敛.\score{3} 106 | 设数列的极限为 $A$ ,对递推公式两边同时取极限得到 107 | \[A=\sqrt{A+2}\] 108 | 解得$A=2$,即数列$\{x_n\}$的极限为$2$.\score{2} 109 | \end{solution} 110 | 111 | 112 | \begin{question} 113 | 设事件$A$和$B$相互独立,证明$A$和$\bar{B}$相互独立. 114 | \end{question} 115 | 116 | \begin{solution} 117 | $P (A \cdot \bar{B}) = P (A - B) = P (A - A B)$ \score{1} 118 | \qquad $= P (A) - P (A B) = P (A) - P (A) P (B)$ \score{1} 119 | \qquad $= P (A) (1 - P (B)) = P (A) P (\bar{B})$ \score{0.5} 120 | 所以$A$和$\bar{B}$相互独立.\score{2} 121 | 122 | \answerpoints[4]%{4.5} 123 | \end{solution} 124 | 125 | 126 | \begin{question} 127 | 用配方法将二次型 $f = x_1^2 + 2 x_1 x_2 - 6 x_1 x_3 + 2 x_2^2 - 12 128 | x_2 x_3 + 9 x^2_3$ 化为标准形 $f = d_1 y^2_1 + d_2 y^2_2 + d_3 y^2_3$ 。 129 | \end{question} 130 | 131 | \begin{solution}{4.5} 132 | $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 133 | \qquad\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 134 | \qquad\qquad$= (x_1 + x_2 - 3 x_3)^2 + x_2^2 - 6 x_2 x_3$ \dotfill 1分 \par 135 | \qquad\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 136 | \qquad\qquad$= (x_1 + x_2 - 3 x_3)^2 + (x_2 - 3 x_3)^2 - 9 x_3^2$ \dotfill 1.5分\par 137 | 令$y_1 = x_1 + x_2 - 3 x_3, y_2 = x_2 - 3 x_3, y_3 = x_3$, \newline 138 | 则$f = y_1^2 + y_2^2 - 9y_3^2$为标准形。 \dotfill 2分 139 | \end{solution} 140 | 141 | 142 | } 143 | 144 | \section{填字题:共4小题,每小题2.5分,共10分。} 145 | 146 | { 147 | 148 | \Setquestiondefaultpts{2.5} 149 | 150 | %如果要增加汉字之间的间距,可以设置CJKglue,但必须要在字号命令改变命令之后设置 151 | \begin{question} 152 | 请根据拼音把句中的汉字填写出来。\vskip 1em 153 | 154 | \centering 155 | \Large 156 | \xeCJKsetup{ 157 | CJKglue = {\hskip 0.2em plus .1em} 158 | } 159 | 160 | 段落中的\answerhanzi{拼音}文字 \answerpoints[2] 161 | 162 | \end{question} 163 | 164 | %对比上一题可以看到,先设glue后设字号,无法增加汉字间距 165 | \begin{question} 166 | 请根据米字格中汉字把拼音填写出来。\vskip 1em 167 | \centering 168 | \xeCJKsetup{ 169 | CJKglue = {\hskip 0.2em plus .1em} 170 | } 171 | 172 | \Large 173 | 174 | \answerpinyinbox{拼音文字} \answerpoints[2.5] 175 | 176 | \end{question} 177 | 178 | 179 | \begin{question} 180 | 请根据汉字把拼音填写出来。\vskip 1em 181 | \centering 182 | \Large 183 | 184 | \answerpinyin{白日依山\xpinyin{尽}{jin4}} \answerpoints[2.5] 185 | 186 | \end{question} 187 | 188 | 189 | \begin{question} 190 | 请根据拼音把下面的唐诗填写出来。\vskip 1em 191 | 192 | \centering 193 | \huge 194 | 195 | \answerhanzi{春晓} 196 | 197 | \Large 198 | 199 | \answerhanzi{孟浩然} 200 | 201 | \answerhanzi{春眠不觉晓},\answerhanzi{处处闻啼鸟}。 202 | 203 | \answerhanzi{夜来风雨声},\answerhanzi{花落知多少}。 204 | 205 | \answerpoints[2.5] 206 | 207 | \end{question} 208 | 209 | } 210 | 211 | \section{作文题:共30分。阅读下面黑格尔《历史哲学》中的一段话,思考并提出你对这段话的理解话的理解} 212 | 213 | { 214 | 215 | \Setquestiondefaultpts{30} 216 | 217 | \SetupExSheets{ 218 | headings ={runin-nonumber}, 219 | } 220 | 221 | \begin{question} 222 | \begin{quotation} 223 | \large \kaishu 经验或曰历史给我们的教训却是,人民和政府从来就没有从历史学到任何东西,从未依照本应从从历史中抽绎出来的教训行事。每个时代都有它特殊的处境,都具有一种个别的情况,使它的举动行事,不得不全由自己来考虑、自己来解决。当重大事件纷乘交迫的时候,一般笼统的信条毫无裨益。回忆过去的同样情形,也是徒劳无功的。一个灰色的回忆不能抗衡``现在''的生动和自由。 224 | \end{quotation} 225 | 226 | \answerpoints[26] 227 | 228 | \end{question} 229 | 230 | 231 | 232 | \drawcomposition[0.7]{20}{13} 233 | 234 | } 235 | 236 | 237 | 238 | 239 | \clearpage 240 | { 241 | \hyphenpenalty=100 %断词阈值, 值越大越不容易出现断词 242 | \tolerance=10000 %丑度, 10000为最大无溢出盒子, 参考the texbook 第6章 243 | \hbadness=100 %如果丑度超过hbadness这一阀值, 那么就会发出警告 244 | 245 | \answersinfounit{1} 246 | 247 | \answersinfounit{2} 248 | 249 | \answersinfounit[5cm]{3} 250 | 251 | \answersinfounit[14cm]{4} 252 | 253 | \answersinfounit[14cm]{5} 254 | 255 | } 256 | 257 | % 258 | \end{document} 259 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Date of last change: 2022-11-10 to version v1.0c 2 | 3 | # 一个简单试卷文档类 simplexam 4 | 5 | --------------------------------------------------------------- 6 | 7 | simplexam.cls --- A simple class for chinese exam paper 8 | 9 | based on exsheets bundles 10 | 11 | Maintained by huzhenzhen 12 | 13 | E-mail: hzzmail@163.com 14 | 15 | Released under the LaTeX Project Public License v1.3c or later 16 | 17 | --------------------------------------------------------------- 18 | 19 | 20 | ## 1. 介绍 21 | 22 | 一个简单的试卷模板类 simplexam。试卷分有答案和无答案两种模式,使用选项 `answer` 控制。 23 | 当输出分数统计表时,`answer`选项也控制实际得分统计,当打印答案时输出得分统计,否则不输出。 24 | 试卷各大题划分标记使用`chapter`,`section`等正常文档章节命令。默认使用`section`,如果要使用`chapter`,则需设置`countunit=chapter` 25 | 26 | ## 2. 用法 27 | 28 | ### 2.1 题目写法 29 | 30 | **试卷题目**全部用`question`环境,可以利用一个可选的必选参数给该题目设置分值,不给出则使用默认的分值。比如: 31 | ``` 32 | \begin{question}{5} 33 | question contents 34 | \end{question} 35 | ``` 36 | 37 | 当不给出分值时,则会使用默认的分值,默认的分值可以局部设置。比如某个大题各小题每题3分,那么在该大题的小题开始之前设置: 38 | ``` 39 | \Setquestiondefaultpts{3} 40 | ``` 41 | 42 | 表示接下来的小题的分值为3分。该默认分值可以不断根据题目进行局部修改。 43 | 44 | ### 2.2 答案写法 45 | 46 | **判断题答案**用`\answer{right}`和`\answer{wrong}`表示对和错。可以带可选参数表示实际得分比如`\answer[1]{right}` 47 | 48 | **选择题答案**用`\answer{选择选项}`表示,选中的选项可以任意数量。可以带可选参数表示实际得分比如`\answer[1]{A}`。选择题选项可以用`tasks`环境设置,也可以通过`\options`命令设置。比如: 49 | ``` 50 | \begin{tasks}(4) 51 | \task 最大似然估计 52 | \task 有效估计 53 | \task 一致估计 54 | \end{tasks} 55 | ``` 56 | 或 57 | ``` 58 | \options[3]{最大似然估计} 59 | {有效估计} 60 | {一致估计} 61 | ``` 62 | 其中:`tasks`环境中(4)是指定一行中放置选项的栏数,而`\options`命令后面给出[3]是指定选项的个数,一行中的栏数则自动调整, 63 | 64 | **填空题答案**用`\answerblank{答案内容}`表示。可以带可选参数表示实际得分比如`\answerblank[2]{A}` 65 | 66 | **汉字填空题**用`\answerhanzi{汉字内容}`表示答案。 67 | 68 | **拼音填空题**用`\answerpinyin{汉字内容}`或`\answerpinyinbox{汉字内容}`表示答案,后者给出的汉子带米字格,但注意不能在其中使用`\xpinyin`命令,而前者可以。 69 | 70 | 由于`\answerhanzi`和`\answerpinyin`命令比较复杂,一个题中可能出现多个,因此不带可选参数表示得分。这类题目给出得分直接用命令`\answerpoints[3]`给出。 71 | 72 | **简答/证明题答案**用`solution`环境表示。简答题得分用一个带花括号的可选参数表示,比如: 73 | ``` 74 | \begin{solution}{5} 75 | answer contents 76 | \end{solution} 77 | ``` 78 | 79 | 注意:实际的得分值除了在答题命令处比如`\answerblank[2]{A}`给出外,都可以利用`\answerpoints[3]`命令给出。 80 | 除简答题外,可以在question环境内用该命令设置实得分。比如: 81 | 82 | ``` 83 | \begin{question} 84 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 85 | 你好好好 \answer[0]{wrong} 86 | \end{question} 87 | ``` 88 | 和 89 | ``` 90 | \begin{question} 91 | 尼采说道:“世上只有一个基督徒,他已经死了”,这句话中所说的“他”是指彼得吗? 92 | 你好好好 \answer{wrong}\answerpoints[0] 93 | \end{question} 94 | ``` 95 | 两者是一致的。 96 | 97 | 98 | 而简答题则需要在solution环境中给出,比如: 99 | ``` 100 | \begin{solution} 101 | answer contents \answerpoints[3] 102 | \end{solution} 103 | ``` 104 | 105 | 106 | 107 | 108 | ## 选项和命令说明: 109 | 110 | * `answer` 打印试卷答案 111 | 112 | `answer=true`或`answer`,则打印答案; 113 | 114 | `answer=false`,则不打印答案 115 | 116 | * `countunit` 设置小题的计数关联划分: 117 | `countunit=chapter`,题名序号根据chapter进行计数 118 | 119 | `countunit=section`或`countunit`,题名序号根据section进行计数 120 | 121 | `countunit=none`,题名序号全文统一计数 122 | 123 | * `sheetsize` 设置试卷的纸张大小 124 | 125 | `sheetsize=A4`或`sheetsize`,试卷纸张为A4 126 | 127 | `sheetsize=A3`,试卷纸张为A3 128 | 129 | * `paperprint` 设置试卷是否双面打印 130 | 131 | `paperprint=double`或`paperprint`,试卷纸张双面打印 132 | 133 | `paperprint=single`,试卷纸张单面打印 134 | 135 | * `scoretable` 设置是否输出分数统计表/评分表 136 | 137 | `scoretable=true`或`scoretable`,输出分数统计表 138 | 139 | `scoretable=false`,不输出分数统计表 140 | 141 | * `scoreshow` 设置是否在评分表中输出实际得数 142 | 143 | `scoreshow=true`或`scoreshow`,输出实得分数 144 | 145 | `scoreshow=false`,不输出实得分数 146 | 147 | 148 | * `scratchpaper` 设置是否输出草稿纸 149 | 150 | `scratchpaper=true`或`scratchpaper`,输出草稿纸 151 | 152 | `scratchpaper=false`,不输出草稿纸 153 | 154 | * `sealrule` 设置是否输出密封线和密封区 155 | 156 | `sealrule=true`或`sealrule`,输出密封线 157 | 158 | `sealrule=false`,不输出密封线 159 | 160 | * `headfoot` 设置是否输出页眉页脚 161 | 162 | `headfoot=true`或`headfoot`,输出页眉页脚 163 | 164 | `headfoot=false`,不输出页眉页脚 165 | 166 | * 答案页的输出使用命令: 167 | 168 | `\answerstabunit{1}` 表示以表格形式输出第1大题的答案 169 | 170 | `\answerstabunit[4cm]{1}` 表示以表格形式输出第1大题的答案,可选参数[4cm]指定了答案列的宽度 171 | 172 | `\answersinfounit{1}` 表示以parbox的形式输出第1大题的答案 173 | 174 | `\answerstabunit[4cm]{1}` 表示以parbox形式输出第1大题的答案,可选参数[4cm]指定了parbox的宽度,每个小题的答案放在一个parbox中。 175 | 176 | * 评分表输出使用命令: 177 | 178 | 各大题独立的评分表可以利用scoretable选项自动生成。 179 | 全部大题的总的得分表可以利用如下命令生成: 180 | 181 | `\assesstaball` 表示以表格形式输出总的得分表 182 | 183 | * 页眉页脚内容的设置命令: 184 | 185 | `\pageheading{试\hspace{4em}卷\hspace{4em}标\hspace{4em}题}` 用于设置页眉的内容 186 | 187 | `\pagefooting{第\thepage 页 共\totalpage 页; \today}` 用于设置页脚的内容 188 | 189 | * 密封区信息的设置命令: 190 | 191 | `\pagestudent{学院:\underline{\hspace{5em}}班级:\underline{\hspace{5em}} 192 | 姓名:\underline{\hspace{5em}}学号:\underline{\hspace{5em}}}` 用于设置应试者信息,注意该信息是横向写的,只是在处理时做了旋转。 193 | 194 | `\pagesealing{\small 学\\[1em]生\\[1em]答\\[1em]卷\\[1em]不\\[1em]要\\[1em]超\\[1em]过\\[1em]此\\[1em]线}` 用于设置密封线的信息,注意该信息是竖向写的,所以其中用`\\[1cm]`来给出垂直间距。 195 | 196 | 197 | ## 主要特点 198 | 199 | * 答案输出选项控制 200 | * 纸张大小的选项控制 201 | * 单双面打印不同设置(包括纸张和密封线)的选项控制 202 | * 大题单元不同设置的选项控制 203 | * 题目从题库随机选择 204 | * 自动的大题和全局计分表(分值和得分的分离) 205 | * 题目格式局部可设置 206 | * 简化的填字题和拼音题 207 | * 自动的页眉页脚和草稿页 208 | * 选择题选项可以利用tasks手动给出也可以用options命令自动设置 209 | * 不打印答案时自动留出适当空白以便填写答案 210 | * 插入图表可以用浮动体或者非浮动体 211 | * 可输出单独的答案页 212 | 213 | 214 | 215 | ## 注意事项 216 | 217 | * 作为文档类引入 218 | * 标题直接用center环境输入 219 | * 非浮动体图表采用insertfig和inserttab环境,带两个参数分别为题注和label,比如: 220 | ``` 221 | \begin{insertfig}{caption content}{label content} 222 | fig contents 223 | \begin{insertfig} 224 | ``` 225 | 226 | * 出题方法参考示例试卷 227 | * 其它页面可视元素按需编辑 228 | * 正文字体和数学字体按需设置 229 | * 采用xelatex编译 230 | 231 | * 注意事项 232 | * 大题划分后需要存在小题,否则因为分数统计的原因会报错 233 | * 在简单题的solution环境中,行间数学公式如果使用`\[\]`出错,那么可以替换为`$$$$` 234 | * 填空题的答案中如果有公式,当出现问题时可以在`$$`前后加上空格 235 | 236 | simplexam 类主要依赖于如下宏包: 237 | latex3 kernel,etoolbox,ctex,xpinyin,amsmath,unicode-math,titlesec,exsheets,tasks, 238 | tikz,xcolor,ccaption,subfigure,mwe 239 | 240 | 代码实现参考了: 241 | sd44 的 danexam、 242 | Jianrui Lyu 的 jnuexam、 243 | htharoldht 的 USTBExam、 244 | Charles Bao 的 BHCexam、 245 | 唐绍东的 CMC 等。 246 | 出于快速功能实现考虑,部分代码直接借用,深表感谢! 247 | 248 | ## need to do 249 | 250 | * 之前出于功能实现考虑,部分代码未用latex3实现,后期考虑类似exsheets和task完全用latex3实现。 251 | * 一些细节仍有待完善。 252 | * 增加更多的选项控制 253 | 254 | * 题目的随机随机变动顺序(可以参考esami的实现) 255 | * 选择题选项随机变动顺序 256 | 257 | 258 | 259 | 260 | # 更新历史 261 | * 2018-12-01 to version v1.0 262 | * 2019-01-25 to version v1.0a 263 | * 2019-04-18 to version v1.0b 完善了答案页的输出 264 | * 2022-11-10 to version v1.0c 修复tasks接口改变后带来的选项标签错误等问题 265 | - task标签修改为如下 266 | ``` 267 | \settasks{ 268 | label= \alph*., 269 | label-align=left, 270 | label-width = {1em}, 271 | label-offset={0.4em}, 272 | item-indent={2.75em}, %注意这里做了更多的缩进使其与题目内容对齐,若要让标签与题目数字对齐则修改为1.4em即可 273 | column-sep={2pt}, 274 | before-skip={-0.7em}, 275 | after-skip={-0.7em}, 276 | after-item-skip = -2pt plus 2pt minus 2pt 277 | } 278 | ``` 279 | - solution的解答增加了两个标签形式:runin-solution和margin-solution,用户可以根据需求设置: 280 | ``` 281 | \SetupExSheets{ 282 | counter-format=qu[1]., 283 | counter-within={\counterwithinunit}, 284 | headings ={runin-simple}, 285 | headings-format=\normalsize, 286 | solution/headings={runin-solution}, %根据需求设置“答”的标签样式 287 | solution/name={\textcolor{blue}{答:}}, 288 | } 289 | ``` 290 | 291 | 292 | 293 | -------------------------------------------------------------------------------- /questionlibb.tex: -------------------------------------------------------------------------------- 1 | 2 | 3 | \begin{question} 4 | 土(产)——给括号中的字选择正确的解释 \answer{A} 5 | \begin{tasks}(2) 6 | \task 出自人工或天然的物品 \task 泛指房地或财物 \task 自然生长、人工制造或种 7 | 植、出品 8 | \end{tasks} 9 | \end{question} 10 | 11 | \begin{question} 12 | (如)此——给括号中的字选择正确的解释 \answer{A} 13 | \begin{tasks}(4) 14 | \task 似;好像 \task 及;比得上 \task 依照 \task 如果 15 | \end{tasks} 16 | \end{question} 17 | 18 | \begin{question} 19 | 已知双曲线 $C\colon\,\tfrac{x^2}{a^2}-\tfrac{y^2}{b^2}=1\,(a>0,b>0)$ 20 | 的一条渐近线方程为 $y=\tfrac{\sqrt{5}}{2}x$ ,且与椭 21 | 圆$\tfrac{x^2}{12}+\tfrac{y^2}{3}=1$ 有公共焦点,则 $C$ 的方程为\answer{B} 22 | 23 | \begin{tasks}(4) 24 | \task $\tfrac{x^2}{8}-\tfrac{y^2}{10}=1$ \task $\tfrac{x^2}{4}-\tfrac{y^2}{5}=1$ \task $\tfrac{x^2}{5}-\tfrac{y^2}{4}=1$ \task $\tfrac{x^2}{4}-\tfrac{y^2}{3}=1$ 25 | \end{tasks} 26 | \end{question} 27 | 28 | \begin{question} 29 | 某城市为了解游客人数的变化规律,提高旅游服务质量,收集并整理了2014年1 30 | 月至2016年12月期间月接待游客量(单位:万人)的数据(图1). 31 | 32 | 根据图\ref{fig:egimage:a},下列结论错误的是\answer{A} 33 | 34 | \begin{insertfig}{月接待游客量折线图}{fig:egimage:a} 35 | \includegraphics[width=0.4\linewidth]{example-image.pdf} 36 | \end{insertfig}% 37 | 38 | \begin{tasks}(1) 39 | \task 月接待游客量逐月增加 40 | \task 年接待游客量逐年增加 41 | \task 各年的月接待游客量高峰期大致在7,8月份 42 | \task 各年1月至6月的月接待游客量相对7月至12月,波动性更小,变化比较平稳 43 | \end{tasks} 44 | \end{question} 45 | 46 | \begin{question} 47 | 若~$a$、$b$~是直线, $\alpha$、$\beta$~是平面, 48 | 则以下命题中真命题是\answer{D} 49 | 50 | \begin{tasks}(1) 51 | \task 若~$a$、$b$~异面, $a\subset\alpha$,$b\subset\beta$, 且~$a\perp b$, 则~$\alpha\perp\beta$ 52 | \task 若~$a\parallel b$, $a\subset\alpha$, $b\subset\beta$,则~$\alpha\parallel\beta$ 53 | \task 若~$a\parallel \alpha$, $b\subset\beta$, 则~$a$、$b$ 异面 54 | \task 若~$a\perp b$, $a\perp\alpha$,$b\perp\beta$, 则~$\alpha\perp\beta$ 55 | \end{tasks} 56 | \end{question} 57 | 58 | 59 | \begin{question} 60 | 已知集合~$A=\{x\mid {x-1}<3 \}$,集合~$B=\{y| 61 | y=x^2+2x+1,x\in\mathbb{R}\}$, 则~$A\cap \complement_U B$~为\answer{C} 62 | 63 | \begin{tasks}(2) 64 | \task $[\,0,4)$ 65 | \task $(-\infty,-2\,]\cup[4,+\infty)$ 66 | \task $(-2,0)$ 67 | \task $(0,4)$ 68 | \end{tasks} 69 | \end{question} 70 | 71 | 72 | \begin{question} 73 | 下列各排列哪个是偶排列 \answer{D} 74 | \options{3712456} 75 | {36715284} 76 | {654321} 77 | {41253} 78 | \end{question} 79 | 80 | 81 | 82 | \begin{question} 83 | 若三阶行列式 $\left|\begin{array}{ccc} 84 | a_1 & a_2 & a_3\\ 85 | 2 b_1 - a_1 & 2 b_2 - a_2 & 2 b_3 - a_3\\ 86 | c_1 & c_2 & c_3 87 | \end{array}\right| = 2$,则 $\left|\begin{array}{ccc} 88 | a_1 & a_2 & a_3\\ 89 | b_1 & b_2 & b_3\\ 90 | c_1 & c_2 & c_3 91 | \end{array}\right|=$ \answer{A} 92 | \options{1} 93 | {-1} 94 | {2} 95 | {-2} 96 | \end{question} 97 | 98 | 99 | 100 | \begin{question} 101 | 已知矩阵 $A = \left(\begin{array}{ccc} 102 | 1 & 1 & 0\\ 103 | 1 & x & 0\\ 104 | 0 & 0 & 1 105 | \end{array}\right)$ 其中两个特征值为 $\lambda_1 = 1$ 和 $\lambda_2 106 | = 2$,则则 $x=$ \answer{B} 107 | \options{2} 108 | {1} 109 | {0} 110 | {-1} 111 | \end{question} 112 | 113 | 114 | 115 | \begin{question} 116 | 二次型 $f = 4 x_1^2 - 2 x_1 x_2 + 6 x_2^2$ 对应的矩阵等于 \answer{C} 117 | \options{$\left(\begin{array}{cc} 118 | 4 & - 2\\ 119 | - 2 & 6 120 | \end{array}\right)$} 121 | {$\left(\begin{array}{cc} 122 | 2 & - 2\\ 123 | - 2 & 3 124 | \end{array}\right)$} 125 | {$\left(\begin{array}{cc} 126 | 4 & - 1\\ 127 | - 1 & 6 128 | \end{array}\right)$} 129 | {$\left(\begin{array}{cc} 130 | 2 & - 1\\ 131 | - 1 & 3 132 | \end{array}\right)$} 133 | \end{question} 134 | 135 | 136 | 137 | \begin{question} 138 | 对任何一个本校男学生,以$A$表示他是大一学生,$B$表示他是大二学生, 139 | 则事件$A$和$B$是\answer{B} 140 | \options[4]{对立事件} 141 | {互斥事件} 142 | {既是对立事件又是互斥事件} 143 | {不是对立事件也不是互斥事件} 144 | \end{question} 145 | 146 | 147 | 148 | \begin{question} 149 | 下列说法\uline{不正确}的是\answer{B} 150 | \options[4]{大数定律说明了大量相互独立且同分布的随机变量的均值的稳定性} 151 | {大数定律说明大量相互独立且同分布的随机变量的均值近似于正态分布} 152 | {中心极限定理说明了大量相互独立且同分布的随机变量的和的稳定性} 153 | {中心极限定理说明大量相互独立且同分布的随机变量的和近似于正态分布} 154 | \end{question} 155 | 156 | % \vfill 157 | 158 | \begin{question} 159 | 在数理统计中,对总体$X$和样本$(X_1,\cdots,X_n)$的说法哪个是\uline{不正确}的\answer{D} 160 | \options{总体是随机变量} 161 | {样本是$n$元随机变量} 162 | {$X_1, \cdots, X_n$相互独立} 163 | {$X_1 = X_2 =\cdots = X_n$} 164 | \end{question} 165 | 166 | % \vfill 167 | 168 | \begin{question} 169 | 样本平均数$\bar{X}$\uline{未必是}总体期望值$\mu$的\answer{A} 170 | \options{最大似然估计} 171 | {有效估计} 172 | {一致估计} 173 | {无偏估计} 174 | \end{question} 175 | 176 | 177 | \begin{question} 178 | 已知集合 $A=\{(x,y)|x^2+y^2=1\}$ ,$B=\{(x,y)|y=x\}$,则 $A{\,\raisebox{0.8mm}{\scaleobj{0.55}{\bigcap}}\,}B$ 中元素的个数为 179 | \begin{tasks}(4) 180 | \task $3$ \task $2$ \task $1$ \task $0$ 181 | \end{tasks} 182 | \end{question} 183 | 184 | \begin{question} 185 | 设复数 $z$ 满足 $(1+\mathrm{i}\,)z=2\,\mathrm{i}$,则 $|z|=$ 186 | \begin{tasks}(4) 187 | \task $\frac{1}{2}$ \task $\frac{\sqrt{2}}{2}$ \task $\sqrt{2}$ \task $2$ 188 | \end{tasks} 189 | \end{question} 190 | 191 | 192 | 193 | \begin{question} 194 | $(x+y)(2x-y)^5$ 的展开式中 $x^3y^3$ 的系数为 195 | \begin{tasks}(4) 196 | \task $-80$ \task $-40$ \task $40$ \task $80$ 197 | \end{tasks} 198 | \end{question} 199 | 200 | \begin{question} 201 | 已知双曲线 $C\colon\,\frac{x^2}{a^2}-\frac{y^2}{b^2}=1\,(a>0,b>0)$ 的一条渐近线方程为 $y=\frac{\sqrt{5}}{2}x$ ,且与椭圆 202 | $\frac{x^2}{12}+\frac{y^2}{3}=1$ 有公共焦点,则 $C$ 的方程为 203 | \begin{tasks}(4) 204 | \task $\frac{x^2}{8}-\frac{y^2}{10}=1$ \task $\frac{x^2}{4}-\frac{y^2}{5}=1$ \task $\frac{x^2}{5}-\frac{y^2}{4}=1$ \task $\frac{x^2}{4}-\frac{y^2}{3}=1$ 205 | \end{tasks} 206 | \end{question} 207 | 208 | \begin{question} 209 | 设函数 $f(x)=\cos\Big(x+\frac{\pi}{3}\Big)$,则下列结论错误的是 210 | \begin{tasks}(2) 211 | \task $f(x)$ 的一个周期为 $-2\pi$ \task $y=f(x)$ 的图像关于直线 $x=\frac{8\pi}{3}$ 对称 212 | \task $f(x+\pi)$ 的一个零点为 $x=\frac{\pi}{6}$ \task $f(x)$在 $\Big(\frac{\pi}{2},\pi\Big)$ 单调递减 213 | \end{tasks} 214 | \end{question} 215 | 216 | 217 | \begin{question} 218 | 已知圆柱的高为1,它的两个底面的圆周在直径为2的同一个球的球面上,则该圆柱的体积为 219 | \begin{tasks}(4) 220 | \task $\pi$ \task $\frac{3\pi}{4}$ \task $\frac{\pi}{2}$ \task 0 221 | \end{tasks} 222 | \end{question} 223 | 224 | 225 | \begin{question} 226 | 等差数列的首项为1,公差不为0. 若 $a_2$,$a_3$,$a_6$ 成等比数列,则前 6 项的和为 227 | \begin{tasks}(4) 228 | \task $-24$ \task $-3$ \task 3 \task 8 229 | \end{tasks} 230 | \end{question} 231 | 232 | \begin{question} 233 | 已知椭圆 $C\colon\,\frac{x^2}{a^2}+\frac{y^2}{b^2}=1\,(a>b>0)$,的左、右顶点分别为 $A_1$,$A_2$,且以线段 $A_1A_2$ 为直径的圆与直线 $bx-ay+2ab=0$ 相切,则 $C$ 的离心率为 234 | \begin{tasks}(4) 235 | \task $\frac{\sqrt{6}}{3}$ \task $\frac{\sqrt{3}}{3}$ \task $\frac{\sqrt{2}}{3}$ \task $\frac{1}{3}$ 236 | \end{tasks} 237 | \end{question} 238 | 239 | 240 | \begin{question}已知函数 $f(x)=x^2-2x+a(e^{x-1}+e^{-x+1})$ 有唯一零点,则 $a=$ 241 | \begin{tasks}(4) 242 | \task $-\frac{1}{2}$ \task $\frac{1}{3}$ \task $\frac{1}{2}$ \task 1 243 | \end{tasks} 244 | \end{question} 245 | 246 | 247 | \begin{question} 248 | 在矩形 $ABCD$ 中,$AB=1$,$AD=2$,动点 $P$ 在以点 $C$ 为圆心且与 $BD$ 相切的圆上.\\ 249 | 若 $\overrightarrow{{AP}}=\lambda\overrightarrow{{AB} }+\mu\overrightarrow{{AD}}$,则 $\lambda+\mu$ 的最大值为 250 | \begin{tasks}(4) 251 | \task 3 \task $2\sqrt{2}$ \task $\sqrt{5}$ \task 2 252 | \end{tasks} 253 | \end{question} 254 | 255 | \begin{question} 256 | 下列各排列哪个是偶排列 \answer{D} 257 | \options{3712456} 258 | {36715284} 259 | {654321} 260 | {41253} 261 | \end{question} 262 | 263 | 264 | 265 | \begin{question} 266 | 若三阶行列式 $\left|\begin{array}{ccc} 267 | a_1 & a_2 & a_3\\ 268 | 2 b_1 - a_1 & 2 b_2 - a_2 & 2 b_3 - a_3\\ 269 | c_1 & c_2 & c_3 270 | \end{array}\right| = 2$,则 $\left|\begin{array}{ccc} 271 | a_1 & a_2 & a_3\\ 272 | b_1 & b_2 & b_3\\ 273 | c_1 & c_2 & c_3 274 | \end{array}\right|=$ \answer{A} 275 | \options{1} 276 | {-1} 277 | {2} 278 | {-2} 279 | \end{question} 280 | 281 | 282 | 283 | \begin{question} 284 | 已知矩阵 $A = \left(\begin{array}{ccc} 285 | 1 & 1 & 0\\ 286 | 1 & x & 0\\ 287 | 0 & 0 & 1 288 | \end{array}\right)$ 其中两个特征值为 $\lambda_1 = 1$ 和 $\lambda_2 289 | = 2$,则则 $x=$ \answer{B} 290 | \options{2} 291 | {1} 292 | {0} 293 | {-1} 294 | \end{question} 295 | 296 | % \vfill 297 | 298 | \begin{question} 299 | 二次型 $f = 4 x_1^2 - 2 x_1 x_2 + 6 x_2^2$ 对应的矩阵等于 \answer{C} 300 | \options{$\left(\begin{array}{cc} 301 | 4 & - 2\\ 302 | - 2 & 6 303 | \end{array}\right)$} 304 | {$\left(\begin{array}{cc} 305 | 2 & - 2\\ 306 | - 2 & 3 307 | \end{array}\right)$} 308 | {$\left(\begin{array}{cc} 309 | 4 & - 1\\ 310 | - 1 & 6 311 | \end{array}\right)$} 312 | {$\left(\begin{array}{cc} 313 | 2 & - 1\\ 314 | - 1 & 3 315 | \end{array}\right)$} 316 | \end{question} 317 | 318 | 319 | 320 | \begin{question} 321 | 对任何一个本校男学生,以$A$表示他是大一学生,$B$表示他是大二学生,则事件$A$和$B$是 322 | \answer{B} 323 | \options{对立事件} 324 | {互斥事件} 325 | {既是对立事件又是互斥事件} 326 | {不是对立事件也不是互斥事件} 327 | \end{question} 328 | 329 | 330 | 331 | \begin{question} 332 | 下列说法\uline{不正确}的是\answer{B} 333 | \options{大数定律说明了大量相互独立且同分布的随机变量的均值的稳定性} 334 | {大数定律说明大量相互独立且同分布的随机变量的均值近似于正态分布} 335 | {中心极限定理说明了大量相互独立且同分布的随机变量的和的稳定性} 336 | {中心极限定理说明大量相互独立且同分布的随机变量的和近似于正态分布} 337 | \end{question} 338 | 339 | 340 | 341 | \begin{question} 342 | 在数理统计中,对总体$X$和样本$(X_1,\cdots,X_n)$的说法哪个是\uline{不正确}的\answer{D} 343 | \options{总体是随机变量} 344 | {样本是$n$元随机变量} 345 | {$X_1, \cdots, X_n$相互独立} 346 | {$X_1 = X_2 =\cdots = X_n$} 347 | \end{question} 348 | 349 | 350 | 351 | \begin{question} 352 | 样本平均数$\bar{X}$\uline{未必是}总体期望值$\mu$的\answer{A} 353 | \options{最大似然估计} 354 | {有效估计} 355 | {一致估计} 356 | {无偏估计} 357 | \end{question} -------------------------------------------------------------------------------- /questionlibd.tex: -------------------------------------------------------------------------------- 1 | \begin{question} 2 | 我们班有26名男同学,23名女同学,按一小组最多六人来计算,全班最多可以分为几 3 | 个小组? 4 | \end{question} 5 | 6 | \begin{solution} 7 | \begin{align*} 8 | 26 + 23 = 49\text{(名)} 9 | 49 \div 6 = 8 \cdots \cdots 1 \text{(个)} 10 | \end{align*} 11 | 最多可以分为9个小组。 12 | \end{solution} 13 | 14 | 15 | \begin{question} 16 | 求不定积分$\displaystyle\int e^{2x}\,(\tan x+1)^2 dx$。 17 | \end{question} 18 | 19 | \begin{solution} 20 | \everymath{\displaystyle}% 21 | 原式$=\int e^{2x}\,\sec^2 x dx+2\int e^{2x}\,\tan x dx$ \score{2} 22 | \hspace{5em}${}=\int e^{2x}\,d(\tan x)+ 2\int e^{2x}\,\tan x dx$ \score{4} 23 | \hspace{5em}${}= e^{2x}\,\tan x - 2\int e^{2x}\,\tan x dx+ 2\int e^{2x}\,\tan x dx$ \score{6} 24 | \hspace{5em}${}= e^{2x}\,\tan x + C$ \score{8} 25 | \end{solution} 26 | 27 | 28 | \begin{question} 29 | 求过点$A(1,2,-1), B(2,3,0),C(3,3,2)$ 的三角形$\triangle ABC$ 的面积和它们确定的平面方程. 30 | \end{question} 31 | 32 | \begin{solution} 33 | 由题设$\overrightarrow{AB}=(1,1,1),\overrightarrow{AC}=(2,1,3)$, \score{2} 34 | 故$\overrightarrow{AB}\times \overrightarrow{AC}=\begin{vmatrix} 35 | \vec{i}&\vec{j} &\vec{k}\\ 36 | 1&1&1\\ 37 | 2&1&3\\ 38 | \end{vmatrix}=(2,-1,-1)$, \score{4} 39 | 三角形$\triangle ABC$ 的面积为$S_{\triangle ABC}=\dfrac{1}{2}\big|\overrightarrow{AB}\times 40 | \overrightarrow{AC}\big|=\dfrac{1}{2}\sqrt{6}.$ \score{6} 41 | 所求平面的方程为$2(x-2)-(y-3)-z=0$, 即$2x-y-z-1=0$ \score{8} 42 | \end{solution} 43 | 44 | 45 | \begin{question} 46 | 计算四阶行列式 $A = \left|\begin{array}{cccc} 47 | 0 & 1 & 2 & 3\\ 48 | 1 & 2 & 3 & 0\\ 49 | 2 & 3 & 0 & 1\\ 50 | 3 & 0 & 1 & 2 51 | \end{array}\right|$ 的值. 52 | \end{question} 53 | 54 | \begin{solution} 55 | $A = \left|\begin{array}{cccc} 56 | 0 & 1 & 2 & 3\\ 57 | 1 & 2 & 3 & 0\\ 58 | 2 & 3 & 0 & 1\\ 59 | 3 & 0 & 1 & 2 60 | \end{array}\right| = \left|\begin{array}{cccc} 61 | 0 & 1 & 2 & 3\\ 62 | 1 & 2 & 3 & 0\\ 63 | 0 & - 1 & - 6 & 1\\ 64 | 0 & - 6 & - 8 & 2 65 | \end{array}\right| = 1 \cdot (- 1)^{2 + 1} \left|\begin{array}{ccc} 66 | 1 & 2 & 3\\ 67 | - 1 & - 6 & 1\\ 68 | - 6 & - 8 & 2 69 | \end{array}\right|$ \score{4} 70 | \qquad $= -\left|\begin{array}{ccc} 71 | 1 & 2 & 3\\ 72 | 0 & - 4 & 4\\ 73 | 0 & 4 & 20 74 | \end{array}\right| = - \left|\begin{array}{cc} 75 | - 4 & 4\\ 76 | 4 & 20 77 | \end{array}\right| = -(-4\cdot20-4\cdot4) = 96$ \score{8} 78 | \end{solution} 79 | 80 | 81 | \begin{question} 82 | 用配方法将二次型 $f = x_1^2 + 2 x_1 x_2 - 6 x_1 x_3 + 2 x_2^2 - 12 83 | x_2 x_3 + 9 x^2_3$ 化为标准形 $f = d_1 y^2_1 + d_2 y^2_2 + d_3 y^2_3$ . 84 | \end{question} 85 | 86 | \begin{solution} 87 | $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 88 | \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 89 | \qquad$= (x_1 + x_2 - 3 x_3)^2 + x_2^2 - 6 x_2 x_3$ \score{3} 90 | \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 91 | \qquad$= (x_1 + x_2 - 3 x_3)^2 + (x_2 - 3 x_3)^2 - 9 x_3^2$ \score{6} 92 | 令$y_1 = x_1 + x_2 - 3 x_3, y_2 = x_2 - 3 x_3, y_3 = x_3$, \newline 93 | 则$f = y_1^2 + y_2^2 - 9y_3^2$为标准形.\score{8} 94 | \end{solution} 95 | 96 | 97 | \begin{question} 98 | 设每发炮弹命中飞机的概率是0.2且相互独立,现在发射100发炮弹.\par 99 | 用切贝谢夫不等式估计命中数目$\xi$在10发到30发之间的概率.\par 100 | 用中心极限定理估计命中数目$\xi$在10发到30发之间的概率. 101 | \end{question} 102 | 103 | \begin{solution} 104 | $E\xi = n p = 100 \cdot 0.2 = 20, D\xi = n p q = 100 \cdot 0.2 \cdot 0.8 = 16$. \score{2} 105 | $P (10 < \xi < 30) = P (| \xi - E \xi | < 10) \ge 1 - \frac{D\xi}{10^2} 106 | = 1 - \frac{16}{100} = 0.84$. \score{4} 107 | $P (10 < \xi < 30) \approx \Phi_0 \left( \frac{30 - 20}{\sqrt{16}}\right) 108 | - \Phi_0 \left( \frac{10 - 20}{\sqrt{16}} \right)$ \score{6} 109 | \qquad $= 2 \Phi_0 (2.5) - 1 = 2 \cdot 0.9938 - 1 =0.9876$ \score{8} 110 | \end{solution} 111 | 112 | 113 | \begin{question} 114 | 从正态总体$N(\mu,\sigma^2)$中抽出样本容量为16的样本,算得其平均数为3160,标准差为100. 115 | 试检验假设$H_0:\mu=3140$是否成立($\alpha = 0.01$). 116 | \end{question} 117 | 118 | \begin{solution} 119 | 待检假设 $H_0 : \mu = 3140$. \score{1} 120 | 选取统计量 $T = \frac{\bar{X}-\mu}{S / \sqrt{n}} \sim t(n-1)$. \score{3} 121 | 查表得到 $t_{\alpha} = t_{\alpha} (n - 1) = t_{0.01} (15) =2.947$. \score{5} 122 | 计算统计值 $t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} =\frac{3160-3140}{100/4} = 0.8$.\score{7} 123 | 由于 $| t | < t_{\alpha}$, 故接受 $H_0$, 即假设成立. \score{8} 124 | \end{solution} 125 | 126 | 127 | \begin{question} 128 | 设数列$\{x_n\}$满足$x_1=\sqrt2$,$x_{n+1}=\sqrt{2+x_n}$.证明数列收敛,并求出极限. 129 | \end{question} 130 | 131 | \begin{solution} 132 | 事实上,由于$x_1<2$,且$x_k<2$时 133 | \[x_{k+1}=\sqrt{2+x_k}<\sqrt{2+2}=2,\] 134 | 由数学归纳法知对所有$n$都有$x_n<2$,即数列有上界. 135 | 又由于 136 | \[\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,\] 137 | 所以数列单调增加.由极限存在准则II,数列必定收敛.\score{4} 138 | 设数列的极限为 $A$ ,对递推公式两边同时取极限得到 139 | \[A=\sqrt{A+2}\] 140 | 解得$A=2$,即数列$\{x_n\}$的极限为$2$.\score{8} 141 | \end{solution} 142 | 143 | 144 | 145 | \begin{question} 146 | 设事件$A$和$B$相互独立,证明$A$和$\bar{B}$相互独立. 147 | \end{question} 148 | 149 | \begin{solution} 150 | $P (A \cdot \bar{B}) = P (A - B) = P (A - A B)$ \score{2} 151 | \qquad $= P (A) - P (A B) = P (A) - P (A) P (B)$ \score{4} 152 | \qquad $= P (A) (1 - P (B)) = P (A) P (\bar{B})$ \score{6} 153 | 所以$A$和$\bar{B}$相互独立.\score{8} 154 | \end{solution} 155 | 156 | 157 | \begin{question} 158 | 计算四阶行列式 $A = \left|\begin{array}{cccc} 159 | 0 & 1 & 2 & 3\\ 160 | 1 & 2 & 3 & 0\\ 161 | 2 & 3 & 0 & 1\\ 162 | 3 & 0 & 1 & 2 163 | \end{array}\right|$ 的值。 164 | \end{question} 165 | 166 | \begin{solution} 167 | $A = \left|\begin{array}{cccc} 168 | 0 & 1 & 2 & 3\\ 169 | 1 & 2 & 3 & 0\\ 170 | 2 & 3 & 0 & 1\\ 171 | 3 & 0 & 1 & 2 172 | \end{array}\right| = \left|\begin{array}{cccc} 173 | 0 & 1 & 2 & 3\\ 174 | 1 & 2 & 3 & 0\\ 175 | 0 & - 1 & - 6 & 1\\ 176 | 0 & - 6 & - 8 & 2 177 | \end{array}\right| = 1 \cdot (- 1)^{2 + 1} \left|\begin{array}{ccc} 178 | 1 & 2 & 3\\ 179 | - 1 & - 6 & 1\\ 180 | - 6 & - 8 & 2 181 | \end{array}\right|$ \dotfill 4分\par 182 | \qquad\qquad $= -\left|\begin{array}{ccc} 183 | 1 & 2 & 3\\ 184 | 0 & - 4 & 4\\ 185 | 0 & 4 & 20 186 | \end{array}\right| = - \left|\begin{array}{cc} 187 | - 4 & 4\\ 188 | 4 & 20 189 | \end{array}\right| = -(-4\cdot20-4\cdot4) = 96$ \dotfill 8分 190 | \end{solution} 191 | 192 | 193 | \begin{question} 194 | 用配方法将二次型 $f = x_1^2 + 2 x_1 x_2 - 6 x_1 x_3 + 2 x_2^2 - 12 195 | x_2 x_3 + 9 x^2_3$ 化为标准形 $f = d_1 y^2_1 + d_2 y^2_2 + d_3 y^2_3$ 。 196 | \end{question} 197 | 198 | \begin{solution} 199 | $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 200 | \qquad\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 201 | \qquad\qquad$= (x_1 + x_2 - 3 x_3)^2 + x_2^2 - 6 x_2 x_3$ \dotfill 3分 \par 202 | \qquad\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 203 | \qquad\qquad$= (x_1 + x_2 - 3 x_3)^2 + (x_2 - 3 x_3)^2 - 9 x_3^2$ \dotfill 6分\par 204 | 令$y_1 = x_1 + x_2 - 3 x_3, y_2 = x_2 - 3 x_3, y_3 = x_3$, \newline 205 | 则$f = y_1^2 + y_2^2 - 9y_3^2$为标准形。\dotfill 8分 206 | \end{solution} 207 | 208 | 209 | \begin{question} 210 | 设二元随机变量$(\xi, \eta)$的联合分布表为 211 | \begin{tabular}{|l|l|l|l|} 212 | \hline 213 | $\xi \backslash \eta$ & -1 & 0 & 1\\ 214 | \hline 215 | 0 & 0 & 1/3 & 0\\ 216 | \hline 217 | 1 & 1/3 & 0 & 1/3\\ 218 | \hline 219 | \end{tabular}。\par 220 | (1) 求关于$\xi$和$\eta$的边缘分布。\par 221 | (2) 判断$\xi$和$\eta$的独立性。\par 222 | (3) 判断$\xi$和$\eta$的相关性。 223 | \end{question} 224 | 225 | \begin{solution} 226 | (1) 边缘分布为 \begin{tabular}{|l|l|l|} 227 | \hline 228 | $\xi$ & 0 & 1\\ 229 | \hline 230 | $P$ & 1/3 & 2/3\\ 231 | \hline 232 | \end{tabular}, \ \begin{tabular}{|l|l|l|l|} 233 | \hline 234 | $\eta$ & -1 & 0 & 1\\ 235 | \hline 236 | $P$ & 1/3 & 1/3 & 1/3\\ 237 | \hline 238 | \end{tabular}. \dotfill 2分 \par 239 | (2) 由$P(\xi = 0, \eta = 0) = \frac{1}{3} \neq \frac{1}{9} = P(\xi = 0) P(\eta = 0)$, 240 | 知$\xi$和$\eta$不独立. \dotfill 4分 \par 241 | (3) 由联合分布表求得$\xi \eta$的分布为 \begin{tabular}{|l|l|l|l|} 242 | \hline 243 | $\xi \eta$ & -1 & 0 & 1\\ 244 | \hline 245 | $P$ & 1/3 & 1/3 & 1/3\\ 246 | \hline 247 | \end{tabular}.\dotfill 6分\par 248 | 因此有 $\cov(\xi, \eta) = E(\xi\eta) - E\xi E\eta = 0 -\frac{2}{3} \cdot 0 = 0$, 249 | 因此$\xi$和$\eta$不相关. \dotfill 8分 250 | \end{solution} 251 | 252 | 253 | \begin{question} 254 | 设随机变量$\xi \sim N (1, 4)$,求$P (- 1 < \xi < 5)$。 255 | \end{question} 256 | 257 | \begin{solution} 258 | $P(-1<\xi<5) = \Phi_0\left(\frac{5-1}{2}\right) - \Phi_0\left(\frac{-1-1}{2}\right)$ \dotfill 2分 \par 259 | \qquad $= \Phi_0 (2) - \Phi_0 (- 1)$ \dotfill 4分 \par 260 | \qquad $= \Phi_0 (2) + \Phi_0 (1) - 1$ \dotfill 6分 \par 261 | \qquad $= 0.9773 + 0.8413 - 1 = 0.8186$ \dotfill 8分 262 | \end{solution} 263 | 264 | 265 | 266 | \begin{question} 267 | 设每发炮弹命中飞机的概率是0.2且相互独立,现在发射100发炮弹。\par 268 | (1) 用切贝谢夫不等式估计命中数目$\xi$在10发到30发之间的概率。\par 269 | (2) 用中心极限定理估计命中数目$\xi$在10发到30发之间的概率。 270 | \end{question} 271 | 272 | \begin{solution} 273 | $E\xi = n p = 100 \cdot 0.2 = 20, D\xi = n p q = 100 \cdot 0.2 \cdot 0.8 = 16$. \dotfill 2分 \par 274 | (1) $P (10 < \xi < 30) = P (| \xi - E \xi | < 10) \geq 1 - \frac{D\xi}{10^2} 275 | = 1 - \frac{16}{100} = 0.84$. \dotfill 4分 \par 276 | (2) $P (10 < \xi < 30) \approx \Phi_0 \left( \frac{30 - 20}{\sqrt{16}}\right) 277 | - \Phi_0 \left( \frac{10 - 20}{\sqrt{16}} \right)$ \dotfill 6分\par 278 | \qquad $= 2 \Phi_0 (2.5) - 1 = 2 \cdot 0.9938 - 1 =0.9876$ \dotfill 8分 279 | \end{solution} 280 | 281 | \begin{question} 282 | 从正态总体$N(\mu,\sigma^2)$中抽出样本容量为16的样本,算得其平均数为3160,标准差为100。 283 | 试检验假设$H_0:\mu=3140$是否成立($\alpha = 0.01$)。 284 | \end{question} 285 | 286 | \begin{solution} 287 | (1) 待检假设 $H_0 : \mu = 3140$. \dotfill 1分\par 288 | (2) 选取统计量 $T = \frac{\bar{X}-\mu}{S / \sqrt{n}} \sim t(n-1)$. \dotfill 3分 \par 289 | (3) 查表得到 $t_{\alpha} = t_{\alpha} (n - 1) = t_{0.01} (15) =2.947$. \dotfill 5分 \par 290 | (4) 计算统计值 $t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} =\frac{3160-3140}{100/4} = 0.8$.\dotfill 7分 \par 291 | (5) 由于 $| t | < t_{\alpha}$, 故接受 $H_0$, 即假设成立. \dotfill 8分 292 | \end{solution} 293 | 294 | 295 | \begin{question} 296 | 不使用矩阵可相似对角化的判别定理,直接用矩阵的运算和性质证明下面的矩阵$A 297 | =\left(\begin{array}{cc} 298 | 1 & 1\\ 299 | 0 & 1 300 | \end{array}\right)$不能相似对角化,即不存在可逆矩阵$P$和对角阵$\Lambda$使得$P^{-1}AP=\Lambda$。 301 | \end{question} 302 | 303 | \begin{solution} 304 | 假设有$P = \left(\begin{array}{cc} 305 | a & b\\ 306 | c & d 307 | \end{array}\right)$使得$P^{-1}AP = \Lambda$,即$AP=P\Lambda$。\dotfill 2分\par 308 | 则有 $$\left(\begin{array}{cc} 309 | a + c & b + d\\ 310 | c & d 311 | \end{array}\right) = \left(\begin{array}{cc} 312 | 1 & 1\\ 313 | 0 & 1 314 | \end{array}\right) \left(\begin{array}{cc} 315 | a & b\\ 316 | c & d 317 | \end{array}\right) = \left(\begin{array}{cc} 318 | a & b\\ 319 | c & d 320 | \end{array}\right) \left(\begin{array}{cc} 321 | \lambda_1 & \\ 322 | & \lambda_2 323 | \end{array}\right) = \left(\begin{array}{cc} 324 | a \lambda_1 & b \lambda_2\\ 325 | c \lambda_1 & d \lambda_2 326 | \end{array}\right)$$ 因此有 $\left\{ \begin{array}{llll} 327 | a + c & = & a \lambda_1 & (1)\\ 328 | b + d & = & b \lambda_2 & (2)\\ 329 | c & = & c \lambda_1 & (3)\\ 330 | d & = & d \lambda_2 & (4) 331 | \end{array} \right.$ \dotfill 6分\par 332 | 由第1个和第3个方程消去$\lambda_1$,可以得到 $c^2 = 0$ 即 $c=0$; 333 | 由第2个和第4个方程消去$\lambda_2$,可以得到 $d^2 = 0$ 即 $d=0$。 334 | 因此矩阵$P$不可逆,矛盾。\dotfill 10分 335 | \end{solution} 336 | 337 | 338 | \begin{question} 339 | 设事件$A$和$B$相互独立,证明$A$和$\bar{B}$相互独立。 340 | \end{question} 341 | 342 | \begin{solution} 343 | $P (A \cdot \bar{B}) = P (A - B) = P (A - A B)$ \dotfill 3分 \par 344 | \qquad $= P (A) - P (A B) = P (A) - P (A) P (B)$ \dotfill 6分 \par 345 | \qquad $= P (A) (1 - P (B)) = P (A) P (\bar{B})$ \dotfill 9分 \par 346 | 所以$A$和$\bar{B}$相互独立。\dotfill 10分 347 | \end{solution} 348 | -------------------------------------------------------------------------------- /simplexam.cls: -------------------------------------------------------------------------------- 1 | %% 2 | %% --------------------------------------------------------------- 3 | %% simplexam.cls --- A simple class for chinese exam paper 4 | %% 一个简单试卷文档类 simplexam 5 | %% based on exsheets bundles 6 | %% Maintained by huzhenzhen 7 | %% E-mail: hzzmail@163.com 8 | %% Released under the LaTeX Project Public License v1.3c or later 9 | %% --------------------------------------------------------------- 10 | %% 11 | 12 | 13 | \NeedsTeXFormat{LaTeX2e} 14 | \RequirePackage{expl3} 15 | \ProvidesExplClass {simplexam} {2022/11/10} {v1.0c} {a simple exam}%同时开启latex3语法 16 | \RequirePackage{ xparse,xtemplate,l3keys2e,etoolbox} 17 | 18 | \xdef\unitname{section} 19 | \xdef\paperprintname{double} 20 | \xdef\papersizename{A4} 21 | \bool_new:N \l__simplexam_prtanswer_bool %判断打印答案用的boolean 22 | \bool_new:N \l__simplexam_scoretab_bool %判断打印得分表用的boolean 23 | \bool_new:N \l__simplexam_scratch_bool %判断输出草稿纸用的boolean 24 | \bool_new:N \l__simplexam_sealrule_bool %判断输出密封线用的boolean 25 | \bool_new:N \l__simplexam_headfoot_bool %判断输出页眉页脚用的boolean 26 | \bool_new:N \l__simplexam_scoreshow_bool %boolean选项用来设置是否显示评分表中的分值 27 | \bool_set_true:N \l__simplexam_scratch_bool %默认输出草稿纸 28 | \bool_set_true:N \l__simplexam_sealrule_bool %默认输出密封区和线 29 | \bool_set_true:N \l__simplexam_headfoot_bool %默认输出页眉页脚 30 | \bool_set_false:N \l__simplexam_scoreshow_bool %默认不显示评分表中的分值 31 | 32 | \bool_new:N \l__simplexam_inanswersheet_bool %判断是否在单独的答案表中的,若在那么一些命令的逻辑要做修改,比如\answerpoints就不能再执行了。 33 | \bool_set_false:N \l__simplexam_inanswersheet_bool %默认不在答案表中 34 | 35 | \int_new:N \l_temp_answer_int %临时变量 36 | \tl_new:N \l__simplexam_tempans_tl %临时变量 37 | 38 | \newtoggle{auxinfoused} 39 | \togglefalse{auxinfoused} 40 | 41 | \keys_define:nn {simplexam} %设置文档类选项,没用子组/subgroup 42 | { 43 | answer .bool_set:N = \l__simplexam_prtanswer_bool, %选项answer用来设置boolean 44 | answer .default:n = true, %默认设置值为true 45 | answer .value_required:n = false, %可以不给出设置值 46 | 47 | countunit .code:n = {\xdef\unitname{#1}}, %定义大题单元所依赖的划分,是section还是chapter还是none 48 | countunit .default:n = section, %默认设置值为section 49 | countunit .value_required:n = false,%可以不给出设置值 50 | 51 | paperprint .code:n ={\xdef\paperprintname{#1}},%双面打印 52 | paperprint .default:n = {double}, %默认设置值为double,single 53 | paperprint .value_required:n = false, %可以不给出设置值 54 | 55 | scoretable .bool_set:N = \l__simplexam_scoretab_bool, %选项用来设置boolean 56 | scoretable .default:n = true, %默认设置值为true 57 | scoretable .value_required:n = false, %可以不给出设置值 58 | 59 | scoreshow .bool_set:N = \l__simplexam_scoreshow_bool, %boolean选项用来设置是否显示评分表中的分值 60 | scoreshow .default:n = true, %默认设置值为true 61 | scoreshow .value_required:n = false, %可以不给出设置值 62 | 63 | sheetsize.code:n ={\xdef\papersizename{#1}},%纸张大小,用sheet而不是paper,因为paper和papersize两个选项geometry宏包已经用了。 64 | %若使用paper和papersize会报选项错误。 65 | sheetsize.default:n = {A4}, %默认设置值为A4,A3 66 | sheetsize.value_required:n = false, %可以不给出设置值 67 | 68 | scratchpaper.bool_set:N = \l__simplexam_scratch_bool, %选项scratchpaper用来设置输出草稿纸 69 | scratchpaper.default:n = true, %默认设置值为true 70 | scratchpaper.value_required:n = false, %可以不给出设置值 71 | 72 | sealrule.bool_set:N = \l__simplexam_sealrule_bool, %选项sealrule用来设置输出密封线 73 | sealrule.default:n = true, %默认设置值为true 74 | sealrule.value_required:n = false, %可以不给出设置值 75 | 76 | headfoot.bool_set:N = \l__simplexam_headfoot_bool, %选项sealrule用来设置输出密封线 77 | headfoot.default:n = true, %默认设置值为true 78 | headfoot.value_required:n = false, %可以不给出设置值 79 | 80 | } 81 | 82 | \ProcessKeysOptions { simplexam } 83 | 84 | \ifcsstring{unitname}{chapter}%当以章为单位时,采用book类。 85 | {\LoadClass[openany] { book } 86 | %\let\cleardoublepage=\clearpage 87 | } 88 | {\LoadClass { article }} 89 | 90 | 91 | \RequirePackage 92 | { 93 | geometry, 94 | xcolor, 95 | xpinyin, 96 | amssymb, 97 | mwe, 98 | graphicx, 99 | } 100 | 101 | 102 | \ifcsstring{papersizename}{A4} 103 | {\ifcsstring{paperprintname}{double} 104 | {\geometry{a4paper,twoside,left=30mm,right=20mm,top=20mm,bottom=15mm}} 105 | {\geometry{a4paper,left=30mm,right=20mm,top=20mm,bottom=15mm}} 106 | } 107 | {\ifcsstring{paperprintname}{double} 108 | {\geometry{a3paper,twoside,landscape,twocolumn,columnsep=40mm,left=40mm,right=30mm,top=20mm,bottom=15mm}} 109 | {\geometry{a3paper,landscape,twocolumn,columnsep=40mm,left=35mm,right=35mm,top=20mm,bottom=15mm}} 110 | } 111 | %\geometry{showframe} 112 | 113 | 114 | \RequirePackage[tbtags]{amsmath} 115 | \RequirePackage{scalerel}%缩放公式大小 116 | \RequirePackage{fontspec}% fontset=sourcesans, 117 | \RequirePackage[zihao=-4]{ctex}% fontset=sourcesans, 118 | \RequirePackage[math-style=ISO, bold-style=ISO]{unicode-math} 119 | \everymath{\displaystyle} 120 | 121 | 122 | 123 | \DeclareMathOperator{\dif}{\mathop{}\!\mathrm{d}} 124 | \DeclareMathOperator{\upe}{\operatorname{e}} 125 | \DeclareMathOperator{\cov}{\operatorname{cov}} 126 | \DeclareMathOperator{\upi}{\operatorname{i}} 127 | \DeclareMathOperator{\sgn}{\operatorname{sgn}} 128 | \DeclareMathOperator{\grad}{\operatorname{grad}} 129 | 130 | \newcommand{\abs}[1]{\left| #1 \right|} 131 | 132 | \renewcommand{\Re}{\operatorname{Re}} 133 | \renewcommand{\Im}{\operatorname{Im}} 134 | \renewcommand{\le}{\leqslant} 135 | \renewcommand{\leq}{\leqslant} 136 | \renewcommand{\ge}{\geqslant} 137 | \renewcommand{\geq}{\geqslant} 138 | 139 | 140 | \RequirePackage[pagestyles]{titlesec} 141 | \titleformat{\section}{\zihao{4}\heiti}{\chinese{section} 、}{0em}{}% 142 | [ 143 | \bool_if:NTF \l__simplexam_scoretab_bool {%当需要打印评分表时 144 | \ifcsstring{unitname}{section}{%当大题以section为单位时 145 | \iftoggle{auxinfoused}{\assesstabunit{\thesection}}{}}{} 146 | } 147 | ] 148 | \titlespacing*{\section}{0pt}{0.5\baselineskip}{0.5\baselineskip}[0pt] 149 | %得分表可以使用手动命令完成,也可以如这里般用章节命令 150 | \ifcsstring{unitname}{chapter}%当以章为单位时,设置chapter格式。 151 | { 152 | \titleformat{\chapter}{\zihao{4}\heiti}{\chinese{chapter} 、}{0em}{}% 153 | [ 154 | \bool_if:NTF \l__simplexam_scoretab_bool {%当需要打印评分表时 155 | \ifcsstring{unitname}{chapter}{%当大题以section为单位时 156 | \iftoggle{auxinfoused}{\assesstabunit{\thechapter}}{}}{} 157 | } 158 | ] 159 | \titlespacing*{\chapter}{0pt}{0.5\baselineskip}{0.5\baselineskip}[0pt] 160 | }{} 161 | 162 | %页面页脚样式 163 | %设置页面页脚线存在bug不能直接设置\setheadrule{~pt}默认的宽度会冲掉它 164 | %所以使用下面的两句重定义命令进行修改 165 | \renewcommand\headrule{\setheadrule{0.4pt}} 166 | \renewcommand\footrule{\setfootrule{0pt}} 167 | 168 | \def\pageheadingudf{试\hspace{4em}卷\hspace{4em}标\hspace{4em}题} 169 | \def\pagefootingudf{第\thepage 页 共\totalpage 页; 时间:\ \today} 170 | \def\pageheading#1{\def\pageheadingudf{#1}} 171 | \def\pagefooting#1{\def\pagefootingudf{#1}} 172 | 173 | \def\totalpage{0} 174 | \newpagestyle{main}{ %%内容奇数页左,偶数页右 175 | \sethead[]%偶数页左 176 | [\pageheadingudf]%偶数页中 177 | []%偶数页右 178 | {}%奇数页左 179 | {\pageheadingudf}%奇数页中 180 | {}%奇数页右 181 | \setfoot{}{\pagefootingudf}{}% 182 | \headrule% 183 | \footrule}% 184 | \bool_if:NTF \l__simplexam_headfoot_bool 185 | {\pagestyle{main}} 186 | {\pagestyle{empty}} 187 | 188 | \RequirePackage{exsheets}%所有题目都用question环境,便于从题库中主动/随机选择 189 | \DeclareInstance{exsheets-heading}{runin-simple}{default}{%定制question的heading 190 | runin = true , 191 | %title-format = \rmfamily,%\large\scshape 192 | number-format = \color{blue}\bfseries,%\itshape 193 | %points-format = \rmfamily,%\large\bfseries 194 | number-pre-code ={},%\color{blue}\itshape\rmfamily\mdseries 195 | number-post-code =\space, 196 | join ={main[r,vc]number[r,vc](0pt,0pt) ;}, 197 | attach ={main[r,vc]points[l,vc](\linewidth,0pt)} 198 | } 199 | 200 | \DeclareInstance{exsheets-heading}{runin-nonumber}{default}{%定制question的heading 201 | runin = true , 202 | number-pre-code ={}, 203 | number-post-code =\space, 204 | %join ={main[r,vc]number[r,vc](0pt,0pt) ;}, 205 | attach ={main[r,vc]points[l,vc](\linewidth,0pt)} 206 | } 207 | 208 | \DeclareInstance{exsheets-heading}{block-simple}{default}{%定制question的heading 209 | attach = {main[l,vc]title[l,vc](0pt,0pt)}, 210 | } 211 | 212 | 213 | % 类似于question,solution的标题行也是利用coffin将如下 214 | % ‘main’, ‘title’, ‘subtitle’,‘number’ and ‘points’ 5个内容连接起来。 215 | % 主要的选项是runin,inline这两者为true,那么标题行不是单独成一行。 216 | % main实际是标题行本身,如果runin或inline选项为false,那么这就是一行构成的coffin 217 | % 若runin或inline选项为false则似乎是宽度为0的内容(这个具体没有查实现)。 218 | % join和attach是定义标题的连接和定位。 219 | % coffin如何连接参考xcoffins文档 220 | % coffin的[]中的参数指定对齐位置点,()中的参数指定第二个coffin相对于第一个coffin的位移 221 | % 比如:main[r,vc]title[r,vc](0pt,0pt)表示main的r,vc和title的r,vc对齐, 222 | % (0pt,0pt)表示对齐即可,无需位移。 223 | % 至于join和attach的意义,exsheet文档其实没有明确的说明 224 | % 但从内部代码看代表xcoffins中的JoinCoffins和AttachCoffin 225 | % 两者对齐方式是相同的,但连接形式不同,前者是将后者包含进去构成一个边界包含两者新的coffin 226 | % 而后者则则是不包含,因此后续连接中对齐的将是第二个coffin。 227 | \DeclareInstance{exsheets-heading}{runin-solution}{default}{ 228 | runin = true , 229 | %根据上面的理解这里就清楚了 230 | %将main的右中和title的左中连接起来,通常构成包含两者的coffin 231 | %coffin还是在原来的位置上,即在行首 232 | join ={main[r,vc]title[l,vc](0pt,0pt)} 233 | } 234 | 235 | \DeclareInstance{exsheets-heading}{margin-solution}{default}{ 236 | runin = true , 237 | %将main的左中和title的右中连接起来,仍然是两个coffin 238 | %其中main coffin在行首,所以title coffin在其左侧 239 | %所以title会跑到页边中 240 | attach ={main[l,vc]title[r,vc](0pt,0pt)} 241 | } 242 | 243 | %划分单元处理 244 | \ifcsstring{unitname}{none} 245 | {\xdef\counterwithinunit{}} 246 | {\ifcsstring{unitname}{chapter} 247 | {\xdef\counterwithinunit{chapter}} 248 | {\xdef\counterwithinunit{section}} 249 | } 250 | 251 | \SetupExSheets{ 252 | counter-format=qu[1]., 253 | counter-within={\counterwithinunit}, 254 | headings ={runin-simple}, 255 | headings-format=\normalsize, 256 | solution/headings={runin-solution}, 257 | solution/name={\textcolor{blue}{答:}}, 258 | } 259 | \bool_if:NT \l__simplexam_prtanswer_bool { 260 | \SetupExSheets{ 261 | solution/print=true, 262 | } 263 | } 264 | \SetupExSheets[points]{name=分,format=\color{blue}}%format=\textcolor{blue}\bfseries 265 | 266 | 267 | %增加一个新的计分系统 268 | \newcounter{questionold} 269 | \newcounter{questionnew} 270 | \setcounter{questionold}{0} 271 | \newcounter{secunit} 272 | 273 | % 274 | %设置可以改变的默认分数 275 | % 276 | \fp_new:N \simplexam_default_pts_fp 277 | \def\Setquestiondefaultpts#1{% 278 | \fp_gset:Nn \simplexam_default_pts_fp {#1} 279 | } 280 | \Setquestiondefaultpts{3} 281 | 282 | % 283 | % 修改该宏,以增加独立于exsheets外的一套计分系统 284 | % #1: instance 285 | % #2: title 286 | % #3: number 287 | % #4: points 288 | % #5: bonus 289 | % #6: id 290 | \cs_set_protected:Npn \exsheets_use_heading:nnnnnn #1#2#3#4#5#6 291 | { 292 | \IfInstanceExistTF {exsheets-heading} {#1} 293 | { \UseInstance {exsheets-heading} {#1} } 294 | { 295 | \msg_warning:nnx {exsheets} {headings} {#1} 296 | \UseInstance {exsheets-heading} {block} 297 | } 298 | {#2} {#3} {#4} {#5} {#6} 299 | %增加的题目统计和计分系统 300 | \ifcsstring{unitname}{none}{\setcounter{secunit}{1}}%当unitname为none的时候把所有的题都放到第一节中 301 | {\setcounter{secunit}{\value{\unitname}}} 302 | \def\unitnumber{\number\numexpr\thesecunit-1} 303 | \setcounter{questionnew}{\thequestion} 304 | \ifnum\value{questionold}<\value{questionnew}%当old大于等于new的时候说明单元变化 305 | \setcounter{questionold}{\thequestionnew} 306 | \else 307 | \ifcsundef{unit\unitnumber qus}%%因为solution同样应用这个宏,也会做处理,可能会覆盖前面的定义 308 | %因此当题数已经定义,那么就不再做处理了。 309 | {\csxdef{unit\unitnumber qus}{\thequestionold}%利用xdef将计数器的值先展开并取出 310 | }{} 311 | \setcounter{questionold}{\thequestionnew} 312 | \fi 313 | \ifcsundef{unit\thesecunit qu\thequestionnew}% 314 | {%因为solution同样应用这个宏,也会做处理,可能会覆盖前面的定义 315 | %因此当分数已经定义,那么就不再做分数处理了。 316 | \fp_compare:nNnTF {#4} = {0} %当未给出分数时则使用默认的分值 317 | {\csxdef{unit\thesecunit qu\thequestionnew}{\fp_use:N \simplexam_default_pts_fp}} 318 | {\csxdef{unit\thesecunit qu\thequestionnew}{\fp_use:N #4}} 319 | }{} 320 | %测试代码 321 | %numberofsec:\unitnumber : \csuse{unit\unitnumber qus} -\csuse{unit3qus}\par 322 | %pointofsec:\thesecunit qu: \thequestionnew : \csuse{unit\thesecunit qu\thequestionnew} 323 | } 324 | 325 | 326 | %重定义__exsheets_solution:环境,增加一个必选参数 327 | %这个必选参数传递给__exsheets_solution_internal:当做可选参数 328 | \renewenvironment {__exsheets_solution:} [2] 329 | { 330 | \tl_clear:N \l__exsheets_use_solution_tl 331 | % \prop_show:N \l__exsheets_class_prop 332 | \prop_map_inline:Nn \l__exsheets_class_prop 333 | { 334 | \use:c {__exsheets_solutions_use_##1:} 335 | \bool_if:nTF 336 | { 337 | \l__exsheets_solutions_use_bool 338 | && 339 | ( 340 | !\bool_if_p:c {g__exsheets_use_##1_bool} 341 | || 342 | \bool_if_p:c {l__exsheets_##2_active_bool} 343 | ) 344 | } 345 | { \tl_put_right:Nn \l__exsheets_use_solution_tl {y} } 346 | { \tl_put_right:Nn \l__exsheets_use_solution_tl {n} } 347 | } 348 | % verwende, wenn ein Ja dabei war: 349 | \tl_if_in:NnT \l__exsheets_use_solution_tl {y} 350 | { \bool_set_true:N \l__exsheets_solutions_use_bool } 351 | \bool_if:NT \l__exsheets_questions_deactivate_bool 352 | { \bool_set_false:N \l__exsheets_solutions_use_bool } 353 | \bool_if:NT \l__exsheets_solutions_use_bool 354 | { 355 | \bool_set_true:N \l__exsheets_inside_solution_bool 356 | \IfNoValueF {#1} { \keys_set:nn {exsheets/solution} {#1} } 357 | } 358 | \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl 359 | { 360 | \tl_set_eq:NN 361 | \l__exsheets_solution_heading_instance_tl 362 | \l__exsheets_heading_instance_tl 363 | } 364 | %当传递的参数值为空时, 365 | %注意参数值为空不同与参数为空,参数为空即无参数用\IfNoValueTF判断 366 | \tl_if_blank:nTF {#2} 367 | {\csxdef{unit\thesecunit ans\thequestion}{\csuse{unit\thesecunit qu\thequestion}}} 368 | { 369 | \IfNoValueTF {#2} 370 | {\csxdef{unit\thesecunit ans\thequestion}{\csuse{unit\thesecunit qu\thequestion}}} 371 | {\csxdef{unit\thesecunit ans\thequestion}{#2}} 372 | } 373 | \__exsheets_solution_internal: 374 | } 375 | { \end__exsheets_solution_internal: } 376 | 377 | %重定义solution环境,增加一个大括号参数G{} 378 | %使其可以向\__exsheets_solution传递第二参数,这个大括号包围的参数值默认为空 379 | %该值就是实际的得分 380 | \cs_set_protected:Npn \__exsheets_renew_qu_sol_pair:nnnnnn #1#2#3#4#5#6 381 | { 382 | \RenewDocumentEnvironment {#1} { O{}G{} } 383 | { \keys_set:nn {exsheets} {#3} \__exsheets_question: {#2,##1} {##2} } 384 | { \end__exsheets_question: } 385 | \RenewDocumentEnvironment {#4} { O{}G{} } 386 | { \keys_set:nn {exsheets} {#6} \__exsheets_solution: {#5,##1} {##2}} 387 | { \end__exsheets_solution: } 388 | } 389 | 390 | %重新生成{question}和{solution}环境 391 | \RenewQuSolPair {question} {solution} 392 | 393 | 394 | %根据bool,来确定是否在question中输出blank中的答案 395 | \cs_set_protected:Npn \exsheets_blank:n #1 396 | { 397 | \box_clear:N \l__exsheets_blank_box 398 | \mode_if_math:TF 399 | { \hbox_set:Nn \l__exsheets_blank_box { $ \m@th \mathpalette{}{#1} $ } } 400 | { \hbox_set:Nn \l__exsheets_blank_box {#1} } 401 | \bool_if:NTF \l__simplexam_prtanswer_bool 402 | %\bool_if:NTF \l__exsheets_inside_solution_bool 403 | { \exsheets_write_blank:n {\ \ #1\ \ } } 404 | { 405 | \bool_if:NTF \l__exsheets_blank_width_bool 406 | { \__exsheets_blank_skip:N \l__exsheets_blank_dim } 407 | { 408 | \__exsheets_blank_skip:n 409 | { \box_wd:N \l__exsheets_blank_box } 410 | } 411 | } 412 | } 413 | 414 | 415 | % 416 | % 给出<#1>宽度的下划线 417 | % 418 | \NewDocumentCommand \answerfill { G{4em} } 419 | { 420 | \group_begin: 421 | \tl_if_blank:nTF {#1}{\def\answerfillspace{4em}} 422 | {\def\answerfillspace{#1}} 423 | \mode_if_vertical:TF 424 | { 425 | \noindent 426 | \exsheets_blank:n {\hspace{\answerfillspace}} 427 | } 428 | { \exsheets_blank:n {\hspace{\answerfillspace}}} 429 | \group_end: 430 | } 431 | 432 | 433 | %所有题目的总分值 434 | \NewDocumentCommand{\pointsall}{}{% 435 | \ifcsundef{pointsprtall}{0}{\csuse{pointsprtall}} 436 | } 437 | 438 | %某大题的总分值 439 | \NewDocumentCommand{\pointsunit}{m}{% 440 | \ifcsundef{pointsprtunit#1}{0}{\csuse{pointsprtunit#1}} 441 | } 442 | 443 | %某小题的总分值 444 | \NewDocumentCommand{\pointsques}{mm}{% 445 | \ifcsundef{pointsprtunit#1qu#2}{0}{\csuse{pointsprtunit#1qu#2}} 446 | } 447 | 448 | %所有题目的总得分 449 | \NewDocumentCommand{\ansptsall}{}{% 450 | \ifcsundef{ansptsprtall}{0}{\csuse{ansptsprtall}} 451 | } 452 | 453 | %某大题的总得分 454 | \NewDocumentCommand{\ansptsunit}{m}{% 455 | \ifcsundef{ansptsprtunit#1}{0}{\csuse{ansptsprtunit#1}} 456 | } 457 | 458 | %某小题的得分 459 | \NewDocumentCommand{\ansptsques}{mm}{% 460 | \ifcsundef{ansptsprtunit#1qu#2}{0}{\csuse{ansptsprtunit#1qu#2}} 461 | } 462 | 463 | %大题的数量 464 | \NewDocumentCommand{\questionsunitall}{}{%其实是大题的数量 465 | \ifcsundef{quesnumall}{0}{\csuse{quesnumall}} 466 | } 467 | 468 | %某大题的小题数量 469 | \NewDocumentCommand{\questionsunit}{m}{% 470 | \ifcsundef{quesnumunit#1}{0}{\csuse{quesnumunit#1}} 471 | } 472 | 473 | % 474 | % 将分数解析记录到宏中的命令,注意到因为该命令写入到aux文件中,读取后是在一个编组中,因此要使用其中的信息,必须在其内容部做全局的定义,比如gdef、csgdef 475 | % <#1>表示大题号,等于0则表示总分 476 | % <#2>表示小题号,等于0表示当前大题的总分 477 | % <#3>表示分数 478 | \def\pointstoparse#1#2#3{ 479 | \ifnum#1=0\relax 480 | \gdef\pointsprtall{#3} 481 | \else 482 | \ifnum#2=0\relax 483 | \csgdef{pointsprtunit#1}{#3} 484 | \else 485 | \csgdef{pointsprtunit#1qu#2}{#3} 486 | \fi 487 | \fi 488 | } 489 | 490 | %答案的分数 491 | \def\ansptstoparse#1#2#3{ 492 | \ifnum#1=0\relax 493 | \gdef\ansptsprtall{#3} 494 | \else 495 | \ifnum#2=0\relax 496 | \csgdef{ansptsprtunit#1}{#3} 497 | \else 498 | \csgdef{ansptsprtunit#1qu#2}{#3} 499 | \fi 500 | \fi 501 | } 502 | 503 | % 504 | % 将题目数量解析记录到宏中的命令 505 | % <#1>表示大题号,等于0则用于表示大题的数量 506 | % <#2>表示题目的数量 507 | \def\quesnumtoparse#1#2{ 508 | \ifnum#1=0\relax 509 | \gdef\quesnumall{#2} 510 | \else 511 | \csgdef{quesnumunit#1}{#2} 512 | \fi 513 | } 514 | 515 | %临时变量,用于记录题目和分数 516 | \int_new:N \l_countTMPA_int 517 | \int_new:N \l_countTMPB_int 518 | \int_new:N \l_countTMPC_int 519 | \int_new:N \l_countTMPD_int 520 | 521 | \fp_new:N \l_pointTMPA_fp 522 | \fp_new:N \l_pointTMPB_fp 523 | \fp_new:N \l_pointTMPC_fp 524 | \fp_new:N \l_pointTMPD_fp 525 | 526 | 527 | % 528 | %分数统计和记录放到文档最后 529 | % 530 | \AtEndDocument 531 | { 532 | %最后一个单元的题目数量无法通过question变化的逻辑来实现 533 | %因此利用此处代码完成最后一个单元的题目数量统计 534 | \ifcsstring{unitname}{none}{\setcounter{secunit}{1}}%当unitname为none的时候把所有的题都放到第一节中 535 | {\setcounter{secunit}{\value{\unitname}}} 536 | \csxdef{unit\thesecunit qus}{\thequestionold} 537 | \setcounter{questionold}{0} 538 | \csxdef{unitnums}{\thesecunit} 539 | 540 | \ifbool{@filesw}{ 541 | 542 | %根据定义的命令信息获取大题(分节)总数 543 | \int_gset:Nn \l_countTMPC_int {\csuse{unitnums}} 544 | 545 | \iow_now:cx {@auxout}{%记录当前总的大题数量 546 | \string\global\string\toggletrue{auxinfoused} 547 | \string\quesnumtoparse{0}{\int_use:N \l_countTMPC_int}% 548 | }% 549 | 550 | %遍历各个大题 551 | %根据定义的命令信息进行统计 552 | \int_gset:Nn \l_countTMPA_int {1} 553 | \fp_gset:Nn \l_pointTMPA_fp {0.0} 554 | \fp_gset:Nn \l_pointTMPC_fp {0.0} 555 | 556 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPC_int + 1} 557 | 558 | { 559 | %loopsec:\int_use:N \l_countTMPA_int \par 560 | 561 | %第\l_countTMPA_int大题的题目数 562 | \int_gset:Nn \l_countTMPD_int {\csuse{unit\int_use:N \l_countTMPA_int qus}} 563 | 564 | %记录当前大题的题目总数\@mainaux 565 | \iow_now:cx {@auxout}{ 566 | \string\quesnumtoparse{\int_use:N \l_countTMPA_int}{\int_use:N \l_countTMPD_int}% 567 | }% 568 | 569 | %循环变量 570 | \int_gset:Nn \l_countTMPB_int {1} 571 | %用于统计当前的大题的总分数 572 | \fp_gset:Nn \l_pointTMPB_fp {0.0} 573 | \fp_gset:Nn \l_pointTMPD_fp {0.0} 574 | 575 | %遍历当前大题的所有题目 576 | \int_while_do:nNnn {\l_countTMPB_int } <{\l_countTMPD_int + 1} 577 | 578 | { 579 | %loopinsec: \int_use:N \l_countTMPA_int qu: \int_use:N \l_countTMPB_int points:\csuse{unit\l_countTMPA_int qu\l_countTMPB_int}\par 580 | \ifcsundef{unit\int_use:N \l_countTMPA_int qu\int_use:N \l_countTMPB_int}%如果没有给出题目分数,以题目的默认的分数作为后备 581 | {Warning:~undefined~points~for~QUESTION:~unit\int_use:N \l_countTMPA_int qu\int_use:N \l_countTMPB_int \par 582 | \csxdef{unit\int_use:N \l_countTMPA_int qu\int_use:N \l_countTMPB_int}{\fp_use:N \simplexam_default_pts_fp}} 583 | {} 584 | 585 | \iow_now:cx {@auxout}{%记录当前题目的分数 586 | \string\pointstoparse{\int_use:N \l_countTMPA_int}{\int_use:N \l_countTMPB_int}{\csuse{unit\int_use:N \l_countTMPA_int qu\int_use:N \l_countTMPB_int}}% 587 | }% 588 | 589 | \ifcsundef{unit\int_use:N \l_countTMPA_int ans\int_use:N \l_countTMPB_int}%如果没有给出答案分数,以题目的分数作为后备 590 | {Warning:~undefined~points~for~ANSWER:~ unit\int_use:N \l_countTMPA_int ans\int_use:N \l_countTMPB_int \par 591 | \csxdef{unit\int_use:N \l_countTMPA_int ans\int_use:N \l_countTMPB_int}{\csuse{unit\int_use:N \l_countTMPA_int qu\int_use:N \l_countTMPB_int}}} 592 | {} 593 | 594 | \iow_now:cx {@auxout}{%记录当前题目的实际得分 595 | \string\ansptstoparse{\int_use:N \l_countTMPA_int}{\int_use:N \l_countTMPB_int}{\csuse{unit\int_use:N \l_countTMPA_int ans\int_use:N \l_countTMPB_int}}% 596 | }% 597 | %unit: \int_use:N \l_countTMPA_int qu: \int_use:N \l_countTMPB_int :pts: \csuse{unit\int_use:N \l_countTMPA_int ans\int_use:N \l_countTMPB_int} \par 598 | 599 | \fp_add:Nn \l_pointTMPB_fp {\csuse{unit\int_use:N \l_countTMPA_int qu\int_use:N \l_countTMPB_int}} 600 | 601 | \fp_add:Nn \l_pointTMPD_fp {\csuse{unit\int_use:N \l_countTMPA_int ans\int_use:N \l_countTMPB_int}} 602 | 603 | \int_gincr:N \l_countTMPB_int 604 | } 605 | 606 | \iow_now:cx {@auxout}{%记录当前大题的分数 607 | \string\pointstoparse{\int_use:N \l_countTMPA_int}{0}{\fp_use:N \l_pointTMPB_fp}% 608 | }% 609 | 610 | \iow_now:cx {@auxout}{%记录当前大题的实际分数 611 | \string\ansptstoparse{\int_use:N \l_countTMPA_int}{0}{\fp_use:N \l_pointTMPD_fp}% 612 | }% 613 | 614 | %统计所有大题加在一起的总分 615 | \fp_gadd:Nn \l_pointTMPA_fp {\l_pointTMPB_fp} 616 | 617 | \fp_gadd:Nn \l_pointTMPC_fp {\l_pointTMPD_fp} 618 | 619 | \int_gincr:N \l_countTMPA_int 620 | } 621 | 622 | %记录所有题目的总分 623 | \iow_now:cx {@auxout}{ 624 | \string\pointstoparse{0}{0}{\fp_use:N \l_pointTMPA_fp}% 625 | }% 626 | 627 | %记录所有题目的总分 628 | \iow_now:cx {@auxout}{ 629 | \string\ansptstoparse{0}{0}{\fp_use:N \l_pointTMPC_fp}% 630 | }% 631 | 632 | \iow_now:cx {@auxout}{ 633 | \string\csgdef{totalpage}{\thepage}% 634 | }% 635 | 636 | }{} 637 | } 638 | 639 | % 640 | % 641 | %重定义__exsheets_solution_internal:环境,用于当不给出答案时输出空白 642 | %这里的空间增加时调出来的。 643 | \newlength{\heightofsolution} 644 | \RenewEnviron { __exsheets_solution_internal: } 645 | { 646 | \bool_if:nT 647 | { \g__exsheets_questions_use_bool && \l__exsheets_solutions_use_bool } 648 | { \bool_if:NTF \l__exsheets_solutions_print_bool 649 | {\__exsheets_save_solution:V \BODY} 650 | {\settoheight{\heightofsolution}{\parbox{\linewidth}{\BODY}} 651 | \addtolength{\heightofsolution}{3.92\baselineskip} 652 | \examspace{\heightofsolution} 653 | } 654 | %\csxdef{savedansunit\thesecunit qu\thequestion}{\BODY} %当有includegrphics时有问题 655 | %\csgdef{savedansunit\thesecunit qu\thequestion}{\BODY} %结果输出有问题 656 | %\protected@csxdef{savedansunit\thesecunit qu\thequestion}{\BODY} %没有问题 657 | \global\cslet{savedansunit\thesecunit qu\thequestion}{\BODY} %没有问题 658 | } 659 | } 660 | 661 | \newcounter{countTMPA} 662 | 663 | %输出各大题(节)的大题号,用于tabular环境中 664 | \def\ForEachunit{ 665 | \int_gset:Nn \l_countTMPA_int {1} 666 | \int_gset:Nn \l_countTMPB_int {\questionsunitall} 667 | %\int_use:N \l_countTMPB_int 668 | \int_while_do:nNnn {\l_countTMPA_int } < {\l_countTMPB_int + 1} 669 | { 670 | \setcounter{countTMPA}{\int_use:N \l_countTMPA_int} 671 | \chinese{countTMPA} \int_gincr:N \l_countTMPA_int & 672 | } 673 | } 674 | 675 | 676 | 677 | %输出<#1>大题中各小题的题号,用于tabular环境中 678 | \def\ForEachquinunit#1{ 679 | \int_gset:Nn \l_countTMPA_int {1} 680 | \int_gset:Nn \l_countTMPB_int {\questionsunit{#1}} 681 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 682 | { 683 | \int_use:N \l_countTMPA_int \int_gincr:N \l_countTMPA_int & 684 | } 685 | } 686 | 687 | 688 | %输出<#1>大题中各小题的分值,用于tabular环境中 689 | \def\ForEachquinunitpoints#1{ 690 | \int_gset:Nn \l_countTMPA_int {1} 691 | \int_gset:Nn \l_countTMPB_int {\questionsunit{#1}} 692 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 693 | { 694 | \pointsques{#1}{\int_use:N \l_countTMPA_int} 695 | \int_gincr:N \l_countTMPA_int & 696 | } 697 | } 698 | 699 | %输出<#1>大题中各小题的空分值,用于tabular环境中 700 | \def\ForEachquinunitNOpts#1{ 701 | \int_gset:Nn \l_countTMPA_int {1} 702 | \int_gset:Nn \l_countTMPB_int {\questionsunit{#1}} 703 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 704 | { 705 | \int_gincr:N \l_countTMPA_int & 706 | } 707 | } 708 | 709 | %输出各大题(节)的分值,用于tabular环境中 710 | \def\ForEachunitpoints{ 711 | \int_gset:Nn \l_countTMPA_int {1} 712 | \int_gset:Nn \l_countTMPB_int {\questionsunitall} 713 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 714 | { 715 | \pointsunit{\int_use:N \l_countTMPA_int} 716 | \int_gincr:N \l_countTMPA_int & 717 | } 718 | } 719 | 720 | %输出各大题(节)的空值,用于tabular环境中 721 | \def\ForEachunitNOpts{ 722 | \int_gset:Nn \l_countTMPA_int {1} 723 | \int_gset:Nn \l_countTMPB_int {\questionsunitall} 724 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 725 | { 726 | \int_gincr:N \l_countTMPA_int & 727 | } 728 | } 729 | 730 | %输出<#1>大题中各小题的得分,用于tabular环境中 731 | \def\ForEachquinunitanspts#1{ 732 | \int_gset:Nn \l_countTMPA_int {1} 733 | \int_gset:Nn \l_countTMPB_int {\questionsunit{#1}} 734 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 735 | { 736 | \bool_if:NT \l__simplexam_prtanswer_bool 737 | {\ansptsques{#1}{\int_use:N \l_countTMPA_int}} 738 | \int_gincr:N \l_countTMPA_int & 739 | } 740 | } 741 | 742 | %输出各大题(节)的得分,用于tabular环境中 743 | \def\ForEachunitanspts{ 744 | \int_gset:Nn \l_countTMPA_int {1} 745 | \int_gset:Nn \l_countTMPB_int {\questionsunitall} 746 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 747 | { 748 | \bool_if:NT \l__simplexam_prtanswer_bool 749 | {\ansptsunit{\int_use:N \l_countTMPA_int}} 750 | \int_gincr:N \l_countTMPA_int & 751 | } 752 | } 753 | 754 | \RequirePackage{multirow,array} 755 | \newcounter{columntmp} 756 | 757 | % 758 | %用于输出全部大题的得分表 759 | % 760 | \def\assesstaball{% 761 | \iftoggle{auxinfoused}{% 762 | \noindent\begingroup\kaishu\large 763 | \setcounter{columntmp}{\questionsunitall} 764 | \addtocounter{columntmp}{2} 765 | \bool_if:NTF \l__simplexam_scoreshow_bool 766 | {\begin{tabular}{|l|*{\questionsunitall}{>{\centering}p{0.8cm}|}c|>{\centering\arraybackslash}p{2cm}|} 767 | \hline 768 | 大题 & \ForEachunit 总计 & 阅卷人\\ \hline 769 | 分值 & \ForEachunitpoints \pointsall & \multirow {2}{2cm}{}\\ \cline{1-\thecolumntmp} 770 | 得分 & \ForEachunitanspts \bool_if:NT \l__simplexam_prtanswer_bool{\ansptsall} & \\ \hline 771 | \end{tabular}} 772 | {\begin{tabular}{|l|*{\questionsunitall}{>{\centering}p{0.8cm}|}c|>{\centering\arraybackslash}p{2cm}|} 773 | \hline 774 | 大题 & \ForEachunit 总计 & 阅卷人\\ \hline 775 | 分值 & \ForEachunitpoints \pointsall & \multirow {2}{2cm}{}\\ \cline{1-\thecolumntmp} 776 | 得分 & \ForEachunitNOpts & \\ \hline 777 | \end{tabular}} 778 | \endgroup 779 | }{}} 780 | 781 | 782 | 783 | % 784 | %用于输出各大题的小题得分表 785 | %<#1>是大题的序号 786 | \def\assesstabunit#1{% 787 | \kaishu% 788 | \setcounter{columntmp}{\questionsunit{#1}} 789 | \addtocounter{columntmp}{2} 790 | \bool_if:NTF \l__simplexam_scoreshow_bool 791 | {\begin{tabular}{|l|*{\questionsunit{#1}}{>{\centering}p{0.5cm}|}c|>{\centering\arraybackslash}p{2cm}|} 792 | \hline 793 | 小题 & \ForEachquinunit{#1} 总计 & 阅卷人\\ \hline 794 | 分值 & \ForEachquinunitpoints{#1} \pointsunit{#1} & \multirow {2}{1cm}{}\\ \cline{1-\thecolumntmp} 795 | 得分 & \ForEachquinunitanspts{#1} \bool_if:NT \l__simplexam_prtanswer_bool{\ansptsunit{#1}} & \\ \hline 796 | \end{tabular}} 797 | {\begin{tabular}{|l|*{\questionsunit{#1}}{>{\centering}p{0.5cm}|}c|>{\centering\arraybackslash}p{2cm}|} 798 | \hline 799 | 小题 & \ForEachquinunit{#1} 总计 & 阅卷人\\ \hline 800 | 分值 & \ForEachquinunitpoints{#1} \pointsunit{#1} & \multirow {2}{1cm}{}\\ \cline{1-\thecolumntmp} 801 | 得分 & \ForEachquinunitNOpts{#1} & \\ \hline 802 | \end{tabular}} 803 | } 804 | 805 | % 806 | %用于输出各大题的答案,以表格的形式 807 | %<#1>是表格的答案列的宽度,<#2>大题的序号 808 | \newcommand{\answerstabunit}[2][\@empty]{ 809 | \bool_set_true:N \l__simplexam_inanswersheet_bool %给一些命令比如\answerpoints做标记,避免在给出单独的答案表时重做 810 | \ifcsundef{unit#2qus}{\csxdef{unit#2qus}{\thequestionold}}{} 811 | \renewcommand{\baselinestretch}{2.0} 812 | \noindent \medskip\textbf{\heiti 第#2大题答案:}\\\medskip 813 | \ifx#1\@empty 814 | \begin{tabular}{|l|c|} 815 | \else 816 | \xdef\tabsetcolumn{#1} 817 | \begin{tabular}{|l|m{\tabsetcolumn}|} 818 | \fi 819 | \hline 820 | 小题 & 答案 \\ \hline 821 | \ForEachquinunitanswers{#2} 822 | \end{tabular}\par 823 | \bool_set_false:N \l__simplexam_inanswersheet_bool 824 | } 825 | 826 | %输出<#1>大题中各小题的答案,用于tabular环境中 827 | \def\ForEachquinunitanswers#1{ 828 | \int_gset:Nn \l_countTMPA_int {1} 829 | \int_gset:Nn \l_countTMPB_int {\csuse{unit#1qus}} 830 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 831 | { 832 | \int_use:N \l_countTMPA_int & \csuse{savedansunit#1qu\int_use:N \l_countTMPA_int} \int_gincr:N \l_countTMPA_int \\ \hline 833 | } 834 | } 835 | 836 | % 837 | %用于输出各大题的答案,以正文的形式 838 | %<#1>是表格的答案列的宽度,<#2>大题的序号 839 | \newcommand{\answersinfounit}[2][\@empty]{% 840 | \bool_set_true:N \l__simplexam_inanswersheet_bool %给一些命令比如\answerpoints做标记,避免在给出单独的答案表时重做 841 | \ifcsundef{unit#2qus}{\csxdef{unit#2qus}{\thequestionold}}{} 842 | \renewcommand{\baselinestretch}{2.0} 843 | \noindent\textbf{\heiti 第#2大题答案:}\\ %\medskip 844 | \ifx#1\@empty 845 | \xdef\tasksetcolumn{3cm} 846 | \else 847 | \xdef\tasksetcolumn{#1} 848 | \fi 849 | \int_gset:Nn \l_countTMPA_int {1} 850 | \int_gset:Nn \l_countTMPB_int {\csuse{unit#2qus}}%\questionsunit{#2} 851 | \int_while_do:nNnn {\l_countTMPA_int } <{\l_countTMPB_int + 1} 852 | {\parbox{\tasksetcolumn}{% 853 | \int_use:N \l_countTMPA_int :\ \csuse{savedansunit#2qu\int_use:N \l_countTMPA_int}\hfill}\space 854 | \int_gincr:N \l_countTMPA_int 855 | } 856 | \par 857 | \bool_set_false:N \l__simplexam_inanswersheet_bool 858 | } 859 | 860 | 861 | \RequirePackage{pifont} 862 | % 863 | %判断和选择题答案填写命令 864 | %加上实际得分的处理 865 | %%\answer[score]{}%两个nobreak使换行后仍右对齐 866 | \NewDocumentCommand{\answer}{o m}{% 867 | \nolinebreak\hfill\nolinebreak\hfill\nolinebreak\hfill% 868 | \makebox{(\space\makebox[3em]{% 869 | \bool_if:nTF {\l__simplexam_prtanswer_bool}% 870 | {\color{blue}\str_case:nnTF {#2}{% 871 | {right} {\char"221A}%\ding{52} 872 | {wrong} {\char"00D7}%\ding{56} 873 | }{}{#2}% 874 | }{}% 875 | }\space)\par}% 876 | \tl_if_blank:nTF {#1} 877 | {\csxdef{unit\thesecunit ans\thequestion}{\csuse{unit\thesecunit qu\thequestion}}} 878 | { 879 | \IfNoValueTF {#1} 880 | {\csxdef{unit\thesecunit ans\thequestion}{\csuse{unit\thesecunit qu\thequestion}}} 881 | {\csxdef{unit\thesecunit ans\thequestion}{#1}} 882 | } 883 | \csgdef{savedansunit\thesecunit qu\thequestion}{\str_case:nnTF {#2}{% 884 | {right} {\char"221A}%\ding{52} 885 | {wrong} {\char"00D7}%\ding{56} 886 | }{}{#2}}%将信息记录到一个命令中 887 | } 888 | 889 | % 890 | %填空题答案填写命令 891 | %加上实际得分的处理 892 | %\answer[score]{ \the\lenoftaskold 964 | \setlength{\lenoftaskold}{\lenoftask} 965 | \fi: 966 | \tl_put_right:Nn \l__simplexam_tasks_tl {\task #2 } 967 | \if_int_compare:w #1>1\relax%\z@ 968 | \exp_after:wN \use_i:nn 969 | \else: 970 | \exp_after:wN \use_ii:nn 971 | \fi: 972 | {\exp_after:wN\simplexam_options_deal\exp_after:wN{\number\numexpr#1-1}}% 973 | {\tl_put_right:Nn \l__simplexam_tasks_tl {\end{tasks}} 974 | \if_dim:w \the\lenoftaskold > 0.48\linewidth 975 | \tl_set:Nn \l__simplexam_tempb_tl {1} 976 | \else: 977 | \if_dim:w \the\lenoftaskold > 0.21\linewidth 978 | \tl_set:Nn \l__simplexam_tempb_tl {2} 979 | \fi: 980 | \fi: 981 | \l__simplexam_tasks_tl}% 982 | } 983 | 984 | % 985 | %\options[<#1>] 986 | %#1为缺省的选项个数 987 | % 988 | \tl_new:N \l__simplexam_tempa_tl %用于记录选项的数量 989 | \tl_new:N \l__simplexam_tempb_tl %用于设置选项排列的列数 990 | \NewDocumentCommand{\options}{O{4}}{% 991 | \tl_if_blank:nTF {#1} 992 | { \tl_set:Nn \l__simplexam_tempa_tl {4} } 993 | { \tl_set:Nn \l__simplexam_tempa_tl {#1} } 994 | \tl_set:Nn \l__simplexam_tempb_tl {4} 995 | \setlength{\lenoftaskold}{0pt} 996 | \tl_set:Nn \l__simplexam_tasks_tl {\par\begin{tasks}(\l__simplexam_tempb_tl)} 997 | \simplexam_options_deal \l__simplexam_tempa_tl 998 | } 999 | 1000 | 1001 | % 1002 | % 解答或证明题中的评分标准 1003 | % 1004 | \newcommand{\cdotfill}{\leavevmode\xleaders\hbox to 0.5em{\hss$\cdot$\hss}\hfill\kern0pt\relax} 1005 | \newcommand{\myscore}[1]{\textcolor{blue}{#1\kern0.2em 分}} 1006 | \newcommand{\scoretext}[1]{\cdotfill\myscore{#1}\par\noindent\ignorespaces} 1007 | \newcommand{\scoreeqno}[1]{\eqno{\cdots\cdots\text{\myscore{#1}}}} 1008 | \newcommand{\scoretag}[1]{\tag*{$\cdots\cdots$\myscore{#1}}} 1009 | 1010 | \newrobustcmd{\score}[1]{% 1011 | \ifbool{mmode}{% 1012 | \ifdefstrequal{\tag}{\dft@tag}{\scoreeqno{#1}}{\scoretag{#1}}% 1013 | }{% 1014 | \scoretext{#1}% 1015 | }% 1016 | } 1017 | 1018 | \RequirePackage{ccaption} 1019 | %使用\tabcaptionfix命令产生在浮动体外与默认caption一致的标题 1020 | \newfixedcaption{\tabcaption}{table} 1021 | \newfixedcaption{\figcaption}{figure} 1022 | \newenvironment{insertfig}[2]%%定义的非浮动插图环境 1023 | {\par\begingroup\def\figcaptioninfo{#1}\def\figlabelinfo{#2}\centering\addvspace{0.5ex} 1024 | \renewcommand{\baselinestretch}{0.9}}% 1025 | {\figcaption{\figcaptioninfo}\label{\figlabelinfo}\par\endgroup\vspace{1ex}} 1026 | \newenvironment{inserttab}[2]%%定义的非浮动表格环境 1027 | {\par\begingroup\renewcommand{\baselinestretch}{0.9}\tabcaption{#1}\label{#2}\par\noindent\centering}% 1028 | {\par\vspace{1ex}\endgroup\vspace{1ex}} 1029 | 1030 | 1031 | \ExplSyntaxOff 1032 | 1033 | \setmainfont{CMU Serif}%带空格的字体设置不能放在latex3的环境中 1034 | \setCJKmainfont{SourceHanSerifSC-Regular.otf} 1035 | 1036 | %tikz的usetikzlibrary不能放在latex3语法环境中, 1037 | %或者采用打补丁的方法,补丁后则可以放置,详见tex.se 1038 | %\RequirePackage{pgf} 1039 | \RequirePackage{tikz} 1040 | \usetikzlibrary{shapes,snakes} 1041 | \tikzset{ 1042 | milines/.style={very thin,dash pattern=on 0.1em off 0.1em, blue!50}, 1043 | mibox/.style={thin}, 1044 | } 1045 | 1046 | \def\pagestudentudf{学院:\underline{\hspace{5em}}班级:\underline{\hspace{5em}} 1047 | 姓名:\underline{\hspace{5em}}学号:\underline{\hspace{5em}}} 1048 | \def\pagesealingudf{学\\[1em]生\\[1em]答\\[1em]卷\\[1em]不\\[1em]要\\[1em]超\\[1em]过\\[1em]此\\[1em]线} 1049 | \def\pagestudent#1{\def\pagestudentudf{#1}} 1050 | \def\pagesealing#1{\def\pagesealingudf{#1}} 1051 | 1052 | \newcommand{\drawcomposition}[3][0.8]{ 1053 | \begingroup 1054 | \centering 1055 | \begin{tikzpicture}[scale=#1] 1056 | % 包含#2*#3个方格的边框框 1057 | % x方向由#2列单位为1的格子,y方向为#3行单位为1的格子,每行格子之间间隔0.4 1058 | \draw[line width = 0.8pt](0,0)rectangle(#2,{#3 *1.4}); 1059 | 1060 | % 画#2-1条竖线,与边框构成,#2列 1061 | \foreach \m in {1,2,...,\numexpr#2-1}\draw(\m,0) -- (\m,{#3 *1.4}); 1062 | 1063 | % 画#3个代表0.4间隔的横矩形,把间隔内部的线覆盖 1064 | \foreach \n in {1,2,..., \the\numexpr#3 }\draw[fill=white,line width=0.4pt](0,{1.4*\n-0.4})rectangle(#2 ,{1.4*\n}); 1065 | \end{tikzpicture}\par 1066 | \endgroup 1067 | } 1068 | 1069 | \RequirePackage{everypage} 1070 | \newcommand{\sealruleleft}{% 1071 | \def\1{\\[50mm]}\def\2{\\[15mm]}% 1072 | \begin{tikzpicture}[remember picture,overlay,very thick,font=\large] 1073 | \path (current page.south west) +(1.5cm,1cm) coordinate (a1); 1074 | \path (current page.north west) +(1.5cm,-1cm) coordinate (a2); 1075 | \path (current page.south west) +(2.5cm,1cm) coordinate (b1); 1076 | \path (current page.north west) +(2.5cm,-1cm) coordinate (b2); 1077 | \draw[dashed] (a1) -- node[left=1mm,text width=1em]{装\1订\1线} 1078 | node[right=1mm,text width=1em]{\pagesealingudf} (a2); 1079 | \draw (b1) -- (b2); 1080 | \end{tikzpicture}} 1081 | 1082 | \newcommand{\sealareainfo}{% 1083 | \def\1{\\[50mm]}\def\2{\\[15mm]}% 1084 | \begin{tikzpicture}[remember picture,overlay,very thick,font=\large] 1085 | \path (current page.south west) +(1.5cm,1cm) coordinate (a1); 1086 | \path (current page.north west) +(1.5cm,-1cm) coordinate (a2); 1087 | \path (current page.south west) +(2.5cm,1cm) coordinate (b1); 1088 | \path (current page.north west) +(2.5cm,-1cm) coordinate (b2); 1089 | \draw[dashed] (a1) -- node[left=1mm,text width=1em]{ 1090 | \rotatebox{90}{\parbox{34em}{\pagestudentudf}}}% 1091 | node[right=1mm,text width=1em]{\pagesealingudf} (a2); 1092 | \draw (b1) -- (b2); 1093 | \end{tikzpicture}} 1094 | 1095 | \newcommand{\sealruleright}{% 1096 | \def\1{\\[50mm]}\def\2{\\[15mm]}% 1097 | \begin{tikzpicture}[remember picture,overlay,very thick,font=\large] 1098 | \path (current page.south east) +(-1.5cm,1cm) coordinate (a1); 1099 | \path (current page.north east) +(-1.5cm,-1cm) coordinate (a2); 1100 | \path (current page.south east) +(-2.5cm,1cm) coordinate (b1); 1101 | \path (current page.north east) +(-2.5cm,-1cm) coordinate (b2); 1102 | \draw[dashed] (a1) -- node[right=1mm,text width=1em]{装\1订\1线} 1103 | node[left=1mm,text width=1em]{\pagesealingudf} (a2); 1104 | \draw (b1) -- (b2); 1105 | \end{tikzpicture}} 1106 | 1107 | \newcommand{\scratchpaper}{% 1108 | \begin{tikzpicture}[remember picture,overlay,font=\sffamily\fontsize{72pt}{72pt}\selectfont] 1109 | \node[text=lightgray!20] at (current page.center) {草\quad 稿\quad 纸}; 1110 | \end{tikzpicture}} 1111 | 1112 | \ExplSyntaxOn 1113 | 1114 | \bool_if:NT \l__simplexam_sealrule_bool 1115 | {\AddEverypageHook{ 1116 | \ifnumequal{\value{page}}{1}{\sealareainfo}{ 1117 | \ifcsstring{paperprintname}{double} 1118 | {\ifnumodd{\value{page}}{\sealruleleft}{\sealruleright}} 1119 | {\sealruleleft}} 1120 | }} 1121 | 1122 | \bool_if:NT \l__simplexam_scratch_bool { 1123 | % 在 twocolumn 文档中,\newpage 可能是到下一栏,\clearpage 才能保证到下一页 1124 | \AtEndDocument{ 1125 | \clearpage\pagestyle{empty}\scratchpaper\clearpage\scratchpaper\addtocounter{page}{-2} 1126 | } 1127 | %\preto{\@enddocumenthook}{\clearpage\pagestyle{empty}\caogaozhi\clearpage\caogaozhi\addtocounter{page}{-2}} 1128 | } 1129 | 1130 | % 1131 | %用于输出拼音和米子格的汉字的处理 1132 | \str_new:N \l__simplexam_hanzi_str 1133 | \def\hanzimibox{\tikz{%米字格形状 1134 | \def\xst{0} 1135 | \def\yst{0} 1136 | \def\xed{1em} 1137 | \def\yed{1.05em} 1138 | \draw[mibox](\xst,\yst) rectangle (\xed,\yed); 1139 | \draw[milines](\xst,\yst) -- (\xed,\yed); 1140 | \draw[milines](\xst,\yed) -- (\xed,\yst); 1141 | \draw[milines](\xst,\yed/2) -- (\xed,\yed/2); 1142 | \draw[milines](\xed/2,\yst) -- (\xed/2,\yed); 1143 | }} 1144 | \def\hanzibox{\tikz{%覆盖盒子形状用于覆盖汉字 1145 | \def\xst{0} 1146 | \def\yst{0} 1147 | \def\xed{1em} 1148 | \def\yed{1.05em} 1149 | \draw[mibox,fill=white](\xst,\yst) rectangle (\xed,\yed); 1150 | }} 1151 | 1152 | \cs_new:Npn \simplexam_boxadd_hanzi:N #1%为当前汉字加上米子格 1153 | { 1154 | \CJKglue\rlap{\lower 0.18em \hbox{\hanzimibox}}#1 1155 | } 1156 | 1157 | \cs_new:Npn \simplexam_boxadd_hanzihide:N #1%覆盖当前汉字再加上米字格 1158 | { 1159 | #1\llap{\lower 0.18em \hbox{\hanzibox}}\llap{\lower 0.18em \hbox{\hanzimibox}}\CJKglue 1160 | } 1161 | 1162 | \cs_new:Nn \simplexam_map_boxadd_hanzi:N% 1163 | { 1164 | \str_set:Nn \l__simplexam_hanzi_str {#1} 1165 | \str_map_function:NN \l__simplexam_hanzi_str \simplexam_boxadd_hanzi:N 1166 | } 1167 | \cs_new:Nn \simplexam_map_boxadd_hanzihide:N% 1168 | { 1169 | \str_set:Nn \l__simplexam_hanzi_str {#1} 1170 | \str_map_function:NN \l__simplexam_hanzi_str \simplexam_boxadd_hanzihide:N 1171 | } 1172 | 1173 | \NewDocumentCommand{\answerpinyinbox}{m}{ 1174 | \begingroup 1175 | %\color{blue} 1176 | \bool_if:NTF \l__simplexam_prtanswer_bool 1177 | {\xpinyin*{\simplexam_map_boxadd_hanzi:N {#1}}} 1178 | {\simplexam_map_boxadd_hanzi:N {#1}} 1179 | \ifcsundef{savedansunit\thesecunit qu\thequestion}{% 1180 | \tl_gset:Nn \l__simplexam_tempans_tl {#1} 1181 | \csgdef{savedansunit\thesecunit qu\thequestion}{\xpinyin*{#1}}%将信息记录到一个命令中 1182 | }{ 1183 | \tl_gput_right:Nn \l__simplexam_tempans_tl {;#1} 1184 | \csxdef{savedansunit\thesecunit qu\thequestion}{\xpinyin*{\tl_use:N \l__simplexam_tempans_tl}}% 1185 | }% 1186 | \endgroup 1187 | } 1188 | 1189 | \NewDocumentCommand{\answerpinyin}{m}{ 1190 | \begingroup 1191 | %\color{blue} 1192 | \bool_if:NTF \l__simplexam_prtanswer_bool 1193 | {\xpinyin*{#1}} 1194 | {\simplexam_map_boxadd_hanzi:N {#1}} 1195 | \ifcsundef{savedansunit\thesecunit qu\thequestion}{% 1196 | \tl_gset:Nn \l__simplexam_tempans_tl {#1} 1197 | \csgdef{savedansunit\thesecunit qu\thequestion}{\xpinyin*{#1}}%将信息记录到一个命令中 1198 | }{ 1199 | \tl_gput_right:Nn \l__simplexam_tempans_tl {;#1} 1200 | \csxdef{savedansunit\thesecunit qu\thequestion}{\xpinyin*{\tl_use:N \l__simplexam_tempans_tl}}% 1201 | }% 1202 | \endgroup 1203 | } 1204 | 1205 | 1206 | \NewDocumentCommand{\answerhanzi}{m}{ 1207 | \begingroup 1208 | %\color{blue} 1209 | \bool_if:NTF \l__simplexam_prtanswer_bool 1210 | {\xpinyin*{\simplexam_map_boxadd_hanzi:N {#1}}} 1211 | {\xpinyin*{\simplexam_map_boxadd_hanzihide:N {#1}}} 1212 | \ifcsundef{savedansunit\thesecunit qu\thequestion}{% 1213 | \tl_gset:Nn \l__simplexam_tempans_tl {#1} 1214 | \csgdef{savedansunit\thesecunit qu\thequestion}{#1}%将信息记录到一个命令中 1215 | }{ 1216 | \tl_gput_right:Nn \l__simplexam_tempans_tl {;#1} 1217 | \csxdef{savedansunit\thesecunit qu\thequestion}{\tl_use:N \l__simplexam_tempans_tl}% 1218 | }% 1219 | \endgroup 1220 | } 1221 | 1222 | \ExplSyntaxOff 1223 | --------------------------------------------------------------------------------