diff options
author | Karl Berry <karl@freefriends.org> | 2015-11-19 22:42:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-11-19 22:42:11 +0000 |
commit | 197d2563d3d5a70465f9b6f942cfc1b9afd8d771 (patch) | |
tree | 6e0a59e2995dd9e1c0c57026626364cbe308ca98 /Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def | |
parent | 7b703227755f59f6d8e6aa04eedefe0b86e20cc3 (diff) |
exsheets (18nov15)
git-svn-id: svn://tug.org/texlive/trunk@38898 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def | 149 |
1 files changed, 87 insertions, 62 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index 89e09c51574..3c8cded5ca9 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -30,14 +30,6 @@ \ProvidesFile{exsheets_headings.def} [\exsheets@date\space v\exsheets@version\space ExSheets headings object] -\coffin_new:N \l__exsheets_heading_main_coffin -\coffin_new:N \l__exsheets_heading_pre_coffin -\coffin_new:N \l__exsheets_heading_post_coffin -\coffin_new:N \l__exsheets_heading_title_coffin -\coffin_new:N \l__exsheets_heading_number_coffin -\coffin_new:N \l__exsheets_heading_points_coffin -\coffin_new:N \l__exsheets_heading_subtitle_coffin - % the object variables: \bool_new:N \l__exsheets_heading_runin_bool \bool_new:N \l__exsheets_heading_inline_bool @@ -117,15 +109,16 @@ \cs_new:Npn \__exsheets_join_coffins:nnnnnnnn #1#2#3#4#5#6#7#8 { \coffin_join:cnncnnnn - { l__exsheets_heading_#1_coffin } { #2 } { #3 } - { l__exsheets_heading_#4_coffin } { #5 } { #6 } - { #7 } { #8 } + { l__exsheets_heading_#1_coffin } {#2} {#3} + { l__exsheets_heading_#4_coffin } {#5} {#6} + {#7} + {#8} } \cs_new:Npn \__exsheets_attach:N #1 { \seq_map_inline:Nn #1 { - \tl_if_blank:nF { ##1 } + \tl_if_blank:nF {##1} { \exp_after:wN \__exsheets_attach_coffin_sequence:w ##1 } } } @@ -135,21 +128,52 @@ \cs_new:Npn \__exsheets_attach_coffins:nnnnnnnn #1#2#3#4#5#6#7#8 { \coffin_attach:cnncnnnn - { l__exsheets_heading_#1_coffin } { #2 } { #3 } - { l__exsheets_heading_#4_coffin } { #5 } { #6 } - { #7 } { #8 } + { l__exsheets_heading_#1_coffin } {#2} {#3} + { l__exsheets_heading_#4_coffin } {#5} {#6} + {#7} + {#8} + } + +\prop_new:N \l__exsheets_heading_coffins_prop + +\prg_new_conditional:Npnn \exsheets_if_heading_coffin:n #1 {T,F,TF} + { + \coffin_if_exist:cTF {l__exsheets_heading_#1_coffin} + { \prg_return_true: } + { \prg_return_false: } } +\cs_new_protected:Npn \exsheets_new_heading_coffin:n #1 + { \coffin_new:c {l__exsheets_heading_#1_coffin} } + +\cs_new_protected:Npn \exsheets_set_heading_coffin:nn #1#2 + { + \exsheets_if_heading_coffin:nF {#1} + { \exsheets_new_heading_coffin:n {#1} } + \prop_put:Nnn \l__exsheets_heading_coffins_prop {#1} {#2} + } + +\NewDocumentCommand \DeclareExSheetsHeadingContainer {m+m} + { \exsheets_set_heading_coffin:nn {#1} {#2} } + +\exsheets_new_heading_coffin:n {main} +\exsheets_new_heading_coffin:n {pre} +\exsheets_new_heading_coffin:n {post} +\exsheets_new_heading_coffin:n {title} +\exsheets_new_heading_coffin:n {number} +\exsheets_new_heading_coffin:n {points} +\exsheets_new_heading_coffin:n {subtitle} + % the `exsheets-heading' object: % #1 = title, % #2 = number, % #3 = points % #4 = bonus % #5 = id -\DeclareObjectType { exsheets-heading } { 5 } +\DeclareObjectType {exsheets-heading} {5} % the `default' template interface: -\DeclareTemplateInterface { exsheets-heading } { default } { 5 } +\DeclareTemplateInterface {exsheets-heading} {default} {5} { inline : boolean = false , runin : boolean = false , @@ -178,31 +202,31 @@ } % the `default' template code: -\DeclareTemplateCode { exsheets-heading } { default } { 5 } +\DeclareTemplateCode {exsheets-heading} {default} {5} { - inline = \l__exsheets_heading_inline_bool , - runin = \l__exsheets_heading_runin_bool , - indent-first = \l__exsheets_heading_indent_first_bool , - toc-reversed = \l__exsheets_heading_toc_reversed_bool , - vscale = \l__exsheets_heading_scale_fp , - above = \l__exsheets_heading_above_dim , - below = \l__exsheets_heading_below_dim , - main = \l__exsheets_heading_main_tl , - pre-code = \l__exsheets_heading_pre_code_tl , - post-code = \l__exsheets_heading_post_code_tl , - title-format = \l__exsheets_heading_title_format_tl , - title-pre-code = \l__exsheets_heading_title_pre_code_tl , - title-post-code = \l__exsheets_heading_title_post_code_tl , - number-format = \l__exsheets_heading_number_format_tl , - number-pre-code = \l__exsheets_heading_number_pre_code_tl , - number-post-code = \l__exsheets_heading_number_post_code_tl , - subtitle-format = \l__exsheets_heading_title_format_tl , - subtitle-pre-code = \l__exsheets_heading_subtitle_pre_code_tl , - subtitle-post-code = \l__exsheets_heading_subtitle_post_code_tl , - points-format = \l__exsheets_heading_points_format_tl , - points-pre-code = \l__exsheets_heading_points_pre_code_tl , - points-post-code = \l__exsheets_heading_points_post_code_tl , - join = \l__exsheets_heading_joined_coffins_tl , + inline = \l__exsheets_heading_inline_bool , + runin = \l__exsheets_heading_runin_bool , + indent-first = \l__exsheets_heading_indent_first_bool , + toc-reversed = \l__exsheets_heading_toc_reversed_bool , + vscale = \l__exsheets_heading_scale_fp , + above = \l__exsheets_heading_above_dim , + below = \l__exsheets_heading_below_dim , + main = \l__exsheets_heading_main_tl , + pre-code = \l__exsheets_heading_pre_code_tl , + post-code = \l__exsheets_heading_post_code_tl , + title-format = \l__exsheets_heading_title_format_tl , + title-pre-code = \l__exsheets_heading_title_pre_code_tl , + title-post-code = \l__exsheets_heading_title_post_code_tl , + number-format = \l__exsheets_heading_number_format_tl , + number-pre-code = \l__exsheets_heading_number_pre_code_tl , + number-post-code = \l__exsheets_heading_number_post_code_tl , + subtitle-format = \l__exsheets_heading_title_format_tl , + subtitle-pre-code = \l__exsheets_heading_subtitle_pre_code_tl , + subtitle-post-code = \l__exsheets_heading_subtitle_post_code_tl , + points-format = \l__exsheets_heading_points_format_tl , + points-pre-code = \l__exsheets_heading_points_pre_code_tl , + points-post-code = \l__exsheets_heading_points_post_code_tl , + join = \l__exsheets_heading_joined_coffins_tl , attach = \l__exsheets_heading_attached_coffins_tl } { @@ -234,16 +258,6 @@ } } } - \hcoffin_set:Nn \l__exsheets_heading_pre_coffin - { \tl_use:N \l__exsheets_heading_pre_code_tl } - \hcoffin_set:Nn \l__exsheets_heading_post_coffin - { \tl_use:N \l__exsheets_heading_post_code_tl } - \coffin_join:NnnNnnnn - \l__exsheets_heading_main_coffin { l } { t } - \l__exsheets_heading_pre_coffin { l } { b } { 0pt } { 0pt } - \coffin_join:NnnNnnnn - \l__exsheets_heading_main_coffin { l } { b } - \l__exsheets_heading_post_coffin { l } { t } { 0pt } { 0pt } \hcoffin_set:Nn \l__exsheets_heading_title_coffin { \tl_use:N \l__exsheets_heading_title_format_tl @@ -274,7 +288,7 @@ { \group_begin: \tl_use:N \l_exsheets_heading_subtitle_user_format_tl - { \exsheets_get_question_property:nn { subtitle } { #5 } } + { \exsheets_get_question_property:nn {subtitle} {#5} } \group_end: } \tl_use:N \l__exsheets_heading_subtitle_post_code_tl @@ -303,10 +317,10 @@ \fp_compare_p:n { #4 = 0 } } { - \exsheets_parse_points:n { #3 } - \exsheets_points_name:n { #3 } + \exsheets_parse_points:n {#3} + \exsheets_points_name:n {#3} } - { \exsheets_parse_points:n { #3 } } + { \exsheets_parse_points:n {#3} } } \fp_compare:nF { #4 = 0 } { @@ -317,11 +331,11 @@ \fp_compare_p:n { #3 = 0 } } { - \exsheets_print_bonus:n { #4 } + \exsheets_print_bonus:n {#4} \tl_use:N \l__exsheets_points_post_bonus_marker_tl } { - \exsheets_parse_bonus:n { #4 } + \exsheets_parse_bonus:n {#4} \tl_use:N \l__exsheets_points_post_bonus_marker_tl \exsheets_points_name:n { #3 + #4 } } @@ -336,11 +350,10 @@ \group_begin: \tl_use:N \l__exsheets_heading_title_format_tl \strut \group_end: - % \exp_args:Nx \tl_show:n { #3 } - \tl_if_eq:xnF { #3 } { 0 } + \tl_if_eq:xnF {#3} {0} { \tl_use:N \l__exsheets_heading_points_pre_code_tl - { \exsheets_print_points:n { #3 } } + { \exsheets_print_points:n {#3} } \tl_use:N \l__exsheets_heading_points_post_code_tl } } @@ -358,10 +371,22 @@ \l__exsheets_heading_below_dim } } + \hcoffin_set:Nn \l__exsheets_heading_pre_coffin + { \tl_use:N \l__exsheets_heading_pre_code_tl } + \hcoffin_set:Nn \l__exsheets_heading_post_coffin + { \tl_use:N \l__exsheets_heading_post_code_tl } + \coffin_join:NnnNnnnn + \l__exsheets_heading_main_coffin {l} {t} + \l__exsheets_heading_pre_coffin {l} {b} {0pt} {0pt} + \coffin_join:NnnNnnnn + \l__exsheets_heading_main_coffin {l} {b} + \l__exsheets_heading_post_coffin {l} {t} {0pt} {0pt} + \prop_map_inline:Nn \l__exsheets_heading_coffins_prop + { \hcoffin_set:cn {l__exsheets_heading_##1_coffin} {##2} } \__exsheets_join:N \l__exsheets_heading_joined_coffins_seq \__exsheets_attach:N \l__exsheets_heading_attached_coffins_seq \bool_if:NTF \l__exsheets_heading_inline_bool - { \exsheets_questions_debug: } + { \exsheets_questions_debug:n {#5} } { \skip_vertical:N \l__exsheets_heading_above_dim \exsheets_needspace:n @@ -371,7 +396,7 @@ \l__exsheets_heading_below_dim + \baselineskip } - \exsheets_questions_debug: + \exsheets_questions_debug:n {#5} \noindent } \skip_set:Nn \parfillskip { 0pt plus 1fil } |