diff options
Diffstat (limited to 'macros/latex/contrib/tasks')
-rw-r--r-- | macros/latex/contrib/tasks/README | 31 | ||||
-rw-r--r-- | macros/latex/contrib/tasks/tasks.cfg | 53 | ||||
-rw-r--r-- | macros/latex/contrib/tasks/tasks.sty | 778 | ||||
-rw-r--r-- | macros/latex/contrib/tasks/tasks_en.pdf | bin | 0 -> 459628 bytes | |||
-rw-r--r-- | macros/latex/contrib/tasks/tasks_en.tex | 581 |
5 files changed, 1443 insertions, 0 deletions
diff --git a/macros/latex/contrib/tasks/README b/macros/latex/contrib/tasks/README new file mode 100644 index 0000000000..48d949ffac --- /dev/null +++ b/macros/latex/contrib/tasks/README @@ -0,0 +1,31 @@ +-------------------------------------------------------------------------- +the TASKS package v0.12 2016/08/13 + + Horizontal columned lists. + +-------------------------------------------------------------------------- +Clemens Niederberger +Web: https://github.com/cgnieder/tasks/ +E-Mail: contact@mychemistry.eu +-------------------------------------------------------------------------- +Copyright 2013-2016 Clemens Niederberger + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is Clemens Niederberger. +-------------------------------------------------------------------------- +The tasks package consists of the files + - tasks.sty, tasks.cfg, tasks_en.tex, task_en.pdf + - README +-------------------------------------------------------------------------- +If you have any ideas, questions, suggestions or bugs to report, please +feel free to contact me. +-------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tasks/tasks.cfg b/macros/latex/contrib/tasks/tasks.cfg new file mode 100644 index 0000000000..7a62d42383 --- /dev/null +++ b/macros/latex/contrib/tasks/tasks.cfg @@ -0,0 +1,53 @@ +% -------------------------------------------------------------------------- +% the TASKS package +% +% Horizontal columned lists. +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/tasks/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013-2016 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +% further instances for the `tasks' environment +\ProvidesFile{tasks.cfg} + [% + \csname c_tasks_date_tl\endcsname\space + v\csname c_tasks_version_tl\endcsname\space + tasks instances% + ] + +% ITEMIZE: +\DeclareInstance {tasks} {itemize} {default} + { + enumerate = false , + label-width = 1.125em + } + +% ENUMERATE: +\DeclareInstance {tasks} {enumerate} {default} + { counter-format = tsk. } + +% MULTIPLECHOICE +\DeclareInstance {tasks} {multiplechoice} {default} + { + enumerate = false , + label = \choicebox + } + diff --git a/macros/latex/contrib/tasks/tasks.sty b/macros/latex/contrib/tasks/tasks.sty new file mode 100644 index 0000000000..81e265ed5e --- /dev/null +++ b/macros/latex/contrib/tasks/tasks.sty @@ -0,0 +1,778 @@ +% -------------------------------------------------------------------------- +% the TASKS package +% +% Horizontal columned lists. +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/tasks/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013-2016 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\RequirePackage { expl3 , xparse , epic , cntformats , xtemplate , environ } +\ExplSyntaxOn + +\tl_const:Nn \c_tasks_name_tl {tasks} +\tl_const:Nn \c_tasks_date_tl {2016/08/13} +\tl_const:Nn \c_tasks_version_tl {0.12} +\tl_const:Nn \c_tasks_info_tl {Horizontal columned lists} + +\ProvidesExplPackage + {\c_tasks_name_tl} + {\c_tasks_date_tl} + {\c_tasks_version_tl} + {\c_tasks_info_tl \c_space_tl (CN)} + +% -------------------------------------------------------------------------- +% variants of kernel functions: +\cs_generate_variant:Nn \tl_if_eq:nnTF { V } +\cs_generate_variant:Nn \tl_if_eq:nnT { V } + +% -------------------------------------------------------------------------- +% variables: +\seq_new:N \l__tasks_seq + +\int_new:N \l__tasks_depth_int +\int_new:N \g__tasks_int +\int_new:N \g__tasks_total_items_int +\int_new:N \l__tasks_columns_int +\int_new:N \l__tasks_rows_int +\int_new:N \g__tasks_current_col_num_int +\int_new:N \g__tasks_current_row_num_int +\int_new:N \l__tasks_item_columns_int + +\bool_new:N \l__tasks_enumerate_bool +\bool_new:N \l__tasks_resume_bool +\bool_new:N \l__tasks_load_tasks_bool +\bool_new:N \l__tasks_label_width_bool +\bool_new:N \l__tasks_item_indent_bool +\bool_new:N \l__tasks_label_offset_bool +\bool_new:N \l__tasks_custom_label_bool +\bool_new:N \l__tasks_custom_after_item_skip_bool +\bool_new:N \l__tasks_debug_bool +\bool_new:N \l__tasks_item_full_line_bool +\bool_new:N \l__tasks_item_rest_of_line_bool + +\tl_new:N \l__tasks_instance_tl +\tl_new:N \l__tasks_label_tl +\tl_new:N \l__tasks_custom_label_tl +\tl_new:N \l__tasks_label_pattern_tl +\tl_new:N \l__tasks_custom_label_pattern_tl +\tl_new:N \l__tasks_label_format_tl +\tl_new:N \l__tasks_custom_label_format_tl +\tl_new:N \l__tasks_item_format_tl +\tl_new:N \l__tasks_custom_item_format_tl +\tl_new:N \l__tasks_item_fill_left_tl +\tl_new:N \l__tasks_item_fill_right_tl +\tl_new:N \l__tasks_label_align_tl +% \tl_new:N \task +\tl_new:N \l__tasks_item_tl +\tl_new:N \l__tasks_tmp_label_tl + +\dim_new:N \l__tasks_item_indent_dim +\dim_new:N \l__tasks_item_default_indent_dim +\dim_new:N \l__tasks_item_width_dim +\dim_new:N \l__tasks_label_width_dim +\dim_new:N \l__tasks_label_default_width_dim +\dim_new:N \l__tasks_label_offset_dim +\dim_new:N \l__tasks_label_default_offset_dim +\dim_new:N \l__tasks_column_sep_dim + +\skip_new:N \l__tasks_after_item_skip +\skip_new:N \l__tasks_custom_after_item_skip +\skip_new:N \l__tasks_before_list_skip +\skip_new:N \l__tasks_after_list_skip + +\coffin_new:N \l__tasks_item_coffin +\coffin_new:N \l__tasks_label_coffin + +\NewCounterPattern* [ tasks ] { task } { tsk } +\ReadCounterFrom [ tasks ] { task } \g__tasks_int + +% temporary variables: +\int_new:N \l__tasks_tmpa_int +\int_new:N \l__tasks_tmpb_int +\tl_new:N \l__tasks_tmpa_tl +\coffin_new:N \l__tasks_tmpa_coffin + +\cs_new:Npn \__tasks_debug:n #1 + { + \bool_if:NTF \l__tasks_debug_bool + { \fbox {#1} } + { \use:n {#1} } + } + +% -------------------------------------------------------------------------- +% collect the tasks: +\cs_new_protected:Npn \__tasks_collect_tasks:nww #1#2 \end #3 + { + \tl_put_right:Nn \l__tasks_body_tl {#1} + \end {#3} + \tl_if_eq:nnF {#1} {#3} + { \__tasks_collect_tasks:nww {#1} } + } + +% #1: instance +% #2: number of columns +% #3: item separator +% #4: environment body +\cs_new_protected:Npn \__tasks:nnnn #1#2#3#4 + { + \bool_if:NT \l__tasks_debug_bool { \dim_set:Nn \fboxsep {0pt} } + \seq_set_split:Nnn \l__tasks_seq {#3} {#4} + % remove the first (empty) item: + \seq_pop_left:NN \l__tasks_seq \l__tasks_tmpa_tl + \tl_if_blank:VF \l__tasks_tmpa_tl { \@noitemerr } + \int_gset:Nn \g__tasks_total_items_int + { \seq_count:N \l__tasks_seq } + \UseInstance {tasks} {#1} + { \g__tasks_total_items_int } + {#2} + { \l__tasks_custom_label_pattern_tl } + % just to be sure: + \seq_clear:N \l__tasks_seq + } +\cs_generate_variant:Nn \__tasks:nnnn { VnnV } + +% #1: label +% #2: item format +% #3: item +\cs_new_protected:Npn \__tasks_task:nnn #1#2#3 + { + % start a new item line if \l__tasks_item_full_line_bool + \bool_if:NT \l__tasks_item_full_line_bool + { + % add skip if we were in the middle of a line, i.e., in horizontal + % mode: + \mode_if_horizontal:T + { \skip_vertical:N \l__tasks_after_item_skip } + \tasks_new_row: + } + % step column position: + \int_gincr:N \g__tasks_current_col_num_int + \dim_set:Nn \l__tasks_item_width_dim + { + \bool_if:NTF \l__tasks_item_full_line_bool + { \linewidth } + { + ( + \linewidth + - \l__tasks_columns_int \l__tasks_column_sep_dim + + \l__tasks_column_sep_dim + ) / \l__tasks_columns_int + } + - \l__tasks_depth_int \l__tasks_item_indent_dim + \bool_if:NT \l__tasks_debug_bool { -2\fboxrule } + } + \__tasks_gset_rows_num:NN + \g__tasks_total_items_int + \l__tasks_columns_int + % set \g__tasks_current_col_num_int to 1 if at the start of a row, + % then also step \g__tasks_current_row_num_int : + \int_compare:nNnT + { \g__tasks_current_col_num_int } > { \l__tasks_columns_int } + { + \int_gset:Nn \g__tasks_current_col_num_int { 1 } + \int_incr:N \g__tasks_current_row_num_int + } + \bool_if:NT \l__tasks_item_rest_of_line_bool + { + \int_set:Nn \l__tasks_tmpa_int + { \l__tasks_columns_int - \g__tasks_current_col_num_int + 1 } + \int_compare:nNnTF { \l__tasks_item_columns_int } = { 0 } + { + \int_set:Nn \l__tasks_tmpb_int { \l__tasks_tmpa_int - 1 } % 8 + } + { + \int_compare:nNnTF + { \l__tasks_tmpa_int } > { \l__tasks_item_columns_int } + { \int_set_eq:NN \l__tasks_tmpa_int \l__tasks_item_columns_int } + { \int_zero:N \l__tasks_item_columns_int } + \bool_if:nT + { + \l__tasks_item_rest_of_line_bool && + !\int_compare_p:nNn { \l__tasks_item_columns_int} = { 0 } + } + { + \int_gadd:Nn \g__tasks_current_col_num_int + { \l__tasks_item_columns_int -1 } + \int_gadd:Nn \g__tasks_total_items_int + { \l__tasks_item_columns_int -1 } + } + \int_set:Nn \l__tasks_tmpb_int { \l__tasks_tmpa_int -1 } + } + \dim_set:Nn \l__tasks_item_width_dim + { + \l__tasks_tmpa_int \l__tasks_item_width_dim + + \l__tasks_tmpb_int \l__tasks_column_sep_dim + + \l__tasks_tmpb_int \l__tasks_item_indent_dim + \bool_if:NT \l__tasks_debug_bool + { + \int_eval:n { \l__tasks_tmpb_int * 2 } \fboxrule } + } + } + % set the item box: + \hcoffin_set:Nn \l__tasks_item_coffin + { + \vcoffin_set:Nnn \l__tasks_tmpa_coffin + { \l__tasks_item_width_dim } + { \__tasks_setup: #2 {#3} \strut } + \__tasks_debug:n + { + \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin + {l} {T} {0pt} {0pt} + } + } + % set the label box: + \hcoffin_set:Nn \l__tasks_label_coffin + { + \vcoffin_set:Nnn \l__tasks_tmpa_coffin + { + \l__tasks_label_width_dim + \bool_if:NT \l__tasks_debug_bool {-2\fboxrule } + } + { + \noindent + \tl_use:N \l__tasks_item_fill_left_tl + \strut #1 + \tl_use:N \l__tasks_item_fill_right_tl + } + \__tasks_debug:n + { + \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin + {l} {T} {0pt} {0pt} + } + } + % attach the label box at the left of the item box, shifted by + % \l__tasks_label_offset_dim : + \coffin_attach:NnnNnnnn + \l__tasks_item_coffin {l} {T} + \l__tasks_label_coffin {l} {T} + { + \dim_compare:nNnTF + { \l__tasks_item_indent_dim } + < + { \l__tasks_label_offset_dim + \l__tasks_label_width_dim } + {0pt} + { - \l__tasks_label_width_dim - \l__tasks_label_offset_dim } + } { 0pt } + % when a new row starts enter vertical mode: + \int_compare:nNnT { \g__tasks_current_col_num_int } = { 1 } + { \skip_vertical:N \c_zero_skip } + % skip horizontally by \l__tasks_item_indent_dim + \noindent + \skip_horizontal:N \l__tasks_item_indent_dim + % typeset the item (with the attached label protruding to the left): + \coffin_typeset:Nnnnn \l__tasks_item_coffin + {l} + {T} + {0pt} + {0pt} + \bool_if:nT + { + \l__tasks_item_full_line_bool || + ( + \l__tasks_item_rest_of_line_bool && + \int_compare_p:nNn { \l__tasks_item_columns_int } = { 0 } + ) + } + { \tasks_new_row: } + % are we between items in a row? The skip by \l__tasks_column_sep_dim : + \int_compare:nNnT + { \g__tasks_current_col_num_int } < { \l__tasks_columns_int } + { \skip_horizontal:N \l__tasks_column_sep_dim } + % if we ended a row and a new row is still to come skip vertically by + % \l__tasks_after_item_skip : + \bool_if:nT + { + ( \int_compare_p:nNn { \g__tasks_current_col_num_int } = { \l__tasks_columns_int } ) + && + ( \int_compare_p:n { \g__tasks_current_row_num_int != \l__tasks_rows_int } ) + } + { \skip_vertical:N \l__tasks_after_item_skip } + % clean up: + \coffin_clear:N \l__tasks_item_coffin + \coffin_clear:N \l__tasks_label_coffin + \coffin_clear:N \l__tasks_tmpa_coffin + \bool_set_false:N \l__tasks_item_full_line_bool + \bool_set_false:N \l__tasks_item_rest_of_line_bool + } +\cs_generate_variant:Nn \__tasks_task:nnn { VVV } + +\cs_new_protected:Npn \__tasks_setup: + { + \dim_set:Nn \parskip { 0pt } + \skip_set:Nn \parfillskip { 0pt plus 1fil } + \dim_set_eq:NN \parskip \parsep + \dim_set_eq:NN \parindent \listparindent + \noindent + \dim_compare:nNnT + { \l__tasks_item_indent_dim } + < + { \l__tasks_label_offset_dim + \l__tasks_label_width_dim } + { + \skip_horizontal:n + { + \l__tasks_label_offset_dim + + \l__tasks_label_width_dim + - \l__tasks_item_indent_dim + } + } + \strut + } + +\cs_new_protected:Npn \__tasks_gset_rows_num:NN #1#2 + { + \int_gset:Nn \l__tasks_rows_int { \int_div_truncate:nn {#1} {#2} } + \int_compare:nNnT { \int_mod:nn {#1} {#2} } > { 0 } + { \int_gincr:N \l__tasks_rows_int } + } + +\cs_new_protected:Npn \__tasks_label_align:n #1 + { + \str_case:nnF {#1} + { + {left} + { + \tl_clear:N \l__tasks_item_fill_left_tl + \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill + } + {right} + { + \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill + \tl_clear:N \l__tasks_item_fill_right_tl + } + {center} + { + \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill + \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill + } + } + { + \tl_clear:N \l__tasks_item_fill_left_tl + \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill + } + } +\cs_generate_variant:Nn \__tasks_label_align:n { V } +\__tasks_label_align:n {left} + +% -------------------------------------------------------------------------- +% the `tasks' object: +% #1: number of items +% #2: number of columns +% #3: label-format +\DeclareObjectType {tasks} {3} +% the `default' template interface: +\DeclareTemplateInterface {tasks} {default} {3} + { + enumerate : boolean = true , + label : tokenlist , + indent : length = 2.5em , + counter-format : tokenlist = tsk[a]) , + label-format : tokenlist , + label-width : length = 1em , + label-offset : length = .3333em , + item-format : tokenlist , + after-item-skip : skip = 1ex plus 1ex minus 1ex + } + +% in the next three commands we want a really unlikely to occur marker; for +% this we use $ with unusual catcode in ``$tasks$default$label$'': +\cs_set:Nx \__tasks_restore_dollar: + { \char_set_catcode:nn {36} { \char_value_catcode:n {36} } } +\char_set_catcode_alignment:N \$ + +% the `default' template code: +\DeclareTemplateCode {tasks} {default} {3} + { + enumerate = \l__tasks_enumerate_bool , + label = \l__tasks_label_tl , + indent = \l__tasks_item_default_indent_dim , + counter-format = \l__tasks_label_pattern_tl , + label-format = \l__tasks_label_format_tl , + label-width = \l__tasks_label_default_width_dim , + label-offset = \l__tasks_label_default_offset_dim , + item-format = \l__tasks_item_format_tl , + after-item-skip = \l__tasks_after_item_skip + } + { + \AssignTemplateKeys + \bool_if:NF \l__tasks_label_width_bool + { + \dim_set_eq:NN + \l__tasks_label_width_dim + \l__tasks_label_default_width_dim + } + \bool_if:NF \l__tasks_item_indent_bool + { + \dim_set_eq:NN + \l__tasks_item_indent_dim + \l__tasks_item_default_indent_dim + } + \bool_if:NF \l__tasks_label_offset_bool + { + \dim_set_eq:NN + \l__tasks_label_offset_dim + \l__tasks_label_default_offset_dim + } + % \dim_compare:nNnT + % { \l__tasks_item_indent_dim } + % < + % { \l__tasks_label_offset_dim + \l__tasks_label_width_dim } + % { + % \dim_set:Nn \l__tasks_item_indent_dim + % { \l__tasks_label_offset_dim + \l__tasks_label_width_dim } + % } + \bool_if:NT \l__tasks_custom_after_item_skip_bool + { + \skip_set_eq:NN + \l__tasks_after_item_skip + \l__tasks_custom_after_item_skip + } + \bool_if:NT \l__tasks_custom_label_bool + { + \tl_set_eq:NN + \l__tasks_label_tl + \l__tasks_custom_label_tl + \bool_set_false:N \l__tasks_enumerate_bool + } + \__tasks_label_align:V \l__tasks_label_align_tl + % need this for enumerate list: + \bool_if:nT { !\l__tasks_resume_bool && \l__tasks_enumerate_bool } + { \int_gzero:N \g__tasks_int } + \int_set:Nn \l__tasks_columns_int {#2} + % set all the items in their own coffins and join with the ground: + \int_gzero:N \g__tasks_current_col_num_int + \int_set:Nn \g__tasks_current_row_num_int {1} + \tl_if_blank:VF \l__tasks_custom_label_pattern_tl + { + \tl_set_eq:NN + \l__tasks_label_pattern_tl + \l__tasks_custom_label_pattern_tl + } + \tl_if_blank:VF \l__tasks_custom_label_format_tl + { + \tl_set_eq:NN + \l__tasks_label_format_tl + \l__tasks_custom_label_format_tl + } + \tl_if_blank:VF \l__tasks_custom_item_format_tl + { + \tl_set_eq:NN + \l__tasks_item_format_tl + \l__tasks_custom_item_format_tl + } + \seq_map_inline:Nn \l__tasks_seq + { + \__tasks_read_item:www ##1 \q_stop + \bool_if:NTF \l__tasks_enumerate_bool + { + \tl_if_eq:VnT \l__tasks_tmp_label_tl { $tasks$default$label$ } + { + \int_gincr:N \g__tasks_int + \SaveCounterPatternFrom [tasks] + \l__tasks_tmpa_tl + \l__tasks_label_tl + \l__tasks_label_pattern_tl + \cs_gset:Npx \@currentlabel { \l__tasks_label_tl } + } + } + { + \tl_if_blank:VT \l__tasks_label_tl + { \tl_set_eq:NN \l__tasks_label_tl \labelitemi } + } + \tl_put_left:NV \l__tasks_label_tl \l__tasks_label_format_tl + % \tl_put_left:NV \l__tasks_item_tl \l__tasks_item_format_tl + \tl_if_eq:VnTF \l__tasks_tmp_label_tl { $tasks$default$label$ } + { + \__tasks_task:VVV + \l__tasks_label_tl + \l__tasks_item_format_tl + \l__tasks_item_tl + } + { + \__tasks_task:VVV + \l__tasks_tmp_label_tl + \l__tasks_item_format_tl + \l__tasks_item_tl + \tl_clear:N \l__tasks_tmp_label_tl + } + } + } + +\cs_new_protected:Npn \__tasks_read_item:www + { + \peek_meaning_remove:NTF ! + { + \bool_set_true:N \l__tasks_item_full_line_bool + \__tasks_read_item_aux:ww + } + { + \peek_meaning_remove:NTF * + { + \bool_set_true:N \l__tasks_item_rest_of_line_bool + \__tasks_read_item_rest_of_line:ww + } + { \__tasks_read_item_aux:ww } + } + } + +\cs_new_protected:Npn \__tasks_read_item_rest_of_line:ww + { + \peek_meaning:NTF ( % ) + { \__tasks_read_item_rest_of_line_aux:ww } + { \__tasks_read_item_rest_of_line_aux:ww (0) } + } + +\cs_new_protected:Npn \__tasks_read_item_rest_of_line_aux:ww (#1) + { + \int_set:Nn \l__tasks_item_columns_int {#1} + \__tasks_read_item_aux:ww + } + +\cs_new_protected:Npn \__tasks_read_item_aux:ww + { + \peek_meaning:NTF [ % ] + { \__tasks_read_item_aux_ii:ww } + { \__tasks_read_item_aux_ii:ww [$tasks$default$label$] } + } + +\cs_new_protected:Npn \__tasks_read_item_aux_ii:ww [#1]#2 \q_stop + { + \tl_set:Nn \l__tasks_tmp_label_tl {#1} + \tl_if_eq:nnF { #1 } { $tasks$default$label$ } + { \tl_put_left:NV \l__tasks_tmp_label_tl \l__tasks_label_format_tl } + \tl_set:Nx \l__tasks_item_tl { \tl_trim_spaces:n {#2} } + } + +\__tasks_restore_dollar: + +% -------------------------------------------------------------------------- +% choice box: +\bool_new:N \l__tasks_choice_checked_bool +\dim_new:N \l__tasks_choice_width_dim +\dim_set:Nn \l__tasks_choice_width_dim { 1.25ex } +\dim_new:N \l__tasks_choice_linewidth_dim +\dim_set:Nn \l__tasks_choice_linewidth_dim { .3pt } +\dim_new:N \l__tasks_choice_checkwidth_dim +\dim_set:Nn \l__tasks_choice_checkwidth_dim { .5pt } +\dim_new:N \l__tasks_choice_raise_dim +\dim_set:Nn \l__tasks_choice_raise_dim { .1ex } + +\cs_new_protected:Npn \tasks_choice: + { + \leavevmode + \group_begin: + \bool_set_false:N \l__tasks_choice_checked_bool + \box_move_up:nn + { \l__tasks_choice_raise_dim } + { \hbox:n { \__tasks_choice: } } + \group_end: + } + +\cs_new_protected:Npn \tasks_choice_checked: + { + \leavevmode + \group_begin: + \bool_set_true:N \l__tasks_choice_checked_bool + \box_move_up:nn + { \l__tasks_choice_raise_dim } + { \hbox:n { \__tasks_choice: } } + \group_end: + } + +\cs_new_protected:Npn \__tasks_choice: + {% + \dim_set:Nn \unitlength { .1\l__tasks_choice_width_dim } + \begin{picture}(10,0) + \linethickness \l__tasks_choice_linewidth_dim + \drawline(0,0)(0,10)(10,10)(10,0)(0,0) + \linethickness \l__tasks_choice_checkwidth_dim + \bool_if:NT \l__tasks_choice_checked_bool + { + \drawline(2,2)(8,8) + \drawline(2,8)(8,2) + } + \end{picture}% + } + +\providecommand* \choicebox { \tasks_choice: } +\providecommand* \checkedchoicebox { \tasks_choice_checked: } + +% -------------------------------------------------------------------------- +% base instance: +% ALPHABETIZE: a) b) c) +\DeclareInstance {tasks} {alphabetize} {default} { } + +\keys_define:nn {tasks/list} + { + debug .bool_set:N = \l__tasks_debug_bool , + style .tl_set:N = \l__tasks_instance_tl , + style .initial:n = alphabetize , + counter-format .tl_set:N = \l__tasks_custom_label_pattern_tl , + label .code:n = + \bool_set_true:N \l__tasks_custom_label_bool + \tl_set:Nn \l__tasks_custom_label_tl {#1} , + label-format .tl_set:N = \l__tasks_custom_label_format_tl , + label-width .code:n = + \dim_set:Nn \l__tasks_label_width_dim {#1} + \bool_set_true:N \l__tasks_label_width_bool , + label-offset .code:n = + \dim_set:Nn \l__tasks_label_offset_dim {#1} + \bool_set_true:N \l__tasks_label_offset_bool , + label-align .tl_set:N = \l__tasks_label_align_tl , + item-format .tl_set:N = \l__tasks_custom_item_format_tl , + item-indent .code:n = + \dim_set:Nn \l__tasks_item_indent_dim {#1} + \bool_set_true:N \l__tasks_item_indent_bool , + column-sep .dim_set:N = \l__tasks_column_sep_dim , + before-skip .skip_set:N = \l__tasks_before_list_skip , + after-skip .skip_set:N = \l__tasks_after_list_skip , + after-item-skip .code:n = + \bool_set_true:N \l__tasks_custom_after_item_skip_bool + \skip_set:Nn \l__tasks_custom_after_item_skip {#1} , + resume .bool_set:N = \l__tasks_resume_bool + } + +% -------------------------------------------------------------------------- +% the generic environment: +\NewEnviron {__tasks_env:} [3] + { + \if@inlabel + \noindent\par\nobreak\vskip-\parskip\vskip-\baselineskip\hrule\@height\z@ + \fi + \dim_compare:nNnF { \l__tasks_before_list_skip } = { 0pt } + { \vspace {\l__tasks_before_list_skip} } + \list {} + { + \keys_set:nn {tasks/list} {#2} + \dim_set:Nn \leftmargin {0pt} + \dim_set:Nn \rightmargin {0pt} + } + \item \scan_stop: + \int_incr:N \l__tasks_depth_int + \__tasks:VnnV \l__tasks_instance_tl {#3} {#1} \BODY + \endlist + \dim_compare:nNnF { \l__tasks_after_list_skip } = { 0pt } + { \vspace {\l__tasks_after_list_skip} } + } + +% -------------------------------------------------------------------------- +% command to start a new row: +\cs_new_protected:Npn \tasks_new_row: + { + \int_gset:Nn \g__tasks_total_items_int + { + \g__tasks_total_items_int + + \l__tasks_columns_int - + \g__tasks_current_col_num_int + } + \__tasks_gset_rows_num:NN + \g__tasks_total_items_int + \l__tasks_columns_int + \int_gset_eq:NN \g__tasks_current_col_num_int \l__tasks_columns_int + } + +\NewDocumentCommand \startnewitemline {} + { \tasks_new_row: } + +% -------------------------------------------------------------------------- +% the user environment: +\NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} } + { + \NewDocumentEnvironment {#2} { O{}D(){#4} } + { \__tasks_env: {#3} { #1,##1 } {##2} } + { \end__tasks_env: } + } + +\NewDocumentCommand \RenewTasks { O{}mO{\task}D(){1} } + { + \RenewDocumentEnvironment {#2} { O{}D(){#4} } + { \__tasks_env: {#3} { #1,##1 } {##2} } + { \end__tasks_env: } + } + +% -------------------------------------------------------------------------- +% default list: +\NewTasks {tasks} + +\file_if_exist:nT {tasks.cfg} { \file_input:n {tasks.cfg} } + +% -------------------------------------------------------------------------- +% setup: +\cs_new_protected:Npn \tasks_setup:n #1 + { \keys_set:nn {tasks/list} {#1} } + +\NewDocumentCommand \settasks { m } + { \tasks_setup:n {#1} } + +% -------------------------------------------------------------------------- +\tex_endinput:D + +% HISTORY: +2013/01/19 v0.7 - extracted from `exsheets' package; this also lead to a + slightly new syntax and a few new options for it +2013/04/04 v0.8a - corrected \seq_length:N => \seq_count:N +2013/04/07 v0.9 - protected internal commands where appropriate + - made enumerated item referenceable with \label{} + and \ref{}; this introduced new options: + * the former `label-format' is now `counter-format' + * new: `label-format' + - changed defaults for `label-width' and `label-offset' + - ensure that the `after-item-skip' is only + inserted in between rows + - new option `after-item-skip' + - improvements when label are set with optional argument: + * a provided but empty argument is now correctly recognized + * the counter is _not_ stepped anymore for enumerated + lists when the optional argument is provided + - new command \startnewitemline that forces the next item to + be put at the beginning of a row +2013/04/22 v0.9a - new option `item-indent' + - synchronized version number with `exsheets' until now but + won't any more +2013/12/03 v0.9b - add missing \noindent for the case when \listparindent is + non-zero, fixes http://tex.stackexchange.com/q/148082/5049 +2014/05/11 v0.9c - remove definition of the \task macro: it is not necessary + for `tasks' to function but it conflicts e.g. with `ltxdoc' + class +2014/07/20 v0.10 - new option `debug' + - new option `column-sep + - renamed a few internal variables + - remove package from the `exsheets' bundle and distribute + it as package of its own + - new: optional bang to a \task forces an item to use a full + line (\task!) + - new: optional star to a \task forces an item to use the + complete remaining line (\task*); the star has itself has + an optional argument for specifying the number of columns + to span (\task*(<num>)) +2014/07/29 v0.10a - bug-fix: correct typo in option definition of `column-sep' + - insert before/after skip with \vspace* + - remove unnecessary (and unused) arguments of + \__tasks_task:nn + - add \strut to the end of an item +2016/05/03 v0.11 - new option: `item-format' + - some changes to how the list is displayed, especially + regarding spacing -- it now better resembles the standard + lists +2016/05/04 v0.11a - enable `style' option globally again +2016/08/13 v0.12 - the item indent and label width and label offset now play + together like one would expect: an item indent of 0pt will + align the complete item with the margin and the needed + overlap for the label is reserved diff --git a/macros/latex/contrib/tasks/tasks_en.pdf b/macros/latex/contrib/tasks/tasks_en.pdf Binary files differnew file mode 100644 index 0000000000..0e7f51af91 --- /dev/null +++ b/macros/latex/contrib/tasks/tasks_en.pdf diff --git a/macros/latex/contrib/tasks/tasks_en.tex b/macros/latex/contrib/tasks/tasks_en.tex new file mode 100644 index 0000000000..35b56f74a2 --- /dev/null +++ b/macros/latex/contrib/tasks/tasks_en.tex @@ -0,0 +1,581 @@ +% -------------------------------------------------------------------------- +% the TASKS package +% +% Horizontal columned lists. +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/tasks/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013-2014 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\documentclass[load-preamble+]{cnltx-doc} +\usepackage{tasks} + +\setcnltx{ + package = {tasks} , + authors = Clemens Niederberger , + email = {contact@mychemistry.eu} , + url = {https://github.com/cgnieder/tasks/} , + info = {create horizontal columned lists} , + add-cmds = { + checkedchoicebox , + choicebox, + NewTasks, + settasks, + startnewitemline , + task + } , + add-silent-cmds = { + choice, correct, + DeclareInstance, DeclareTemplateInterface, + leftthumbsup, + sample, Sample + } +} + +\BeforeBeginEnvironment{example}{\vspace{\baselineskip}} +\AfterEndEnvironment{example}{\vspace{\baselineskip}} +\BeforeBeginEnvironment{sourcecode}{\vspace{\baselineskip}} +\AfterEndEnvironment{sourcecode}{\vspace{\baselineskip}} + +\newpackagename\ExSheets{ExSheets} +\newpackagename\ExSheetslistings{ExSheets-listings} +\newpackagename\cntformats{cntformats} +\newpackagename\Tasks{tasks} + +% ---------------------------------------------------------------------------- +% other packages, bibliography, index +\usepackage{xcoffins,tikz,wasysym,enumitem,booktabs,siunitx} +\usepackage[accsupp]{acro} +\DeclareAcronym{id}{ + short = id , + long = Identifier , + format = \scshape , + pdfstring = ID , + accsupp = ID +} + +\usepackage{filecontents} +\usepackage{csquotes} + + + +% ---------------------------------------------------------------------------- +% example definitions that have to be done in the preamble: +\usepackage{exsheets} +\usepackage{dingbat} +\NewTasks[style=multiplechoice]{multiplechoice}[\choice](3) +\newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} + + +\newcommand*\sample{This is some sample text we will use to create a somewhat + longer text spanning a few lines.} +\newcommand*\Sample{\sample\ \sample\par\sample} + +\begin{document} + +\section{Motivation} +Originally \Tasks\ has been an integral part of the +\ExSheets\changedversion{0.7} package. However, users told me that it indeed +could be useful to have it as a stand-alone package not having to load the +whole \ExSheets\ beast just for having the \env{tasks} environment available. +Since I agree with this the environment has been extracted into a package if +its own, \Tasks. Since then \Tasks{} has been distributed as a package of its +own but as part of the \ExSheets{} bundle\changedversion{0.10}. With v0.10 I +decided to make it a completely independent package. So the relation to +\ExSheets{} only is a historical one. + +The reason for the \env{tasks} environment is an unwritten agreement in German +maths textbooks (exspecially in (junior) high school textbooks) to organize +exercises in columns counting horizontally rather than vertically. That is +what \code{tasks} primarily is for. If you don't need this feature you're +better off using traditional \LaTeX{} lists and the \pkg{enumitem} package for +customization. + +\section{License and Requirements}\label{sec:license} +\license + +\Tasks\ requires the \bnd{l3kernel}~\cite{bnd:l3kernel} bundle, +\needpackage{xparse}, \pkg{xtemplate} and \needpackage{l3keys2e} which are +part of the \bnd{l3packages}~\cite{bnd:l3packages} bundle, +\pkg{epic}~\cite{pkg:epic}, \pkg{cntformats}~\cite{pkg:cntformats}, and +\pkg{environ}~\cite{pkg:environ}. + + +\section{How it works} +\subsection{The Basics} +The \env{tasks} environment is similar to a list like \env{enumerate} but not +the same. Here are some of the differences: +\begin{itemize} + \item A first difference: there is no pagebreak possible inside an item but + only between items. + \item A second difference: the enumeration default is a), b), c) \ldots + \item A third difference: the body of the \env{tasks} environment is split + at \emph{every} occurrence of the item separator. For this reason the + default separator is not \cs*{item} but \cs{task} so it is unique to this + environment only. This directly leads to\ldots + \item \ldots{} a fourth difference: the \env{tasks} environment cannot be + nested. You can, however, use an \env*{itemize} environment or another + \enquote{real} list in it. + \item A fifth difference: verbatim material cannot be used in it. You'll + have to use \cs*{string}, \cs*{texttt} or \cs*{detokenize}. If this + won't suffice then don't use \env{tasks}. +% \item A sixth difference: %footnotes +\end{itemize} + +\begin{environments} + \environment{tasks}[\oarg{options}\darg{num of columns}] + List like environment where the single items are introduced with + \cs{task}. +\end{environments} +Let's see an example: +\begin{example} + % \Sample is defined to contain some sample text: + % \def\sample{This is some sample text we will use to create a somewhat + % longer text spanning a few lines.} + % \def\Sample{\sample\ \sample\par\sample} + Some text before the list. + \begin{tasks} + \task \Sample + \task \Sample + \task \Sample + \end{tasks} + And also some text after it. +\end{example} + +The environment takes the optional argument \darg{num of columns} with which +the number of columns used by the environment is specified. +\begin{example} + \begin{tasks}(2) + \task \Sample + \task \sample\ \sample + \task \sample + \task \Sample + \task \sample\par\sample + \end{tasks} +\end{example} + +\subsection{Items Spanning More Than One Column} +Sometimes it may come in handy if an item is allowed to span more than one +column. \Tasks\sinceversion{0.10} supports items using the remaining space by +adding an optional\label{optional-star} star to \cs{task}: +\begin{example} + \begin{tasks}(3) + \task \sample + \task* \sample + \task* \sample + \task \sample + \task \sample + \end{tasks} +\end{example} + +\Tasks\sinceversion{0.10} also supports items that span \emph{all} columns in +any case by adding an optional bang\label{optional-bang} to \cs{task}. +\begin{example} + \begin{tasks}(3) + \task \sample + \task! \sample + \task! \sample + \task \sample + \task \sample + \end{tasks} +\end{example} + +The optional star has itself an optional argument with parentheses where you +can specify the number of columns the item is supposed to span:\label{debug} +\begin{example} + \settasks{debug} + \begin{tasks}(4) + \task the first + \task the second + \task the third + \task the fourth + \task*(3) the fifth item is way too long for this and needs three columns + \task the sixth + \task the seventh + \task*(2) the eighth item is way too long for this and needs two columns + \task the nineth + \task the tenth + \end{tasks} +\end{example} +If there are not enough columns left (say two columns but you said +\cs{task}\sarg\Darg{3}) the argument is ignored and the maximum number of +remaining columns is used (two in case of our example). + +Both optional star and optional bang can be combined with the optional +argument for a custom label: +\begin{example} + \begin{tasks}(3) + \task \sample + \task* \sample + \task*[(x)] \sample + \task \sample + \task \sample + \end{tasks} +\end{example} + +Forcing a new item line manually is also possible\sinceversion{0.9} using the +following command: +\begin{commands} + \command{startnewitemline} + Introduce a new line in a \env{tasks} environment. +\end{commands} +\begin{example} + \begin{tasks}(4) + \task the first + \task the second + \task the third + \task the fourth + \task \rlap{the fifth item is way too long for this so we start a new row} + \startnewitemline + \task the sixth + \task the seventh + \task \rlap{the eighth item also is too long} \startnewitemline + \task the nineth + \task the tenth + \end{tasks} +\end{example} + +While this works it also needs a bit of care since the width of the items +doesn't change which means in order to use the full width you'd have to use +trickery like \cs*{rlap} which then means the danger of the item text sticking +into the margin\ldots + +\section{Available Options}\label{sec:tasks:options} + +The \Tasks{} package does not have any package options\changedversion{0.10}. + +The environment \env{tasks} has a number of options, though, namely the +following ones that can be set using a setup command: +\begin{commands} + \command{settasks}[\marg{options}] + Setup command for \Tasks. +\end{commands} +\begin{options} + \keyval{style}{instance}\Default + Choose the instance to be used. Read more on this in + section~\ref{sec:tasks}. + \keyval{counter-format}{counter specs}\Default{tsk[a])} + \sinceversion{0.9}Sets a custom label. The letters \code{tsk} are + replaced with the task-counter. An optional argument directly following + these letters specifies the counter format: \code{1}: \cs*{arabic}, + \code{a}: \cs*{alph}, \code{A}: \cs*{Alph}, \code{r}: \cs*{roman} and + \code{R}: \cs*{Roman}. + \keyval{label-format}{code}\Default + \changedversion{0.9}Can be used to apply a formatting like, \eg, + \cs*{bfseries} to the labels. + \keyval{label}{code}\Default + \changedversion{0.9}Overwrite the automatic label to a custom one. + \keyval{label-width}{dim}\Default{1em} + Sets the width of the item labels. + \keyval{label-offset}{dim}\Default{.3333em} + \sinceversion{0.7}Sets the offset, \ie, the distance between label and + item. + \keyval{item-format}{code}\Default + \sinceversion{0.11}Can be used to apply a formatting like, \eg, + \cs*{bfseries} to the items. This may be a macro accepting the item as + mandatory argument. + \keyval{item-indent}{dim}\Default{2.5em} + \sinceversion{0.9a}The indent of an item, \ie, the horizontal space + available for both label and label-offset. If + \[ + \text{\code{indent}} = + \text{\code{label-width}} + \text{\code{label-offset}} + \] + the label will align with the textblock above (if + \keyis{label-align}{left} is set). Please see figure~\ref{fig:lengths} + for a sketch of the available lengths and how they are set. + \keyval{column-sep}{dim}\Default{0pt} + \sinceversion{0.10}A horizontal length that is inserted between columns ot + items. + \keychoice{label-align}{left,right,center}\Default{left} + \sinceversion{0.7}Determines how the labels are aligned within the + label-box whose width is set with \option{label-width}. + \keyval{before-skip}{skip}\Default{0pt} + Sets the skip before the list. + \keyval{after-skip}{skip}\Default{0pt} + Sets the skip after the list. + \keyval{after-item-skip}{skip}\Default{1ex plus 1ex minus 1ex} + \sinceversion{0.9}This vertical skip is inserted between rows of items. + \keybool{resume}\Default{false} + The enumeration will resume from a previous \env{tasks} environment. In + order to use this option properly you shouldn't mix different \env{tasks} + environments that both count their items. + \keybool{debug}\Default{false} + \sinceversion{0.10}If set to true \cs*{fboxsep} is set to \code{0pt} + inside the \env{tasks} environment and \cs*{fbox} is used to draw a frame + around the label boxes and the item boxes. +\end{options} + +\begin{figure} + \centering + \begin{tikzpicture}[every node/.style={font=\footnotesize},scale=.5] + \coordinate (itemedge1) at (2,2) ; + \coordinate (itemedge2) at (13,2) ; + \draw + (itemedge1) -- ++(8,0) -- ++(0,-2) -- ++(-8,0) -- cycle ; + \draw + (itemedge1) ++(-.5,0) coordinate(labeledge1) + -- ++(-1,0) --++ (0,-1) --++(1,0) --++(0,1) ; + \draw (itemedge1) ++(-2,0) -- ++(0,-2) ; + \draw + (itemedge2) -- ++(8,0) -- ++(0,-2) -- ++(-8,0) -- cycle ; + \draw + (itemedge2) ++(-.3,0) coordinate(labeledge2) + -- ++(-1,0) --++ (0,-1) --++(1,0) --++(0,1) ; + \draw (itemedge2) ++(-2,0) -- ++(0,-2) ; + \draw[<->] (itemedge2) ++(-2,0) --node[above]{column sep} ++(-1,0) ; + \draw[<->] (0,-.5) --node[below]{item indent} (2,-.5) ; + \draw[<->] (2,-.5) --node[below]{item width} (10,-.5) ; + \draw[<->] (labeledge1) ++(0,1) --node[above]{label width} ++(-1,0) ; + \draw[<->] (labeledge1) --node[above]{item offset} ++(.5,0) ; + \end{tikzpicture} + \caption{A visual representation of the used lengths.} + \label{fig:lengths} +\end{figure} + +Now the same list as above but with three columns and a different label: +\begin{example} + \begin{tasks}[counter-format=(tsk[r]),label-width=4ex](2) + \task \Sample + \task \sample\ \sample + \task \sample + \task \Sample + \task \sample\par\sample + \end{tasks} +\end{example} +% \begin{tasks}[counter-format=(tsk[r]),label-width=4ex](3) +% \task \Sample +% \task \sample\ \sample +% \task \sample +% \task \Sample +% \task \sample\par\sample +% \end{tasks} + +Let's use it inside a question, \ie, inside \ExSheets' \env{question} +environment: +\begin{example} + % since settings are local the following ones will be lost + % outside this example; + \settasks{ + counter-format = qu.tsk , + item-indent = 2em , + label-width = 2em , + label-offset = 0pt + } + \begin{question}[type=exam]{4} + I have these two tasks for you. Shall we begin? + \begin{tasks}(2) + \task The first task: easy! + \task The second task: even more so! + \end{tasks} + \end{question} + \begin{solution}[print] + Now, let's see\ldots\ ah, yes: + \begin{tasks} + \task This is the first solution. Told you it was easy. + \task This is the second solution. And of course you knew that! + \end{tasks} + \end{solution} +\end{example} + +Finally let's see what the \option{debug} option does (you could see it +already on page~\pageref{debug}): +\begin{example} + \settasks{debug} + \begin{tasks}(2) + \task \Sample + \task \Sample + \end{tasks} +\end{example} + +\section{Available Instances}\label{sec:tasks:instances} +There are currently three additional instances for the \code{tasks} object +available: +\begin{description} + \item[itemize] uses \cs*{labelitemi} as labels. + \item[enumerate] enumerates the items with 1., 2., \ldots + \item[multiplechoice] a --~well~-- `multiple choice' list. +\end{description} +\begin{example} + \begin{tasks}[style=itemize](2) + \task that's just how\ldots + \task \ldots we expected + \end{tasks} + \begin{tasks}[style=enumerate](2) + \task that's just how\ldots + \task \ldots we expected + \end{tasks} + \begin{tasks}[style=multiplechoice](2) + \task that's just how\ldots + \task \ldots we expected + \end{tasks} +\end{example} + +\section{Custom Labels} +If you want to change a single label inside a list, you can use the optional +argument of \cs{task}. This will temporarily overwrite the default label. +\begin{example}[side-by-side] + \begin{tasks}[style=itemize] + \task a standard item + \task another one + \task[+] a different one + \task and another one + \end{tasks} +\end{example} + +\section{New Tasks} +It is possible to add custom environments that work like the \code{tasks} +environment. +\begin{commands} + \command{NewTasks}[\oarg{options}\marg{name}\oarg{separator}\darg{cols}] + Define environment \meta{name} that uses \meta{separator} to introduce a + new item. Default for \meta{separator} is \cs{task}, default for + \meta{cols} is \code{1}. The \meta{options} are the ones described in + section~\ref{sec:tasks:options}. + \command{RenewTasks}[\oarg{options}\marg{name}\oarg{separator}\darg{cols}] + Renew environment previously defined with \cs{NewTasks}. +\end{commands} +The \env{tasks} environment is defined as follows: +\begin{sourcecode} + \NewTasks{tasks} +\end{sourcecode} + +The separator does not have to be a control sequence: +\begin{example} + % preamble: + % \usepackage{dingbat} + \NewTasks[label=\footnotesize\leftthumbsup,label-width=1.3em]{done}[*] + \begin{done} + * First task + * Second task + \end{done} +\end{example} +Although this might seem handy or even nice I strongly advice against using +something different than a command sequence. Remember that the items will be +split at \emph{every} occurrence of the separator. So in order to use the +separator (here for example for a starred variant of a command) within an item +it has to be hidden in braces. This is avoided of you use a command sequence +which even doesn't have to be defined. + +Please also keep in mind that the separator still has an optional star +argument (see~\pageref{optional-star}), an optional bang argument and the +standard optional argument. Using \code{*} will prevent the optional star +argument. + +\begin{example} + % preamble: + % \usepackage{dingbat} + \NewTasks[label=\footnotesize\leftthumbsup,label-width=1.3em]{done}[*] + \begin{done}(3) + * First task + * Second task + *! Third task spanning the full width available + * Fourth task + \end{done} +\end{example} + +Let's say you want a \env*{multiplechoice} environment that has three columns +in its default state. You could do something like this: +\begin{example} + % preamble: + % \NewTasks[style=multiplechoice]{multiplechoice}[\choice](3) + % \newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} + % + % \PrintSolutionsTF and the {question} environment are provided + % by the ExSheets package + \begin{question} + \begin{multiplechoice} + \choice First choice + \choice Second choice + \choice[\correct] Third choice + \end{multiplechoice} + \end{question} + \begin{solution}[print] + \begin{multiplechoice} + \choice First choice + \choice Second choice + \choice[\correct] Third choice + \end{multiplechoice} + \end{solution} +\end{example} + +The last example shows you two additional commands: +\begin{commands} + \command{choicebox}[\quad\choicebox] + Print an empty square. + \command{checkedchoicebox}[\quad\checkedchoicebox] + Print a crossed-out square. +\end{commands} + + +\section{Styling \Tasks} +Equivalent to the styling of \ExSheets\ \Tasks\ uses \pkg{xtemplate} to +declare additional instances for the lists. + +\subsection{The \code{tasks} Object}\label{sec:tasks} +The object that's defined by \Tasks\ is the `tasks' object. This time there +are four instances available for the one template (again `default') that was +defined. + +\subsubsection{Available Options} +This section only lists the options that can be used when defining an instance +of the `default' template. The following subsections will give some examples +of their usage. + +\begin{sourcecode} + \DeclareTemplateInterface{tasks}{default}{3} + { + % option : type = default + enumerate : boolean = true , + label : tokenlist , + indent : length = 2.5em , + counter-format : tokenlist = tsk[a]) , + label-format : tokenlist , + label-width : length = 1em , + label-offset : length = .3333em , + after-item-skip : skip = 1ex plus 1ex minus 1ex + } +\end{sourcecode} + +\subsubsection{Predefined Instances} +This is rather brief this time: +\begin{sourcecode} + % ALPHABETIZE: a) b) c) + \DeclareInstance{tasks}{alphabetize}{default}{} + % available when `load-tasks=true': + % ITEMIZE: + \DeclareInstance{tasks}{itemize}{default} + { + enumerate = false , + label-width = 1.125em + } + % ENUMERATE: + \DeclareInstance{tasks}{enumerate}{default} + { counter-format = tsk. } + % MULTIPLECHOICE: + \DeclareInstance{tasks}{multiplechoice}{default} + { + enumerate = false , + label = \choicebox , + } +\end{sourcecode} + +\end{document} |