diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-03 22:19:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-03 22:19:36 +0000 |
commit | 0a4df79ff44155e39af8d3fb5ad0e7763341cc4a (patch) | |
tree | ebadf60bcb77ed3198c0eed46d8fbb300297d2a2 | |
parent | 7b948f621af5b04be4a7eaf082edf4820995322e (diff) |
tasks (3may16)
git-svn-id: svn://tug.org/texlive/trunk@40876 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/tasks/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tasks/tasks_en.pdf | bin | 458837 -> 460111 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tasks/tasks_en.tex | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tasks/tasks.cfg | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tasks/tasks.sty | 205 |
5 files changed, 113 insertions, 114 deletions
diff --git a/Master/texmf-dist/doc/latex/tasks/README b/Master/texmf-dist/doc/latex/tasks/README index fd6bf117d66..44cbc24ce37 100644 --- a/Master/texmf-dist/doc/latex/tasks/README +++ b/Master/texmf-dist/doc/latex/tasks/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the TASKS package v0.10a 2014/07/29 +the TASKS package v0.11 2016/05/03 Horizontal columned lists. @@ -8,7 +8,7 @@ Clemens Niederberger Web: https://github.com/cgnieder/tasks/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2013-2014 Clemens Niederberger +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 diff --git a/Master/texmf-dist/doc/latex/tasks/tasks_en.pdf b/Master/texmf-dist/doc/latex/tasks/tasks_en.pdf Binary files differindex 6e40a7a356d..3d917f069e5 100644 --- a/Master/texmf-dist/doc/latex/tasks/tasks_en.pdf +++ b/Master/texmf-dist/doc/latex/tasks/tasks_en.pdf diff --git a/Master/texmf-dist/doc/latex/tasks/tasks_en.tex b/Master/texmf-dist/doc/latex/tasks/tasks_en.tex index 0bee1da3306..30023ac9729 100644 --- a/Master/texmf-dist/doc/latex/tasks/tasks_en.tex +++ b/Master/texmf-dist/doc/latex/tasks/tasks_en.tex @@ -272,7 +272,7 @@ following ones that can be set using a setup command: \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 + \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}, @@ -288,12 +288,15 @@ following ones that can be set using a setup command: \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. \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}} + \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} diff --git a/Master/texmf-dist/tex/latex/tasks/tasks.cfg b/Master/texmf-dist/tex/latex/tasks/tasks.cfg index 12b3c50517c..0aa10ea09e4 100644 --- a/Master/texmf-dist/tex/latex/tasks/tasks.cfg +++ b/Master/texmf-dist/tex/latex/tasks/tasks.cfg @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/tasks/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2013-2014 Clemens Niederberger +% Copyright 2013-2015 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -27,9 +27,11 @@ % -------------------------------------------------------------------------- % further instances for the `tasks' environment \ProvidesFile{tasks.cfg} - [\@tasks@date\space v\@tasks@version\space tasks instances] - -\cs_new:Npn \tasks_config_file_loaded: {} + [% + \csname c_tasks_date_tl\endcsname\space + v\csname c_tasks_version_tl\endcsname\space + tasks instances% + ] % ITEMIZE: \DeclareInstance {tasks} {itemize} {default} @@ -49,4 +51,3 @@ label = \choicebox } -\tex_endinput:D diff --git a/Master/texmf-dist/tex/latex/tasks/tasks.sty b/Master/texmf-dist/tex/latex/tasks/tasks.sty index 0efe96b43a0..435e30dcb71 100644 --- a/Master/texmf-dist/tex/latex/tasks/tasks.sty +++ b/Master/texmf-dist/tex/latex/tasks/tasks.sty @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/tasks/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2013-2014 Clemens Niederberger +% 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 @@ -25,40 +25,19 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\def\@tasks@date{2014/07/29} -\def\@tasks@version{0.10a} - -\RequirePackage { expl3 , xparse , l3keys2e } +\RequirePackage { expl3 , xparse , epic , cntformats , xtemplate , environ } +\ExplSyntaxOn + +\tl_const:Nn \c_tasks_name_tl {tasks} +\tl_const:Nn \c_tasks_date_tl {2016/05/03} +\tl_const:Nn \c_tasks_version_tl {0.11} +\tl_const:Nn \c_tasks_info_tl {Horizontal columned lists} + \ProvidesExplPackage - {tasks} - {\@tasks@date} - {\@tasks@version} - {Horizontal columned lists.} - -% -------------------------------------------------------------------------- -% check expl3 version: -\@ifpackagelater { expl3 } { 2014/01/01 } - { } - { - \PackageError { tasks } { Support~package~expl3~too~old } - { - You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ - 'l3packages'.\MessageBreak - Loading~tasks~will~abort! - } - \tex_endinput:D - } - -% -------------------------------------------------------------------------- -% requirements: -\RequirePackage { epic , cntformats , xtemplate , environ } - -\msg_new:nnn {tasks} {deprecated-option} - { - The~ option~ `#1'~ has~ been~ removed~ from~ the~ `tasks'~ package.~ - Please~ see~ the~ documentation~ for~details. - } - + {\c_tasks_name_tl} + {\c_tasks_date_tl} + {\c_tasks_version_tl} + {\c_tasks_info_tl \c_space_tl (CN)} % -------------------------------------------------------------------------- % variants of kernel functions: @@ -97,6 +76,8 @@ \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 @@ -141,10 +122,10 @@ % 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 } } + \tl_put_right:Nn \l__tasks_body_tl {#1} + \end {#3} + \tl_if_eq:nnF {#1} {#3} + { \__tasks_collect_tasks:nww {#1} } } % #1: instance @@ -154,15 +135,15 @@ \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 } + \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 } + \UseInstance {tasks} {#1} { \g__tasks_total_items_int } - { #2 } + {#2} { \l__tasks_custom_label_pattern_tl } % just to be sure: \seq_clear:N \l__tasks_seq @@ -170,8 +151,9 @@ \cs_generate_variant:Nn \__tasks:nnnn { VnnV } % #1: label -% #2: item -\cs_new_protected:Npn \__tasks_task:nn #1#2 +% #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 @@ -182,6 +164,7 @@ { \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 { @@ -201,7 +184,7 @@ \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, - % the also step \g__tasks_current_row_num_int : + % 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 } @@ -209,15 +192,13 @@ } \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_tmpa_int - { \l__tasks_columns_int - \g__tasks_current_col_num_int + 1 } - \int_set:Nn \l__tasks_tmpb_int { \l__tasks_tmpa_int -1 } + \int_set:Nn \l__tasks_tmpb_int { \l__tasks_tmpa_int - 1 } % 8 } { - \int_set:Nn \l__tasks_tmpa_int - { \l__tasks_columns_int - \g__tasks_current_col_num_int + 1 } \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 } @@ -249,11 +230,11 @@ { \vcoffin_set:Nnn \l__tasks_tmpa_coffin { \l__tasks_item_width_dim } - { \__tasks_setup: #2 \strut } + { \__tasks_setup: #2 {#3} \strut } \__tasks_debug:n { \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin - { l } { T } { 0pt } { 0pt } + {l} {T} {0pt} {0pt} } } % set the label box: @@ -273,7 +254,7 @@ \__tasks_debug:n { \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin - { l } { T } { 0pt } { 0pt } + {l} {T} {0pt} {0pt} } } % attach the label box at the left of the item box, shifted by @@ -292,7 +273,7 @@ \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 } + {l} {T} {0pt} {0pt} \bool_if:nT { \l__tasks_item_full_line_bool || @@ -322,7 +303,7 @@ \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:nn { VV } +\cs_generate_variant:Nn \__tasks_task:nnn { VVV } \cs_new_protected:Npn \__tasks_setup: { @@ -336,26 +317,26 @@ \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_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 { - \clist_if_in:nnTF { left , center , right } { #1 } + \str_case:nnF {#1} { - \tl_if_eq:nnT { #1 } { left } + {left} { \tl_clear:N \l__tasks_item_fill_left_tl \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill } - \tl_if_eq:nnT { #1 } { right } + {right} { \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill \tl_clear:N \l__tasks_item_fill_right_tl } - \tl_if_eq:nnT { #1 } { center } + {center} { \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill @@ -367,16 +348,16 @@ } } \cs_generate_variant:Nn \__tasks_label_align:n { V } -\__tasks_label_align:n { left } +\__tasks_label_align:n {left} % -------------------------------------------------------------------------- % the `tasks' object: % #1: number of items % #2: number of columns % #3: label-format -\DeclareObjectType { tasks } { 3 } +\DeclareObjectType {tasks} {3} % the `default' template interface: -\DeclareTemplateInterface { tasks } { default } { 3 } +\DeclareTemplateInterface {tasks} {default} {3} { enumerate : boolean = true , label : tokenlist , @@ -385,6 +366,7 @@ label-format : tokenlist , label-width : length = 1em , label-offset : length = .3333em , + item-format : tokenlist , after-item-skip : skip = 1ex plus 1ex minus 1ex } @@ -395,7 +377,7 @@ \char_set_catcode_alignment:N \$ % the `default' template code: -\DeclareTemplateCode { tasks } { default } { 3 } +\DeclareTemplateCode {tasks} {default} {3} { enumerate = \l__tasks_enumerate_bool , label = \l__tasks_label_tl , @@ -404,6 +386,7 @@ 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 } { @@ -451,10 +434,10 @@ % 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 } + \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 } + \int_set:Nn \g__tasks_current_row_num_int {1} \tl_if_blank:VF \l__tasks_custom_label_pattern_tl { \tl_set_eq:NN @@ -467,6 +450,12 @@ \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 @@ -475,7 +464,7 @@ \tl_if_eq:VnT \l__tasks_tmp_label_tl { $tasks$default$label$ } { \int_gincr:N \g__tasks_int - \SaveCounterPatternFrom [ tasks ] + \SaveCounterPatternFrom [tasks] \l__tasks_tmpa_tl \l__tasks_label_tl \l__tasks_label_pattern_tl @@ -487,15 +476,18 @@ { \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:VV + \__tasks_task:VVV \l__tasks_label_tl + \l__tasks_item_format_tl \l__tasks_item_tl } { - \__tasks_task:VV + \__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 } @@ -541,7 +533,7 @@ \cs_new_protected:Npn \__tasks_read_item_aux_ii:ww [#1]#2 \q_stop { - \tl_set:Nn \l__tasks_tmp_label_tl { #1 } + \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:Nn \l__tasks_item_tl { \ignorespaces #2 } @@ -604,54 +596,59 @@ % -------------------------------------------------------------------------- % base instance: % ALPHABETIZE: a) b) c) -\DeclareInstance { tasks } { alphabetize } { default } { } +\DeclareInstance {tasks} {alphabetize} {default} { } -\keys_define:nn { tasks / list } +\keys_define:nn {tasks/list} { debug .bool_set:N = \l__tasks_debug_bool , style .tl_set:N = \l__tasks_instance_tl , 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 } , + \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 } + \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 } + \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 } + \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 } , + \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 ] +\NewEnviron {__tasks_env:} [3] { - \keys_set:nn { tasks / list } { #2 } - \tl_if_blank:VT \l__tasks_instance_tl - { \keys_set:nn { tasks / list } { style = alphabetize } } - \vspace {\l__tasks_before_list_skip} + \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 {} { - \dim_set:Nn \leftmargin { 0pt } - \dim_set:Nn \rightmargin { 0pt } + \keys_set:nn {tasks/list} { style = alphabetize , #2 } + % \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 + \__tasks:VnnV \l__tasks_instance_tl {#3} {#1} \BODY \endlist - \vspace {\l__tasks_after_list_skip} + \dim_compare:nNnF { \l__tasks_after_list_skip } = { 0pt } + { \vspace {\l__tasks_after_list_skip} } } % -------------------------------------------------------------------------- @@ -659,7 +656,11 @@ \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 } + { + \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 @@ -673,41 +674,31 @@ % the user environment: \NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} } { - \NewDocumentEnvironment { #2 } { O{}D(){#4} } - { \__tasks_env: { #3 } { #1,##1 } { ##2 } } + \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 } } + \RenewDocumentEnvironment {#2} { O{}D(){#4} } + { \__tasks_env: {#3} { #1,##1 } {##2} } { \end__tasks_env: } } % -------------------------------------------------------------------------- % default list: -\NewTasks { tasks } - -% -------------------------------------------------------------------------- -% package options: -\keys_define:nn { tasks / options } - { - more .code:n = \msg_warning:nnn {tasks} {deprecated-option} {more} - } - -\ProcessKeysOptions { tasks / options } +\NewTasks {tasks} -\cs_if_exist:NF \tasks_config_file_loaded: - { \file_input:n { tasks.cfg } } +\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 } } + { \keys_set:nn {tasks/list} {#1} } \NewDocumentCommand \settasks { m } - { \tasks_setup:n { #1 } } + { \tasks_setup:n {#1} } % -------------------------------------------------------------------------- \tex_endinput:D @@ -755,3 +746,7 @@ - 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 |