From cd812fa90b2599dc91c3e6e766a596a42a9b08b7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 1 Jun 2023 19:59:53 +0000 Subject: exam-zh (1jun23) git-svn-id: svn://tug.org/texlive/trunk@67262 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/exam-zh/exam-zh-chinese-english.sty | 2 +- .../tex/latex/exam-zh/exam-zh-choices.sty | 4 +- .../texmf-dist/tex/latex/exam-zh/exam-zh-font.sty | 2 +- .../tex/latex/exam-zh/exam-zh-question.sty | 185 +++++++++++++++++---- .../tex/latex/exam-zh/exam-zh-symbols.sty | 4 +- .../tex/latex/exam-zh/exam-zh-textfigure.sty | 6 +- Master/texmf-dist/tex/latex/exam-zh/exam-zh.cls | 26 ++- 7 files changed, 185 insertions(+), 44 deletions(-) (limited to 'Master/texmf-dist/tex') 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 5ac358950d1..2e84afa5c64 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-9-18} {v0.1.20} +\ProvidesExplPackage {exam-zh-chinese-english} {2023-06-01} {v0.1.25} {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 07a4f106ae4..f564fdff66c 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 @@ -1,7 +1,7 @@ % % Copyright (c) 2022 Zeping Lee % Released under the LaTeX Project Public License v1.3c License. -% Repository: https://gitee.com/zepinglee/exam-zh +% Repository: https://gitee.com/xkwxdyy/exam-zh % \NeedsTeXFormat{LaTeX2e} @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-choices} {2022-9-18} {v0.1.20} +\ProvidesExplPackage {exam-zh-choices} {2023-06-01} {v0.1.25} {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 a63484a7dfd..71320f53057 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-9-18} {v0.1.20} +\ProvidesExplPackage {exam-zh-font} {2023-06-01} {v0.1.25} {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 dd9d76609e7..40dde06024f 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-9-18} {v0.1.20} +\ProvidesExplPackage {exam-zh-question} {2023-06-01} {v0.1.25} {exam-zh question module} @@ -19,6 +19,7 @@ { \RequirePackage [ most ] { tcolorbox } } % \RequirePackage { zref-savepos } \RequirePackage { xeCJKfntef } +\RequirePackage { enumitem } % https://github.com/CTeX-org/forum/issues/264#issuecomment-1200087776 \disable@package@load { etex } @@ -45,6 +46,11 @@ % ulem 宏包重定义了 \emph,使用 \normalem 恢复 \normalem +\setlist{nosep} +\setlist + { + labelsep = 4pt, + } % question 环境相关变量 @@ -70,6 +76,7 @@ \skip_new:N \l__examzh_question_bottom_sep_skip % label 的对齐 \tl_new:N \l__examzh_question_label_align_tl +\tl_new:N \l__examzh_problem_label_align_tl \keys_define:nn { exam-zh } @@ -188,7 +195,7 @@ 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 }, + { \tl_set_eq:NN \l__examzh_problem_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, } @@ -215,18 +222,24 @@ % 选择题和填空题的题干 \NewDocumentEnvironment { question } { O { } +b } { - \bool_set_false:N \l__examzh_question_problem_style_bool - \__examzh_question_begin:nn {#1}{#2} + % \bool_set_false:N \l__examzh_question_problem_style_bool + \group_begin: + \__examzh_question_begin:nn {#1}{#2} + \__examzh_question_end:nn {#1}{#2} + \group_end: } - { \__examzh_question_end:nn {#1}{#2} } + {} % 解答题 \NewDocumentEnvironment { problem } { O { } +b } { - \bool_set_true:N \l__examzh_question_problem_style_bool - \__examzh_problem_begin:nn {#1}{#2} + % \bool_set_true:N \l__examzh_question_problem_style_bool + \group_begin: + \__examzh_problem_begin:nn {#1}{#2} + \__examzh_problem_end:nn {#1}{#2} + \group_end: } - { \__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 @@ -263,11 +276,14 @@ \list { % \int_use:N \g__examzh_question_index_int . - \__examzh_question_make_label:n + \bool_if:NTF \l__examzh_question_combine_fillin_bool { - \bool_if:NT \l__examzh_question_combine_fillin_bool + % \framebox[6em] + % \fbox + % { + \__examzh_question_make_label:n { - \tl_if_blank:VTF \l__examzh_question_combine_fillin_args_tl + \tl_if_blank:VTF \l__examzh_question_combine_fillin_args_tl { \fillin } { \use:x @@ -275,18 +291,43 @@ \exp_not:N \fillin \l__examzh_question_combine_fillin_args_tl } } + \__examzh_question_the_label: } - \int_compare:xNnT { \g__examzh_question_index_int } < { 11 } - { \phantom {1} } - \__examzh_question_the_label: + % } } + { + \__examzh_question_make_label:n + { + \__examzh_question_the_label: + } + } + % \__examzh_question_make_label:n + % { + % \bool_if:NT \l__examzh_question_combine_fillin_bool + % { + % % \makebox + % % { + % \tl_if_blank:VTF \l__examzh_question_combine_fillin_args_tl + % { \fillin } + % { + % \use:x + % { + % \exp_not:N \fillin \l__examzh_question_combine_fillin_args_tl + % } + % } + % % } + % } + % \int_compare:xNnT { \g__examzh_question_index_int } < { 11 } + % { \phantom {1} } + % \__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 \itemsep { 0em } \dim_gset:Nn \parsep { 0pt } % \group_begin: % 上面 \fillin 里面的设置是局部的,这样的问题是 question 的可选参数改 type 的时候不会影响 \l__examzh_fillin_type_str 的值 @@ -371,6 +412,27 @@ \keys_set:nx { exam-zh / fillin } { \seq_use:Nn \l_tmpa_seq {,} } } } +\cs_new:Npn \__examzh_problem_begin_labelsep_labelwidth_set: + { + \str_case:Vn \l__examzh_problem_label_align_tl + { + { left } + { + \dim_gset:Nn \labelsep { .7em } + \dim_gset:Nn \labelwidth { 1.8em } + } + { center } + { + \dim_gset:Nn \labelsep { .7em } + \dim_gset:Nn \labelwidth { 1.3em } + } + { right } + { + \dim_gset:Nn \labelsep { .7em } + \dim_gset:Nn \labelwidth { 1.3em } + } + } + } \cs_new:Npn \__examzh_question_begin_labelsep_labelwidth_set: { \bool_if:NTF \l__examzh_question_combine_fillin_bool @@ -384,14 +446,32 @@ { paren } { % combin-left-paren - \dim_gset:Nn \labelsep { 2.8em } - \dim_gset:Nn \labelwidth { 4.2em } + \bool_if:NTF \l__examzh_question_show_fillin_answer_bool + { + % 显示答案 + \dim_gset:Nn \labelsep { 2.6em } + \dim_gset:Nn \labelwidth { 3.8em } + } + { + % 不显示答案 + \dim_gset:Nn \labelsep { 4.5em } + \dim_gset:Nn \labelwidth { 3.8em } + } } { line } { % combin-left-line - \dim_gset:Nn \labelsep { 2.4em } - \dim_gset:Nn \labelwidth { 3.8em } + \bool_if:NTF \l__examzh_question_show_fillin_answer_bool + { + % 显示答案 + \dim_gset:Nn \labelsep { 2.2em } + \dim_gset:Nn \labelwidth { 3.8em } + } + { + % 不显示答案 + \dim_gset:Nn \labelsep { 3.8em } + \dim_gset:Nn \labelwidth { 3.8em } + } } } { @@ -425,8 +505,44 @@ } { right } { - \dim_gset:Nn \labelsep { .7em } - \dim_gset:Nn \labelwidth { 1.3em } + \str_case:VnF \l__examzh_fillin_type_str + { + { paren } + { + % combin-left-paren + \bool_if:NTF \l__examzh_question_show_fillin_answer_bool + { + % 显示答案 + \dim_gset:Nn \labelsep { 3.8em } + \dim_gset:Nn \labelwidth { 2em } + } + { + % 不显示答案 + \dim_gset:Nn \labelsep { 5.8em } + \dim_gset:Nn \labelwidth { 2em } + } + } + { line } + { + % combin-left-line + \bool_if:NTF \l__examzh_question_show_fillin_answer_bool + { + % 显示答案 + \dim_gset:Nn \labelsep { 0.7em } + \dim_gset:Nn \labelwidth { 1.3em } + } + { + % 不显示答案 + \dim_gset:Nn \labelsep { 5.2em } + \dim_gset:Nn \labelwidth { 2em } + } + } + } + { + % combin-left-paren/line 外的 + \dim_gset:Nn \labelsep { 2.8em } + \dim_gset:Nn \labelwidth { 1.3em } + } } } } @@ -497,7 +613,7 @@ \list { % \int_use:N \g__examzh_question_index_int . - \__examzh_question_make_label:n + \__examzh_problem_make_label:n { \__examzh_question_the_label: } @@ -509,12 +625,7 @@ \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: + \__examzh_problem_begin_labelsep_labelwidth_set: \dim_gset:Nn \leftmargin { 0pt } \dim_gset:Nn \itemindent { 2em } \dim_gset_eq:NN \listparindent \itemindent @@ -565,6 +676,15 @@ { right } { \hss \llap { #1 } } } } +\cs_new:Npn \__examzh_problem_make_label:n #1 + { + \str_case:Vn \l__examzh_problem_label_align_tl + { + { left } { \rlap { #1 } \hss } + { center } { \hss \clap { #1 } \hss } + { right } { \hss \llap { #1 } } + } + } \NewDocumentCommand \AddQuestionCounter { m m } { % 生成用户层命令 @@ -801,7 +921,7 @@ { show-answer = false, text-color = black, - show-paren = false, + show-paren = true, type = hfill } \keys_define:nn { exam-zh } @@ -872,6 +992,9 @@ % no-answer-type = counter 的计数器 \int_new:N \g__examzh_fillin_no_answer_counter_int +% 控制fillin 没答案的时候的长度由内容长度决定 +\bool_new:N \l__examzh_fillin_width_type_hidden_bool + \keys_define:nn { exam-zh / fillin } { type .code:n = @@ -888,7 +1011,7 @@ color .tl_set:N = \l__examzh_fillin_color_tl, text-color .tl_set:N = \l__examzh_fillin_text_color_tl, no-answer-type .choices:nn = - { blacktriangle, counter, none } + { blacktriangle, counter, none, hidden } { \str_set:Nx \l__examzh_fillin_no_answer_type_str { \l_keys_choice_tl } }, no-answer-counter-index .int_gset:N = \g__examzh_fillin_no_answer_counter_int, no-answer-counter-label .tl_set:N = \l__examzh_fillin_label_tl, @@ -1488,8 +1611,8 @@ \NewDocumentEnvironment { solution } { O{ } +b } { % \addvspace { \l__examzh_solution_top_sep_skip } - \vspace { \l__examzh_solution_top_sep_skip } \keys_set:nn { exam-zh / solution } {#1} + \vspace { \l__examzh_solution_top_sep_skip } % 放在这是使得 \examsetup 设置 qedsymbol 可以放在正文区 \cs_set_eq:NN \qedsymbol \l__examzh_solution_qedsymbol_tl \bool_if:NTF \l__examzh_solution_show_bool 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 8d46aa977f8..4997a0d2924 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-9-18} {v0.1.20} +\ProvidesExplPackage {exam-zh-symbols} {2023-06-01} {v0.1.25} {exam-zh symbols module} \RequirePackage { tikz } @@ -1086,7 +1086,7 @@ } \AtBeginDocument { - \cs_set_eq:NN \__examzh_symbols_old_sim: \backsim + \cs_set_eq:NN \__examzh_symbols_old_sim: \sim \RenewDocumentCommand { \sim } { s } { \IfBooleanTF {#1} 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 f42e3ec7397..ccefefae717 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,7 +7,7 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-textfigure} {2022-9-18} {v0.1.20} +\ProvidesExplPackage {exam-zh-textfigure} {2023-06-01} {v0.1.25} {exam-zh text with figure module} @@ -654,4 +654,6 @@ #2 { t } { l } { 0pt + \l__examzh_textfigure_figure_xshift_dim } { -1em + \l__examzh_textfigure_figure_yshift_dim } - } \ No newline at end of file + } + +\endinput \ No newline at end of file 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 12e450141d9..2959abe67fe 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-9-18} {v0.1.20} {LaTeX template for Chinese exam} +\ProvidesExplClass {exam-zh} {2023-06-01} {v0.1.25} {LaTeX template for Chinese exam} % 检查 LaTeX2e kernel 版本 \msg_new:nnn { exam-zh } { latex-too-old } @@ -531,10 +531,15 @@ { list .meta:nn = { exam-zh / list } {#1} } \setlist{nosep} +\setlist + { + labelsep = 4pt, + } \setlist[enumerate, 1] { labelindent = \parindent, + labelsep = 4pt, leftmargin = *, label = { \arabic * .} } @@ -550,7 +555,6 @@ listparindent = \parindent, label = {( \arabic * )}, } - % 多种方法: method环境 \newlist{method}{enumerate}{1} \setlist[method, 1] @@ -1597,7 +1601,7 @@ \tl_new:N \l__examzh_foot_content_before_page_tl \tl_new:N \l__examzh_foot_content_after_page_tl \tl_new:N \l__examzh_foot_content_after_lastpage_tl -\cs_generate_variant:Nn \regex_count:nnN { nxN } +\cs_generate_variant:Nn \regex_count:nnN { nxN, noN } \cs_new:Npn \__examzh_foot_content_only_page_input:ww #1 ; #2 \q_stop { @@ -1662,9 +1666,19 @@ \l__examzh_foot_content_after_lastpage_tl } \cs_new_nopar:Npn \__examzh_relax: { \relax } +% \cs_new:Npn \__examzh_foot_lastpage_tmp_set: +% { +% \cs_if_eq:NNTF \lastpage@lastpage \__examzh_relax: +% { \int_set:Nn \l__examzh_tmp_int { 0 } } +% { \int_set:Nn \l__examzh_tmp_int { \lastpage@lastpage } } +% } + +% https://gitee.com/xkwxdyy/exam-zh/issues/I6B7MU#note_17945353_link \cs_new:Npn \__examzh_foot_lastpage_tmp_set: { - \cs_if_eq:NNTF \lastpage@lastpage \__examzh_relax: + \bool_lazy_or:nnTF + { \cs_if_eq_p:NN \lastpage@lastpage \__examzh_relax: } + { \str_if_eq_p:ee \lastpage@lastpage {??} } { \int_set:Nn \l__examzh_tmp_int { 0 } } { \int_set:Nn \l__examzh_tmp_int { \lastpage@lastpage } } } @@ -1675,7 +1689,9 @@ \cs_new:cpn { __examzh_foot_content_a4paper_output: } { % 检测输入有多少个 ; - \regex_count:nxN { ; } + % \regex_count:nxN { ; } + % https://gitee.com/xkwxdyy/exam-zh/issues/I5NNR8#note_13447684_link + \regex_count:noN { ; } { \l__examzh_foot_content_format_tl } \l__examzh_foot_content_count_semicolon_int \int_case:nnF { \l__examzh_foot_content_count_semicolon_int } -- cgit v1.2.3