%% %% This is file `problem.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% problem.dtx (with options: `package') %% \ProvidesExplPackage{problem}{2023/10/13}{3.4.0}{Semantic Markup for Problems} \RequirePackage{l3keys2e} \keys_define:nn { problem / pkg }{ notes .default:n = { true }, notes .bool_set:N = \c__problems_notes_bool, gnotes .default:n = { true }, gnotes .bool_set:N = \c__problems_gnotes_bool, hints .default:n = { true }, hints .bool_set:N = \c__problems_hints_bool, solutions .default:n = { true }, solutions .bool_set:N = \c__problems_solutions_bool, pts .default:n = { true }, pts .bool_set:N = \c__problems_pts_bool, min .default:n = { true }, min .bool_set:N = \c__problems_min_bool, %boxed .default:n = { true }, %boxed .bool_set:N = \c__problems_boxed_bool, test .default:n = { true }, test .bool_set:N = \c__problems_test_bool, unknown .code:n = { \PassOptionsToPackage{\CurrentOption}{stex} } } \newif\ifsolutions \ProcessKeysOptions{ problem / pkg } \bool_if:NTF \c__problems_solutions_bool { \solutionstrue }{ \solutionsfalse } \newif\ifintest \bool_if:NTF \c__problems_test_bool { \intesttrue }{ \intestfalse } \RequirePackage{stex} \AddToHook{begindocument}{ \ExplSyntaxOn\makeatletter \input{problem-english.ldf} \ltx@ifpackageloaded{babel}{ \clist_set:Nx \l_tmpa_clist {\exp_args:No \tl_to_str:n \bbl@loaded} \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{ngerman}}{ \input{problem-ngerman.ldf} } \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{finnish}}{ \input{problem-finnish.ldf} } \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{french}}{ \input{problem-french.ldf} } \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{russian}}{ \input{problem-russian.ldf} } }{} \makeatother\ExplSyntaxOff } \bool_new:N \l_stex_key_autogradable_bool \stex_keys_define:nnnn{ problem }{ \tl_set:Nn \l_stex_key_pts_tl 0 \tl_set:Nn \l_stex_key_min_tl 0 \str_clear:N \l_stex_key_name_str \str_clear:N \l_stex_key_mhrepos_str \bool_set_false:N \l_stex_key_autogradable_bool }{ pts .tl_set:N = \l_stex_key_pts_tl, min .tl_set:N = \l_stex_key_min_tl, name .str_set:N = \l_stex_key_name_str, autogradable .bool_set:N = \l_stex_key_autogradable_bool, archive .code:n = {}, %archive .str_set:N = \l_stex_key_mhrepos_str, creators .code:n = {} %imports .tl_set:N = \l__problems_prob_imports_tl, %refnum .int_set:N = \l__problems_prob_refnum_int, }{id,title,style,uses} \newcounter{sproblem}[section] \newcommand\numberproblemsin[1]{ \@addtoreset{sproblem}{#1} \def\thesproblem{\arabic{#1}.\arabic{sproblem}} } \numberproblemsin{section} \cs_new:Nn \__problems_activate_macros: { \stex_reactivate_macro:N \solution \stex_reactivate_macro:N \mcb \stex_reactivate_macro:N \scb \stex_reactivate_macro:N \fillinsol \stex_reactivate_macro:N \hint \stex_reactivate_macro:N \exnote \stex_reactivate_macro:N \gnote } \newcounter{pts} \newcounter{min} \bool_new:N \l__problems_in_problem_bool \bool_new:N \l__problems_has_pts_bool \bool_new:N \l__problems_has_min_bool \bool_set_false:N \l__problems_in_problem_bool \stex_new_stylable_env:nnnnnnn {problem} {O{}}{ \bool_if:NT \l__problems_in_problem_bool { \msg_error:nn{stex}{error/nestedproblem} } \cs_if_exist:NTF \l_problem_inputproblem_keys_tl { \tl_put_left:Nn \l_problem_inputproblem_keys_tl {#1,} \exp_args:Nno \stex_keys_set:nn{problem}{ \l_problem_inputproblem_keys_tl } }{ \stex_keys_set:nn{problem}{#1} } \refstepcounter{sproblem} \stex_if_do_html:T { \str_if_empty:NT \l_stex_key_name_str { \stex_file_split_off_lang:NN \l__problems_path_seq \g_stex_current_file \seq_get_right:NN \l__problems_path_seq \l_stex_key_name_str } \exp_args:Nne \begin{stex_annotate_env} { shtml:problem={\l_stex_key_name_str}, shtml:language={ \l_stex_current_language_str}, shtml:autogradable={\bool_if:NTF \l_stex_key_autogradable_bool {true}{false}} } \tl_if_empty:NF \l_stex_key_title_tl { \exp_args:No \stexdoctitle \l_stex_key_title_tl } \stex_annotate_invisible:nn{ shtml:problempoints={\l_stex_key_pts_tl} }{ \l_stex_key_pts_tl } } \tl_set_eq:NN \thistitle \l_stex_key_title_tl \bool_set_true:N \l__problems_in_problem_bool \tl_set_eq:NN \l__problems_pts_tl \l_stex_key_pts_tl \tl_set_eq:NN \l__problems_min_tl \l_stex_key_min_tl \tl_if_eq:NnTF \l__problems_pts_tl {0} {\bool_set_false:N \l__problems_has_pts_bool} {\bool_set_true:N \l__problems_has_pts_bool} \tl_if_eq:NnTF \l__problems_min_tl {0} {\bool_set_false:N \l__problems_has_min_bool} {\bool_set_true:N \l__problems_has_min_bool} \int_gzero:N \g__problems_subproblem_int \stex_style_apply: \_stex_do_id: \__problems_activate_macros: }{ \addtocounter{pts}{\l__problems_pts_tl} \addtocounter{min}{\l__problems_min_tl} \__problems_record_problem: \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{ \par\noindent\problemheader \bool_if:NT \c__problems_pts_bool { \tl_if_eq:NnF \l__problems_pts_tl {0}{ \marginpar{\l__problems_pts_tl{}~\problem@kw@pts\smallskip} } } \bool_if:NT \c__problems_min_bool { \tl_if_eq:NnF \l__problems_min_tl {0} { \marginpar{\l__problems_min_tl{}~\problem@kw@minutes\smallskip} } } \par \stex_ignore_spaces_and_pars: }{ \par\bigskip }{s} \tl_set:Nn \problemheader { \textbf{\sproblemautorefname{~}\thesproblem \tl_if_empty:NF \thistitle { {~}(\thistitle) } } } \cs_new_protected:Nn \__problems_record_problem: { \exp_args:NNe \iow_now:Nn \@auxout { \problem@restore {\thesproblem}{\l__problems_pts_tl}{\l__problems_min_tl} } } \cs_new_protected:Npn \problem@restore #1 #2 #3 {} \int_new:N \g__problems_subproblem_int \stex_new_stylable_env:nnnnnnn {subproblem} {O{}}{ \stex_keys_set:nn{problem}{#1} \bool_if:NF \l__problems_in_problem_bool{ \ifstexhtml\else \par{\bfseries WARNING~subproblem~to~be~used~in~some~problem}\par \fi \__problems_activate_macros: \bool_set_true:N \l__problems_in_problem_bool \tl_set:Nn \l__problems_pts_tl{0} \tl_set:Nn \l__problems_min_tl{0} } \str_if_empty:NT \l_stex_key_name_str { \stex_file_split_off_lang:NN \l__problems_path_seq \g_stex_current_file \seq_get_right:NN \l__problems_path_seq \l_stex_key_name_str } \stex_if_do_html:T { \str_if_empty:NT \l_stex_key_name_str { \stex_file_split_off_lang:NN \l__problems_path_seq \g_stex_current_file \seq_get_right:NN \l__problems_path_seq \l_stex_key_name_str } \exp_args:Nne \begin{stex_annotate_env} { shtml:subproblem={\l_stex_key_name_str}, shtml:language={ \l_stex_current_language_str}, shtml:autogradable={\bool_if:NTF \l_stex_key_autogradable_bool {true}{false}} } \stex_annotate_invisible:n{} \tl_if_empty:NF \l_stex_key_title_tl { \exp_args:No \stexdoctitle \l_stex_key_title_tl } } \int_gincr:N \g__problems_subproblem_int \bool_if:NF \l__problems_has_pts_bool { \tl_gset:Nx \l__problems_pts_tl {\int_eval:n {\l__problems_pts_tl + \l_stex_key_pts_tl}} } \bool_if:NF \l__problems_has_min_bool { \tl_gset:Nx \l__problems_min_tl {\int_eval:n {\l__problems_min_tl + \l_stex_key_min_tl}} } \stex_if_smsmode:F \stex_style_apply: }{ \stex_if_smsmode:F \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{ \begin{list}{}{ \setlength\topsep{0pt} \setlength\parsep{0pt} \setlength\rightmargin{0pt} }\item[\int_use:N \g__problems_subproblem_int .] \bool_if:NT \c__problems_pts_bool { \bool_if:NF \l__problems_has_pts_bool { \marginpar{\smallskip\l_stex_key_pts_tl{}~\problem@kw@pts} } } \bool_if:NT \c__problems_min_bool { \bool_if:NF \l__problems_has_min_bool{ \marginpar{\smallskip\l_stex_key_min_tl{}~\problem@kw@minutes} } } }{ \end{list} }{} \stex_keys_define:nnnn{ includeproblem }{ \str_clear:N \l_stex_key_mhrepos_str }{ archive .str_set:N = \l_stex_key_mhrepos_str, unknown .code:n = {} }{} \NewDocumentCommand\includeproblem{O{} m}{ \group_begin: \tl_set:Nn \l_problem_inputproblem_keys_tl {#1} \stex_keys_set:nn{includeproblem}{#1} \exp_args:Nno \use:nn{\inputref[}\l_stex_key_mhrepos_str]{#2} \group_end: } \int_new:N \g_problem_id_counter \dim_new:N \l_stex_key_testspace_dim \stex_keys_define:nnnn{ solution }{ \str_clear:N \l_stex_key_answerclass_str \dim_zero:N \l_stex_key_testspace_dim }{ testspace .dim_set:N = \l_stex_key_testspace_dim, answerclass .str_set:N = \l_stex_key_answerclass_str }{id,title,style} \cs_new_protected:Nn \__problems_solution_start:n { \stex_keys_set:nn{ solution }{#1} \str_if_empty:NT \l_stex_key_id_str { \int_gincr:N \g_problem_id_counter \str_set:Nx \l_stex_key_id_str { SOLUTION_\int_use:N \g_problem_id_counter } } \stex_if_do_html:T{ \begin{stex_annotate_env}{ shtml:solution=\l_stex_key_id_str, shtml:answerclass={\l_stex_key_answerclass_str} } } \stex_style_apply: } \stex_new_stylable_env:nnnnnnn { solution }{ O{} }{ \stex_if_do_html:TF{ \__problems_solution_start:n{#1} }{ \ifsolutions \__problems_solution_start:n{#1} \else \stex_keys_set:nn{ solution }{#1} \testspace{\l_stex_key_testspace_dim} \setbox\l_tmpa_box\vbox\bgroup \fi } }{ \stex_if_do_html:TF{ \stex_style_apply: \end{stex_annotate_env} }{ \ifsolutions \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } \else \egroup \fi } }{ \par\smallskip\rule[.3em]{\linewidth}{0.4pt}\newline\smallskip \noindent\emph{\problem@kw@solution\tl_if_empty:NF \l_stex_key_title_tl{ {~}\l_stex_key_title_tl \str_if_empty:NF \l_stex_key_answerclass_str { (Answer Class: \l_stex_key_answerclass_str) } } :~} }{ \par\rule[.3em]{\linewidth}{0.4pt}\newline }{} \stex_deactivate_macro:Nn \solution {sproblem~environments} \cs_new_protected:Npn \startsolutions{ \global\solutionstrue } \cs_new_protected:Npn \stopsolutions{ \global\solutionsfalse } \stex_keys_define:nnnn{ problemenv }{}{}{id,title,style} \cs_new_protected:Nn \__problems_hint_start:n { \stex_keys_set:nn{ problemenv }{#1} \str_if_empty:NT \l_stex_key_id_str { \int_gincr:N \g_problem_id_counter \str_set:Nx \l_stex_key_id_str { HINT_\int_use:N \g_problem_id_counter } } \stex_if_do_html:T{ \begin{stex_annotate_env}{ shtml:problemhint=\l_stex_key_id_str } } \stex_style_apply: } \stex_new_stylable_env:nnnnnnn { hint }{ O{} }{ \stex_if_do_html:TF{ \__problems_hint_start:n{#1} }{ \bool_if:NTF \c__problems_hints_bool { \__problems_hint_start:n{#1} }{ \setbox\l_tmpa_box\vbox\bgroup } } }{ \stex_if_do_html:TF{ \stex_style_apply: \end{stex_annotate_env} }{ \bool_if:NTF \c__problems_hints_bool { \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{ \egroup } } }{ \par\smallskip\rule[.3em]{\linewidth}{0.4pt}\newline\smallskip \noindent\emph{\problem@kw@hint\tl_if_empty:NF \l_stex_key_title_tl{ {~}\l_stex_key_title_tl } :~} }{ \par\rule[.3em]{\linewidth}{0.4pt}\newline }{} \stex_deactivate_macro:Nn \hint {sproblem~environments} \cs_new_protected:Nn \__problems_exnote_start:n { \stex_keys_set:nn{ problemenv }{#1} \str_if_empty:NT \l_stex_key_id_str { \int_gincr:N \g_problem_id_counter \str_set:Nx \l_stex_key_id_str { EXNOTE_\int_use:N \g_problem_id_counter } } \stex_if_do_html:T{ \begin{stex_annotate_env}{ shtml:problemnote=\l_stex_key_id_str } } \stex_style_apply: } \stex_new_stylable_env:nnnnnnn { exnote }{ O{} }{ \stex_if_do_html:TF{ \__problems_exnote_start:n{#1} }{ \bool_if:NTF \c__problems_notes_bool { \__problems_exnote_start:n{#1} }{ \setbox\l_tmpa_box\vbox\bgroup } } }{ \stex_if_do_html:TF{ \stex_style_apply: \end{stex_annotate_env} }{ \bool_if:NTF \c__problems_notes_bool { \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{ \egroup } } }{ \par\smallskip\rule[.3em]{\linewidth}{0.4pt}\newline\smallskip \noindent\emph{\problem@kw@note\tl_if_empty:NF \l_stex_key_title_tl{ {~}\l_stex_key_title_tl } :~} }{ \par\rule[.3em]{\linewidth}{0.4pt}\newline }{} \stex_deactivate_macro:Nn \exnote {sproblem~environments} %% \begin{environment}{gnote} \int_new:N \l__problems_anscls_int \cs_new_protected:Nn \__problems_gnote_start:n { \stex_keys_set:nn{ problemenv }{#1} \str_if_empty:NT \l_stex_key_id_str { \int_gincr:N \g_problem_id_counter \str_set:Nx \l_stex_key_id_str { GNOTE_\int_use:N \g_problem_id_counter } } \stex_if_do_html:T{ \begin{stex_annotate_env}{ shtml:problemgnote=\l_stex_key_id_str } } \stex_style_apply: } \stex_new_stylable_env:nnnnnnn { gnote }{ O{} }{ \stex_if_do_html:TF{ \__problems_gnote_start:n{#1} }{ \bool_if:NTF \c__problems_gnotes_bool { \__problems_gnote_start:n{#1} }{ \setbox\l_tmpa_box\vbox\bgroup } } \stex_reactivate_macro:N \anscls }{ \stex_if_do_html:TF{ \stex_style_apply: \end{stex_annotate_env} }{ \bool_if:NTF \c__problems_gnotes_bool { \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{ \egroup } } }{ \par\smallskip\rule[.3em]{\linewidth}{0.4pt}\newline\smallskip \noindent\emph{\problem@kw@grading\str_if_empty:NF \l_stex_key_title_tl{ {~}\l_stex_key_title_tl } :~} }{ \par\rule[.3em]{\linewidth}{0.4pt}\newline }{} \stex_deactivate_macro:Nn \gnote {sproblem~environments} \stex_keys_define:nnnn{ anscls }{ \str_clear:N \l_stex_key_pts_str \tl_clear:N \l_stex_key_feedback_tl }{ pts .str_set:N = \l_stex_key_pts_str, feedback .tl_set:N = \l_stex_key_feedback_str, update .code:n = {} }{id} \newcommand \anscls [2][] { \stex_keys_set:nn{ anscls }{#1} \str_if_empty:NT \l_stex_key_id_str { \int_incr:N \l__problems_anscls_int \str_set:Nx \l_stex_key_id_str { AC\int_use:N \l__problems_anscls_int } } \begin{list}{}{ \setlength\topsep{0pt} \setlength\parsep{0pt} \setlength\rightmargin{0pt} }\item[\l_stex_key_id_str] \stex_if_do_html:TF{ \stex_annotate:nn{ shtml:answerclass={\l_stex_key_id_str} \str_if_empty:NF \l_stex_key_pts_str{ ,shtml:answerclass-pts={\l_stex_key_pts_str} } \str_if_empty:NF \l_stex_key_feedback_str{ ,shtml:answerclass-feedback={\l_stex_key_feedback_str} } }{ #2 } }{#2} \str_if_empty:NF \l_stex_key_pts_str {\par ~ \problem@kw@points:~\l_stex_key_pts_str } \str_if_empty:NF \l_stex_key_feedback_str {\par ~ \problem@kw@feedback :~\l_stex_key_feedback_str } \end{list} } \stex_deactivate_macro:Nn \anscls {gnote~environments} \def\pts#1{ \bool_if:NT \c__problems_pts_bool { \stex_annotate:nn{shtml:problempoints={#1}}{\marginpar{#1~\problem@kw@pts}} }\hbox_unpack:N\c_empty_box } \def\min#1{ \bool_if:NT \c__problems_min_bool { \stex_annotate:nn{shtml:problemminutes={}}{\marginpar{#1~\problem@kw@minutes}} }\hbox_unpack:N\c_empty_box } \stex_new_stylable_env:nnnnnnn{mcb}{O{}}{ \stex_keys_set:nn{style}{#1} \stex_if_do_html:T{ \tl_set:Nn\problem_mcc_box_tl{} \exp_args:Nne \begin{stex_annotate_env}{ shtml:multiple-choice-block={} \clist_if_empty:NF \l_stex_key_style_clist {, shtml:styles={\l_stex_key_style_clist} } } } \stex_deactivate_macro:Nn \mcb {sproblem~environments} \stex_deactivate_macro:Nn \scb {sproblem~environments} \stex_deactivate_macro:Nn \solution {sproblem~environments} \stex_deactivate_macro:Nn \hint {sproblem~environments} \stex_deactivate_macro:Nn \exnote {sproblem~environments} \stex_deactivate_macro:Nn \gnote {sproblem~environments} \stex_reactivate_macro:N \mcc \cs_set:Nn \__problems_mccline:n{ \begin{list}{}{ \setlength\topsep{0pt} \setlength\parsep{0pt} \setlength\rightmargin{0pt} }\item[\problem_mcc_box_tl] ##1 \end{list} } \stex_style_apply: }{ \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{\par}{}{} \stexstylemcb[inline]{ \cs_set:Nn \__problems_mccline:n{\problem_mcc_box_tl{~} #1} }{} \stex_deactivate_macro:Nn \mcb {sproblem~environments} \cs_new_protected:Nn \__problems_do_yes_param:Nn { \exp_args:Nx \str_if_eq:nnTF { \str_lowercase:n{ #2 } }{ yes }{ \bool_set_true:N #1 }{ \bool_set_false:N #1 } } \stex_keys_define:nnnn{mcc}{ \tl_clear:N \l_stex_key_feedback_tl \bool_set_false:N \l_stex_key_T_bool \tl_clear:N \l_stex_key_Ttext_tl \tl_clear:N \l_stex_key_Ftext_tl }{ feedback .tl_set:N = \l_stex_key_feedback_tl , T .code:n = {\bool_set_true:N \l_stex_key_T_bool} , F .code:n = {\bool_set_false:N \l_stex_key_T_bool} , Ttext .tl_set:N = \l_stex_key_Ttext_tl , Ftext .tl_set:N = \l_stex_key_Ftext_tl , }{id} \tl_set:Nn \problem_mcc_box_tl { \ltx@ifpackageloaded{amssymb}{$\square$}{ \hbox{\vrule\vbox{\hrule width 6 pt\vskip 6pt\hrule}\vrule} } } \newcommand\mcc[2][]{ \stex_keys_set:nn{mcc}{#1} \tl_set:Nn \l_tmpa_tl{ \bool_if:NTF \l_stex_key_T_bool { \tl_if_empty:NTF \l_stex_key_Ttext_tl \problem@kw@correct \l_stex_key_Ttext_tl }{ \tl_if_empty:NTF \l_stex_key_Ftext_tl \problem@kw@wrong \l_stex_key_Ftext_tl } \tl_if_empty:NF \l_stex_key_feedback_tl { \\\emph{\l_stex_key_feedback_tl} } } \__problems_mccline:n{ \stex_if_do_html:TF{ \stex_annotate:nn{shtml:mcc={ \bool_if:NTF \l_stex_key_T_bool {true}{false} }}{ #2\stex_annotate:nn{shtml:mcc-solution={}}{\l_tmpa_tl} } }{ #2\ifsolutions\footnote{\l_tmpa_tl}\fi } } } \stex_deactivate_macro:Nn \mcc {mcb~environments} \tl_set:Nn\problem_scc_box_tl{$\bigcirc$} \stex_new_stylable_env:nnnnnnn{scb}{O{}}{ \stex_keys_set:nn{style}{#1} \stex_if_do_html:T{ \exp_args:Nne\begin{stex_annotate_env}{ shtml:single-choice-block={} \clist_if_empty:NF \l_stex_key_style_clist {, shtml:styles={\l_stex_key_style_clist} } } \tl_set:Nn\problem_scc_box_tl{} } \stex_deactivate_macro:Nn \mcb {sproblem~environments} \stex_deactivate_macro:Nn \scb {sproblem~environments} \stex_deactivate_macro:Nn \solution {sproblem~environments} \stex_deactivate_macro:Nn \hint {sproblem~environments} \stex_deactivate_macro:Nn \exnote {sproblem~environments} \stex_deactivate_macro:Nn \gnote {sproblem~environments} \stex_reactivate_macro:N \scc \cs_set:Nn \__problems_sccline:n{ \begin{list}{}{ \setlength\topsep{0pt} \setlength\parsep{0pt} \setlength\rightmargin{0pt} }\item[\problem_scc_box_tl] ##1 \end{list} } \stex_style_apply: }{ \stex_style_apply: \stex_if_do_html:T{ \end{stex_annotate_env} } }{\par}{}{} \stexstylescb[inline]{ \cs_set:Nn \__problems_sccline:n{\problem_scc_box_tl{~} #1} }{} \stex_deactivate_macro:Nn \scb {sproblem~environments} \newcommand\scc[2][]{ \stex_keys_set:nn{mcc}{#1} \tl_set:Nn \l_tmpa_tl{ \bool_if:NTF \l_stex_key_T_bool { \tl_if_empty:NTF \l_stex_key_Ttext_tl \problem@kw@correct \l_stex_key_Ttext_tl }{ \tl_if_empty:NTF \l_stex_key_Ftext_tl \problem@kw@wrong \l_stex_key_Ftext_tl } \tl_if_empty:NF \l_stex_key_feedback_tl { \\\emph{\l_stex_key_feedback_tl} } } \__problems_sccline:n{ \stex_if_do_html:TF{ \stex_annotate:nn{shtml:scc={ \bool_if:NTF \l_stex_key_T_bool {true}{false} }}{ #2\stex_annotate:nn{shtml:scc-solution={}}{\l_tmpa_tl} } }{ #2\ifsolutions\footnote{\l_tmpa_tl}\fi } } } \stex_deactivate_macro:Nn \scc {scb~environments} \newcommand\yesTnoF{ \begin{scb}[style=inline] \scc[T]{yes}~\scc[F]{no} \end{scb} } \newcommand\yesFnoT{ \begin{scb}[style=inline] \scc[F]{yes}~\scc[T]{no} \end{scb} } \newcommand\trueTfalseF{ \begin{scb}[style=inline] \scc[T]{true}~\scc[F]{false} \end{scb} } \newcommand\trueFfalseT{ \begin{scb}[style=inline] \scc[F]{true}~\scc[T]{false} \end{scb} } \stex_keys_define:nnnn{fillinsol}{ \tl_clear:N \l__problems_fillin_solution_tl \dim_zero:N \l_stex_key_testspace_dim }{ testspace .dim_set:N = \l_stex_key_testspace_dim, exact .code:n = {\__problems_parse_fillin_arg:nnnn{exact}#1 }, numrange .code:n = {\__problems_parse_fillin_arg:nnnn{numrange}#1 }, regex .code:n = {\__problems_parse_fillin_arg:nnnn{regex}#1 } }{} \cs_new:Nn \__problems_parse_fillin_arg:nnnn { \stex_if_do_html:TF{ \tl_set:Nn \l_tmpa_tl{#3} \tl_set:Nn \l_tmpb_tl{T} \stex_annotate_invisible:nn{ shtml:fillin-case={#1}, shtml:fillin-case-value={#2}, shtml:fillin-case-verdict={ \tl_if_eq:NNTF\l_tmpa_tl\l_tmpb_tl{true}{false} }, }{#4} }{ \tl_put_right:Nn \l__problems_fillin_solution_tl { #1{~} & #2{~} & #3{~} & #4{~} \\ } } } \newcommand\fillinsol[2][]{ \quad \mode_if_math:TF{ \hbox{\__problems_fillinsol:nn{#1}{$#2$}} }{ \__problems_fillinsol:nn{#1}{#2} } \quad } \cs_new_protected:Nn \__problems_fillinsol:nn { \stex_keys_set:nn{fillinsol}{#1} \stex_if_do_html:TF{ \stex_annotate:nn{shtml:fillinsol={}}{ \_stex_annotate_force_break:n{ #2 \l__problems_fillin_solution_tl } } }{ \ifsolutions \textcolor{red}{\fbox{#2}} \tl_if_empty:NF \l__problems_fillin_solution_tl { \footnote{ \halign{ ##\hfil & ##\hfil &##\hfil&##\hfil \cr \textbf{type }&\textbf{case }&\textbf{verdict }&\textbf{feedback }\cr \l__problems_fillin_solution_tl } } } \else \fbox{\dim_compare:nNnTF\l_stex_key_testspace_dim={0pt}{ \phantom{\huge{#2}} }{ \hspace{\l_stex_key_testspace_dim} }} \fi } } \stex_deactivate_macro:Nn \fillinsol {sproblem~environments} \newcommand\testemptypage[1][]{% \bool_if:NT \c__problems_test_bool {\ \vfill\begin{center}\hwexam@kw@testemptypage\end{center}\eject} } \newcommand\testspace[1]{\bool_if:NT \c__problems_test_bool {\vspace*{#1}}} \newcommand\testsmallspace{\testspace{1cm}} \newcommand\testmedspace{\testspace{2cm}} \newcommand\testbigspace{\testspace{3cm}} \newcommand\testnewpage{\bool_if:NT \c__problems_test_bool {\newpage}} \endinput %% %% End of file `problem.sty'.