diff options
author | Karl Berry <karl@freefriends.org> | 2022-09-18 19:45:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-09-18 19:45:17 +0000 |
commit | 4edfb6788d8ab59568e86c853149d6eacd7f2ef2 (patch) | |
tree | 9d68970dfb64735db20b50aca06928e116c2193e /Master/texmf-dist/tex/latex/exam-zh | |
parent | 8c1f78ad1a590e86ae1e357a03ecfe9c8a00ad64 (diff) |
exam-zh (18sep22)
git-svn-id: svn://tug.org/texlive/trunk@64434 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exam-zh')
7 files changed, 264 insertions, 116 deletions
diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-chinese-english.sty b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-chinese-english.sty index eefffdac7d4..5ac358950d1 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-chinese-english.sty +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-chinese-english.sty @@ -8,7 +8,7 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-chinese-english} {2022-08-28} {v0.1.19} +\ProvidesExplPackage {exam-zh-chinese-english} {2022-9-18} {v0.1.20} {exam-zh chinese and english module} \PassOptionsToPackage { tcolorbox } { most } diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-choices.sty b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-choices.sty index 05f66871c3a..07a4f106ae4 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-choices.sty +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-choices.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-choices} {2022-08-28} {v0.1.19} +\ProvidesExplPackage {exam-zh-choices} {2022-9-18} {v0.1.20} {exam-zh choices module} \dim_new:N \l__examzh_choices_column_sep_dim diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-font.sty b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-font.sty index 76f943de1df..a63484a7dfd 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-font.sty +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-font.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-font} {2022-08-28} {v0.1.19} +\ProvidesExplPackage {exam-zh-font} {2022-9-18} {v0.1.20} {exam-zh font module} \RequirePackage { unicode-math } diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-question.sty b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-question.sty index 9afcba5f7b1..dd9d76609e7 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-question.sty +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-question.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-question} {2022-08-28} {v0.1.19} +\ProvidesExplPackage {exam-zh-question} {2022-9-18} {v0.1.20} {exam-zh question module} @@ -74,6 +74,8 @@ \keys_define:nn { exam-zh } { question .meta:nn = { exam-zh / question } {#1} } +\keys_define:nn { exam-zh } + { problem .meta:nn = { exam-zh / problem } {#1} } \keys_define:nn { exam-zh / question } @@ -122,8 +124,11 @@ { left, center, right } { \tl_set_eq:NN \l__examzh_question_label_align_tl \l_keys_choice_tl }, hang .bool_set:N = \l__examzh_question_hang_bool, + points-prelabel .tl_set:N = \l__examzh_question_points_prelabel_tl, + points-postlabel .tl_set:N = \l__examzh_question_points_postlabel_tl, } + \keys_set:nn { exam-zh / question } { index = 1, @@ -136,10 +141,72 @@ label = \arabic*., combine-fillin = false, label-align = right, - hang = true + hang = true, + points-prelabel = {(}, + points-postlabel = {分)} } +\keys_define:nn { exam-zh / problem } + { + % 手动调整 question 环境的计数器 + index .int_gset:N = \g__examzh_question_index_int , + % 分数 + points .int_set:N = \l__examzh_question_points_int , + % 分数显示控制 + show-points .choice: , + show-points / auto .code:n = + { \bool_set_true:N \l__examzh_question_show_points_auto_bool } , + show-points / true .code:n = + { + \bool_set_true:N \l__examzh_question_show_points_bool + \bool_set_false:N \l__examzh_question_show_points_auto_bool + } , + show-points / false .code:n = + { + \bool_set_false:N \l__examzh_question_show_points_bool + \bool_set_false:N \l__examzh_question_show_points_auto_bool + } , + % 分数是否单独成段 + points-separate-par .bool_set:N = \l__examzh_problem_points_separate_par_bool, + % 是否显示答案 + % show-answer .bool_set:N = \l__examzh_question_show_answer_bool , + show-answer .choice: , + show-answer / true .code:n = + { + \bool_set_true:N \l__examzh_question_show_fillin_answer_bool + \bool_set_true:N \l__examzh_question_show_paren_answer_bool + }, + show-answer / false .code:n = + { + \bool_set_false:N \l__examzh_question_show_fillin_answer_bool + \bool_set_false:N \l__examzh_question_show_paren_answer_bool + }, + % 上方间距 + top-sep .skip_set:N = \l__examzh_problem_top_sep_skip , + % 下方间距 + bottom-sep .skip_set:N = \l__examzh_problem_bottom_sep_skip , + label .tl_set:N = \l__examzh_question_label_tl, + label-align .choices:nn = + { left, center, right } + { \tl_set_eq:NN \l__examzh_question_label_align_tl \l_keys_choice_tl }, + points-prelabel .tl_set:N = \l__examzh_problem_points_prelabel_tl, + points-postlabel .tl_set:N = \l__examzh_problem_points_postlabel_tl, + } +\keys_set:nn { exam-zh / problem } + { + index = 1, + points = 0 , + show-points = auto , + points-separate-par = true , + show-answer = false , + top-sep = .25em plus .25em minus .1em , + bottom-sep = .25em plus .25em minus .1em , + label = \arabic*., + label-align = right, + points-prelabel = {(}, + points-postlabel = {分)} + } % 是否按照解答题的格式排版 \bool_new:N \l__examzh_question_problem_style_bool @@ -157,18 +224,14 @@ \NewDocumentEnvironment { problem } { O { } +b } { \bool_set_true:N \l__examzh_question_problem_style_bool - \__examzh_question_begin:nn {#1}{#2} + \__examzh_problem_begin:nn {#1}{#2} } - { \__examzh_question_end:nn {#1}{#2} } + { \__examzh_problem_end:nn {#1}{#2} } \prg_generate_conditional_variant:Nnn \int_compare:nNn { xNn } { T } \cs_new:Npn \__examzh_question_begin:nn #1#2 { \par - % 根据是否按解答题方式排版来设置是否分数要分段 - \bool_if:NTF \l__examzh_question_problem_style_bool - { \keys_set:nn { exam-zh / question } { points-separate-par = true } } - { \keys_set:nn { exam-zh / question } { points-separate-par = false } } % \bool_if:NTF \l__examzh_question_combine_fillin_bool % { \keys_set:nn { exam-zh / question } { label-align = left } } % { \keys_set:nn { exam-zh / question } { label-align = right } } @@ -194,9 +257,7 @@ % 而解答题不太一样 \bool_if:NT \l__examzh_question_show_points_auto_bool { - \bool_if:NTF \l__examzh_question_problem_style_bool - { \bool_set_true:N \l__examzh_question_show_points_bool } - { \bool_set_false:N \l__examzh_question_show_points_bool } + \bool_set_false:N \l__examzh_question_show_points_bool } % 使用列表环境输出 \list @@ -233,33 +294,33 @@ \__examzh_question_begin_fillin_type_set: \__examzh_question_begin_labelsep_labelwidth_set: % \group_end: - \bool_if:NTF \l__examzh_question_problem_style_bool - { - % 解答题是正文 + 缩进 2em 的效果 - \bool_if:NTF \l__examzh_question_combine_fillin_bool - { - % 如果 combine 的话就和 question 一样的缩进 - \bool_if:NTF \l__examzh_question_hang_bool - { \dim_gset:Nn \itemindent { 0em } } - { \dim_gset:Nn \itemindent { 2em } } - \bool_if:NTF \l__examzh_question_combine_fillin_bool - { - \bool_if:NTF \l__examzh_question_hang_bool - { \dim_gset:Nn \leftmargin { 6em } } - { \dim_gset:Nn \leftmargin { 4em } } - } - { - \bool_if:NTF \l__examzh_question_hang_bool - { \dim_gset:Nn \leftmargin { 2em } } - { \dim_gset:Nn \leftmargin { 0em } } - } - } - { - \dim_gset:Nn \leftmargin { 0pt } - \dim_gset:Nn \itemindent { 2em } - } - } - { + % \bool_if:NTF \l__examzh_question_problem_style_bool + % { + % % 解答题是正文 + 缩进 2em 的效果 + % \bool_if:NTF \l__examzh_question_combine_fillin_bool + % { + % % 如果 combine 的话就和 question 一样的缩进 + % \bool_if:NTF \l__examzh_question_hang_bool + % { \dim_gset:Nn \itemindent { 0em } } + % { \dim_gset:Nn \itemindent { 2em } } + % \bool_if:NTF \l__examzh_question_combine_fillin_bool + % { + % \bool_if:NTF \l__examzh_question_hang_bool + % { \dim_gset:Nn \leftmargin { 6em } } + % { \dim_gset:Nn \leftmargin { 4em } } + % } + % { + % \bool_if:NTF \l__examzh_question_hang_bool + % { \dim_gset:Nn \leftmargin { 2em } } + % { \dim_gset:Nn \leftmargin { 0em } } + % } + % } + % { + % \dim_gset:Nn \leftmargin { 0pt } + % \dim_gset:Nn \itemindent { 2em } + % } + % } + % { % 选择和填空题是悬挂效果 \bool_if:NTF \l__examzh_question_hang_bool { \dim_gset:Nn \itemindent { 0em } } @@ -275,7 +336,7 @@ { \dim_gset:Nn \leftmargin { 2em } } { \dim_gset:Nn \leftmargin { 0em } } } - } + % } \dim_gset_eq:NN \listparindent \itemindent \group_end: } @@ -285,7 +346,7 @@ { % 如果设置了分数且 show-points 的 bool 是 true 的话就显示 \int_compare:nNnT { \l__examzh_question_points_int } > { 0 } - { ( \int_use:N \l__examzh_question_points_int ~ 分 ) } + { \l__examzh_question_points_prelabel_tl \int_use:N \l__examzh_question_points_int ~ \l__examzh_question_points_postlabel_tl } % 是否分段(解答题需要分段) \bool_if:NT \l__examzh_question_points_separate_par_bool % \par 分段之后使用 \nopagebreak 避免分页导致序号和分数出现在页面最后一行 @@ -402,6 +463,87 @@ \vspace { \l__examzh_question_bottom_sep_skip } } +\cs_new:Npn \__examzh_problem_begin:nn #1#2 + { + \par + % \bool_if:NTF \l__examzh_question_combine_fillin_bool + % { \keys_set:nn { exam-zh / question } { label-align = left } } + % { \keys_set:nn { exam-zh / question } { label-align = right } } + % 设置键值 + \keys_set:nn { exam-zh / problem } { #1 } + % 题干计数器的值加一 + \int_gincr:N \g__examzh_question_index_int + % 设置上方间距 + % \addvspace { \l__examzh_question_top_sep_skip } + \vspace { \l__examzh_problem_top_sep_skip } + % 严格禁止孤行和寡行 + \int_set:Nn \clubpenalty { 10000 } + \int_set:Nn \widowpenalty { 10000 } + % 尽量避免在题目中间换行 + \int_set:Nn \interlinepenalty { 301 } + % 这部分是仿照 source2e 中 enumerate 的定义写的 + % \@enumdepth 主要控制 enumerate 不同层级的编号 + % 这样设置后,在 problem 中使用 enumerate 会调用 level 2 的编号 + % 也就是 question 中的 enumerate 环境直接从第二层开始 + \int_incr:N \@enumdepth + % 如果 show-points = auto 那么解答题显示分数,选择题和填空题不显示分数 + % 这样设置考虑到选择题和填空题都是每道题一样的分数,在最开始的地方说明即可 + % 而解答题不太一样 + \bool_if:NT \l__examzh_question_show_points_auto_bool + { + \bool_set_true:N \l__examzh_question_show_points_bool + } + % 使用列表环境输出 + \list + { + % \int_use:N \g__examzh_question_index_int . + \__examzh_question_make_label:n + { + \__examzh_question_the_label: + } + } + { + % 用 group 是为了防止 combine-fillin 的 type 影响了环境里面的 fillin 的type + \group_begin: + \dim_gset:Nn \topsep { 0pt } + \dim_gset:Nn \partopsep { 0pt } + \dim_gset:Nn \itemsep { 0pt } + \dim_gset:Nn \parsep { 0pt } + % \group_begin: + % 上面 \fillin 里面的设置是局部的,这样的问题是 question 的可选参数改 type 的时候不会影响 \l__examzh_fillin_type_str 的值 + % 所以要把 \l__examzh_question_combine_fillin_args_tl 里关于 type 的选取出来 + \__examzh_question_begin_fillin_type_set: + \__examzh_question_begin_labelsep_labelwidth_set: + % \group_end: + \dim_gset:Nn \leftmargin { 0pt } + \dim_gset:Nn \itemindent { 2em } + \dim_gset_eq:NN \listparindent \itemindent + \group_end: + } + \item \relax + % 输出题目分数 + \bool_if:NT \l__examzh_question_show_points_bool + { + % 如果设置了分数且 show-points 的 bool 是 true 的话就显示 + \int_compare:nNnT { \l__examzh_question_points_int } > { 0 } + { \l__examzh_problem_points_prelabel_tl \int_use:N \l__examzh_question_points_int ~ \l__examzh_problem_points_postlabel_tl } + % 是否分段(解答题需要分段) + \bool_if:NT \l__examzh_problem_points_separate_par_bool + % \par 分段之后使用 \nopagebreak 避免分页导致序号和分数出现在页面最后一行 + { \par \nopagebreak } + } + } + +\cs_new:Npn \__examzh_problem_end:nn #1#2 + { + #2 + % 结束列表环境 + \endlist + % 增加下方间距 + % \addvspace { \l__examzh_question_bottom_sep_skip } + \vspace { \l__examzh_problem_bottom_sep_skip } + } + % 处理 question / problem 的 label \tl_new:N \l__examzh_question_counters_commands_set_tl diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-symbols.sty b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-symbols.sty index 37115aa5a8b..8d46aa977f8 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-symbols.sty +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-symbols.sty @@ -8,7 +8,7 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-symbols} {2022-08-28} {v0.1.19} +\ProvidesExplPackage {exam-zh-symbols} {2022-9-18} {v0.1.20} {exam-zh symbols module} \RequirePackage { tikz } diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-textfigure.sty b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-textfigure.sty index 77a98eb0ba1..f42e3ec7397 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh-textfigure.sty +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh-textfigure.sty @@ -7,21 +7,25 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-textfigure} {2022-08-28} {v0.1.19} +\ProvidesExplPackage {exam-zh-textfigure} {2022-9-18} {v0.1.20} {exam-zh text with figure module} -\RequirePackage { wrapstuff } + \RequirePackage { tabularray } \RequirePackage { varwidth } \RequirePackage { graphicx } \RequirePackage { filehook } - -\AtEndOfPackageFile* { exam-zh-choices } +\file_if_exist:nT { wrapstuff.sty } { - \AddToHook { env / choices / before } - { \wrapstuffclear } + \RequirePackage { wrapstuff } + \AtEndOfPackageFile* { exam-zh-choices } + { + \AddToHook { env / choices / before } + { \wrapstuffclear } + } } + %% multifigures 环境,排版多张图片 %% % \begin{multifigures} @@ -365,7 +369,8 @@ % 环境下方的额外距离 bottom-sep .skip_set:N = \l__examzh_textfigure_bottom_sep_skip, % 类似于 wrapstuff 的 top - top .int_set:N = \l__examzh_textfigure_top_int + top .int_set:N = \l__examzh_textfigure_top_int, + parindent .dim_set:N = \l__examzh_textfigure_text_parindent_dim } \keys_set:nn { exam-zh / textfigure } @@ -377,7 +382,8 @@ text-ratio = 0.95, top-sep = 0pt, bottom-sep = 1.5ex plus .5ex minus 0.5ex, - top = 0 + top = 0, + parindent = 2em } @@ -455,7 +461,7 @@ \hcoffin_set:Nn \l__examzh_textfigure_text_coffin { \begin{varwidth}{ \l__examzh_textfigure_text_width_dim } - \dim_set:Nn \parindent {2em} + \dim_set:Nn \parindent { \l__examzh_textfigure_text_parindent_dim } \ignorespaces #1 \unskip diff --git a/Master/texmf-dist/tex/latex/exam-zh/exam-zh.cls b/Master/texmf-dist/tex/latex/exam-zh/exam-zh.cls index 3f98de7858d..12e450141d9 100644 --- a/Master/texmf-dist/tex/latex/exam-zh/exam-zh.cls +++ b/Master/texmf-dist/tex/latex/exam-zh/exam-zh.cls @@ -6,7 +6,7 @@ \NeedsTeXFormat{LaTeX2e}[2017/04/15] \RequirePackage{expl3} -\ProvidesExplClass {exam-zh} {2022-08-28} {v0.1.19} {LaTeX template for Chinese exam} +\ProvidesExplClass {exam-zh} {2022-9-18} {v0.1.20} {LaTeX template for Chinese exam} % 检查 LaTeX2e kernel 版本 \msg_new:nnn { exam-zh } { latex-too-old } @@ -719,20 +719,6 @@ \par } -% 祝考试顺利 -\NewDocumentCommand \goodluck { O{祝考试顺利} } - { - \group_begin: - \centering - \examzh_if_defined:NTF \lishu - { \lishu } - { \bfseries } - \Large - $\bigstar$ #1 $\bigstar$ - \par - \group_end: - } - % 注意事项环境 notice \keys_define:nn { exam-zh / notice } @@ -1224,6 +1210,7 @@ margin = 1in, inner = 1.3in, outer = 0.8in, + headheight = 0.7in } } { @@ -1232,6 +1219,7 @@ { paper = a4paper, margin = 1in, + headheight = 0.7in } } } @@ -1252,6 +1240,7 @@ margin = 1in, inner = 1.2in, outer = 0.8in, + headheight = 0.7in % showframe } } @@ -1264,6 +1253,7 @@ twocolumn, columnsep = 30mm, margin = 1in, + headheight = 0.7in } } } @@ -1589,13 +1579,16 @@ \keys_define:nn { exam-zh / page } { + show-head .bool_set:N = \l__examzh_show_head_bool, show-foot .bool_set:N = \l__examzh_show_foot_bool, + head-content .tl_set:N = \l__examzh_head_content_tl, foot-content .tl_set:N = \l__examzh_foot_content_format_tl % foo, bar: foo <page> bar % foo, bar, baz: foo <page> bar <lastpage> baz } \keys_set:nn { exam-zh / page } { + show-head = false, show-foot = true, foot-content = {数学试题第;页(共~;页)} } @@ -1778,74 +1771,81 @@ } -\fancypagestyle { plain } +\AtEndPreamble { - \fancyhf { } - \bool_if:cTF { g__examzh_page_size_a4paper_bool } + \fancypagestyle { plain } { - % a4paper - \bool_if:NT \l__examzh_show_foot_bool + \fancyhf { } + \bool_if:NT \l__examzh_show_head_bool { - \fancyfoot [ C ] - { - \small - \use:c { __examzh_foot_content_a4paper_output: } - % \l__exam_zh_subject_tl 试题第 \thepage { } 页(共 \pageref { LastPage } ~ 页) - } + \l__examzh_head_content_tl } - } - { - % a3paper - \bool_if:NT \l__examzh_show_foot_bool + \bool_if:cTF { g__examzh_page_size_a4paper_bool } { - \bool_if:cTF - { g__examzh_page_a3paper_foot_common_bool } + % a4paper + \bool_if:NT \l__examzh_show_foot_bool { - % 两页共用一个页脚 \fancyfoot [ C ] { \small + \use:c { __examzh_foot_content_a4paper_output: } % \l__exam_zh_subject_tl 试题第 \thepage { } 页(共 \pageref { LastPage } ~ 页) - \use:c { __examzh_foot_content_a3paper_common_output: } } } + } + { + % a3paper + \bool_if:NT \l__examzh_show_foot_bool { - % 每页一个页脚 - \fancyfoot [ L ] + \bool_if:cTF + { g__examzh_page_a3paper_foot_common_bool } { - \__examzh_column_box:n + % 两页共用一个页脚 + \fancyfoot [ C ] { \small - \use:c { __examzh_foot_content_a3paper_separate_left_output: } - % \l__exam_zh_subject_tl 试题第 - % % \thepage - % \int_eval:n { 2 * \c@page - 1 } - % { } 页 - % (共 - % % \pageref { LastPage } - % \int_eval:n { 2 * \l__examzh_tmp_int } - % ~ 页) - % \use:c { l__examzh_foot_content_a3paper_left_tl } + % \l__exam_zh_subject_tl 试题第 \thepage { } 页(共 \pageref { LastPage } ~ 页) + \use:c { __examzh_foot_content_a3paper_common_output: } } } - \fancyfoot [ R ] { - \__examzh_column_box:n + % 每页一个页脚 + \fancyfoot [ L ] { - \small - \use:c { __examzh_foot_content_a3paper_separate_right_output: } - % % \int_gincr:N \c@page - % \int_set:Nn \l__examzh_tmp_int { \lastpage@lastpage } - - % \l__exam_zh_subject_tl 试题第 - % \int_eval:n { 2 * \c@page } - % { } - % 页 - % (共 - % % \pageref { LastPage } - % \int_eval:n { 2 * \l__examzh_tmp_int } - % ~ 页) - % % \use:c { l__examzh_foot_content_a3paper_right_tl } + \__examzh_column_box:n + { + \small + \use:c { __examzh_foot_content_a3paper_separate_left_output: } + % \l__exam_zh_subject_tl 试题第 + % % \thepage + % \int_eval:n { 2 * \c@page - 1 } + % { } 页 + % (共 + % % \pageref { LastPage } + % \int_eval:n { 2 * \l__examzh_tmp_int } + % ~ 页) + % \use:c { l__examzh_foot_content_a3paper_left_tl } + } + } + \fancyfoot [ R ] + { + \__examzh_column_box:n + { + \small + \use:c { __examzh_foot_content_a3paper_separate_right_output: } + % % \int_gincr:N \c@page + % \int_set:Nn \l__examzh_tmp_int { \lastpage@lastpage } + + % \l__exam_zh_subject_tl 试题第 + % \int_eval:n { 2 * \c@page } + % { } + % 页 + % (共 + % % \pageref { LastPage } + % \int_eval:n { 2 * \l__examzh_tmp_int } + % ~ 页) + % % \use:c { l__examzh_foot_content_a3paper_right_tl } + } } } } |