Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{amsmath}
- usepackage{etoolbox}
- usepackage{xparse}
- usepackage{pgffor}
- makeatletter
- defae@tmp@frontmatter{}
- defae@list{}
- NewDocumentCommandqchoice{ mom }
- {%%
- defae@tmp@frontmatter{#2}
- letae@listrelax
- foreach myn in {#3}
- {%%
- ifxae@listrelax
- xdefae@list{noexpand#1{expandonceae@tmp@frontmatterexpandoncemyn}}%%
- else
- xdefae@list{expandonceae@listnoexpandpar%%
- noexpand#1{expandonceae@tmp@frontmatterexpandoncemyn}}%%
- fi
- }%%
- ae@list}
- makeatother
- newcommandaebf[1]{$rightarrow$ textbf{#1} DONE}
- pagestyle{empty}
- begin{document}
- qchoiceaebf[front matter::]{a,b,c,d}
- end{document}
- documentclass{article}
- usepackage{amsmath}
- usepackage{xparse}
- ExplSyntaxOn
- tl_new:N l_qchoice_command_sequence_tl
- tl_new:N l_qchoice_front_matter_tl
- tl_new:N l_qchoice_csv_choices_tl
- tl_new:N l_qchoice_tmp_tl
- seq_new:N l_qchoice_choices_seq
- NewDocumentCommandqchoice{ mom }
- {%%
- tl_set:Nn l_qchoice_command_sequence_tl {#1}
- tl_clear:N l_qchoice_front_matter_tl
- tl_clear:N l_qchoice_csv_choices_tl
- IfNoValueF{#2}
- {
- tl_set:Nn l_qchoice_front_matter_tl {#2}
- }
- seq_set_split:Nnn l_qchoice_choices_seq {,} {#3}
- seq_map_function:NN l_qchoice_choices_seq qchoice_parse_choices:n
- l_qchoice_csv_choices_tl
- }
- cs_new:Npn qchoice_parse_choices:n #1
- {
- tl_clear:N l_qchoice_tmp_tl
- tl_set:No l_qchoice_tmp_tl l_qchoice_front_matter_tl
- tl_put_right:Nn l_qchoice_tmp_tl {#1}
- tl_set:No l_qchoice_tmp_tl {{l_qchoice_tmp_tl}}
- tl_if_empty:NTF l_qchoice_csv_choices_tl
- {
- tl_set:No l_qchoice_csv_choices_tl l_qchoice_tmp_tl
- }
- {
- tl_put_right:Nn l_qchoice_csv_choices_tl {par}
- tl_put_right:No l_qchoice_csv_choices_tl {l_qchoice_tmp_tl}
- }
- }
- ExplSyntaxOff
- newcommandaebf[1]{$rightarrow$ textbf{#1} DONE}
- pagestyle{empty}
- begin{document}
- qchoiceaebf[front matter::]{a,b,c,d}
- end{document}
- tl_set:No l_qchoice_tmp_tl {{l_qchoice_tmp_tl}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement