Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{amsmath}
  3. usepackage{etoolbox}
  4. usepackage{xparse}
  5. usepackage{pgffor}
  6.  
  7. makeatletter
  8.  
  9. defae@tmp@frontmatter{}
  10. defae@list{}
  11. NewDocumentCommandqchoice{ mom }
  12. {%%
  13. defae@tmp@frontmatter{#2}
  14. letae@listrelax
  15. foreach myn in {#3}
  16. {%%
  17. ifxae@listrelax
  18. xdefae@list{noexpand#1{expandonceae@tmp@frontmatterexpandoncemyn}}%%
  19. else
  20. xdefae@list{expandonceae@listnoexpandpar%%
  21. noexpand#1{expandonceae@tmp@frontmatterexpandoncemyn}}%%
  22. fi
  23. }%%
  24. ae@list}
  25.  
  26. makeatother
  27.  
  28. newcommandaebf[1]{$rightarrow$ textbf{#1} DONE}
  29. pagestyle{empty}
  30. begin{document}
  31.  
  32. qchoiceaebf[front matter::]{a,b,c,d}
  33.  
  34. end{document}
  35.  
  36. documentclass{article}
  37. usepackage{amsmath}
  38. usepackage{xparse}
  39.  
  40. ExplSyntaxOn
  41.  
  42. tl_new:N l_qchoice_command_sequence_tl
  43. tl_new:N l_qchoice_front_matter_tl
  44. tl_new:N l_qchoice_csv_choices_tl
  45. tl_new:N l_qchoice_tmp_tl
  46. seq_new:N l_qchoice_choices_seq
  47.  
  48. NewDocumentCommandqchoice{ mom }
  49. {%%
  50. tl_set:Nn l_qchoice_command_sequence_tl {#1}
  51. tl_clear:N l_qchoice_front_matter_tl
  52. tl_clear:N l_qchoice_csv_choices_tl
  53. IfNoValueF{#2}
  54. {
  55. tl_set:Nn l_qchoice_front_matter_tl {#2}
  56. }
  57. seq_set_split:Nnn l_qchoice_choices_seq {,} {#3}
  58. seq_map_function:NN l_qchoice_choices_seq qchoice_parse_choices:n
  59. l_qchoice_csv_choices_tl
  60. }
  61.  
  62. cs_new:Npn qchoice_parse_choices:n #1
  63. {
  64. tl_clear:N l_qchoice_tmp_tl
  65. tl_set:No l_qchoice_tmp_tl l_qchoice_front_matter_tl
  66. tl_put_right:Nn l_qchoice_tmp_tl {#1}
  67. tl_set:No l_qchoice_tmp_tl {{l_qchoice_tmp_tl}}
  68. tl_if_empty:NTF l_qchoice_csv_choices_tl
  69. {
  70. tl_set:No l_qchoice_csv_choices_tl l_qchoice_tmp_tl
  71. }
  72. {
  73. tl_put_right:Nn l_qchoice_csv_choices_tl {par}
  74. tl_put_right:No l_qchoice_csv_choices_tl {l_qchoice_tmp_tl}
  75. }
  76. }
  77.  
  78. ExplSyntaxOff
  79.  
  80. newcommandaebf[1]{$rightarrow$ textbf{#1} DONE}
  81. pagestyle{empty}
  82. begin{document}
  83.  
  84. qchoiceaebf[front matter::]{a,b,c,d}
  85.  
  86. end{document}
  87.  
  88. tl_set:No l_qchoice_tmp_tl {{l_qchoice_tmp_tl}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement