diff options
author | Norbert Preining <norbert@preining.info> | 2020-08-20 03:01:54 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-08-20 03:01:54 +0000 |
commit | e2dfc4cc8dc03d323073de46903005e3a9d12255 (patch) | |
tree | 283bcf119eff28b9f992e1005d38353626efcd2e /macros/latex/contrib/tasks | |
parent | 75955a0dece2b1996d51d4f43ad5778cd6d5b4cc (diff) |
CTAN sync 202008200301
Diffstat (limited to 'macros/latex/contrib/tasks')
-rw-r--r-- | macros/latex/contrib/tasks/README | 2 | ||||
-rw-r--r-- | macros/latex/contrib/tasks/tasks-manual.pdf | bin | 464450 -> 477367 bytes | |||
-rw-r--r-- | macros/latex/contrib/tasks/tasks-manual.tex | 40 | ||||
-rw-r--r-- | macros/latex/contrib/tasks/tasks.sty | 45 |
4 files changed, 68 insertions, 19 deletions
diff --git a/macros/latex/contrib/tasks/README b/macros/latex/contrib/tasks/README index d597763e70..487fd31097 100644 --- a/macros/latex/contrib/tasks/README +++ b/macros/latex/contrib/tasks/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the TASKS package v1.2b 2020/05/11 +the TASKS package v1.3 2020/08/19 lists with columns filled horizontally diff --git a/macros/latex/contrib/tasks/tasks-manual.pdf b/macros/latex/contrib/tasks/tasks-manual.pdf Binary files differindex 708bc9b981..b941305e24 100644 --- a/macros/latex/contrib/tasks/tasks-manual.pdf +++ b/macros/latex/contrib/tasks/tasks-manual.pdf diff --git a/macros/latex/contrib/tasks/tasks-manual.tex b/macros/latex/contrib/tasks/tasks-manual.tex index 2bcfb18d3e..b1f5ac54c8 100644 --- a/macros/latex/contrib/tasks/tasks-manual.tex +++ b/macros/latex/contrib/tasks/tasks-manual.tex @@ -11,12 +11,12 @@ % Copyright 2013--2020 Clemens Niederberger % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% conditions of the LaTeX Project Public License, either version 1.3c % 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. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. % % This work has the LPPL maintenance status `maintained'. % @@ -235,6 +235,10 @@ following ones that can be set using a setup command: \changedversion{1.0}Sets a custom label. The \code{*} is replaced by \Marg{task}. This is heavily inspired by \pkg{enumitem}'s~\cite{pkg:enumitem} \code{label} option. + \keyval{ref}{code}\Default + \sinceversion{1.3}Works like \option{label} but sets the output of the + reference by setting \cs*{the\meta{counter}} (\cs{thetask} in the default + setting). \keyval{label-width}{dim}\Default{1em} Sets the width of the item labels. \keyval{label-offset}{dim}\Default{.3333em} @@ -391,12 +395,38 @@ argument of \cs{task}. This will temporarily overwrite the default label. \end{tasks} \end{example} +You've already seen examples for the \option{label} option. +\begin{options} + \keyval{label}{code}\Default{\cs*{alph}\code{*)}} + It can be used to set the label for a list. A \code{*} inside is always + replaced by the current counter name inside braces. It can contain + formatting instructions like \cs*{bfseries} but it can be cleaner to use + \keyval{label-format}{code}\Default + instead. This is especially true since the \option{label} also sets + \cs*{the\meta{counter}} where you usually don't want to have formatting + instructions. Another way to deal with this issue is the option + \keyval{ref}{code}\Default + which sets \cs*{the\meta{counter}} (\cs{thetask} in the default setting). +\end{options} + +\begin{example}[side-by-side] + \begin{tasks}[label=\arabic*.,ref=\arabic*] + \task first item + \task second item \label{foo} + \end{tasks} + See item~\ref{foo} without dot. +\end{example} + +Two additional commands are defined which in some circumstances might prove +useful: \begin{commands} \command{tasksifmeasuringTF}[\marg{true}\marg{false}] \sinceversion{1.2}This command used inside a label checks if the label is typeset for measuring its width or if it is typeset \enquote{for - real}. Might be useful sometimes. There are also the variants - \cs{tasksifmeasuringT} and \cs{tasksifmeasuringF}. + real}. There are also the variants \cs{tasksifmeasuringT} and + \cs{tasksifmeasuringF}. + \command{tasklabel} + \sinceversion{1.3}Holds the current label text. \end{commands} \section{New \code{tasks}-like Environments} diff --git a/macros/latex/contrib/tasks/tasks.sty b/macros/latex/contrib/tasks/tasks.sty index 22ac99035b..42afb7320e 100644 --- a/macros/latex/contrib/tasks/tasks.sty +++ b/macros/latex/contrib/tasks/tasks.sty @@ -11,12 +11,12 @@ % Copyright 2013--2020 Clemens Niederberger % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% conditions of the LaTeX Project Public License, either version 1.3c % 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. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. % % This work has the LPPL maintenance status `maintained'. % @@ -28,10 +28,10 @@ \RequirePackage {expl3,xparse,xtemplate} \ExplSyntaxOn -\tl_const:Nn \c_tasks_date_tl {2020/05/11} +\tl_const:Nn \c_tasks_date_tl {2020/08/19} \tl_const:Nn \c_tasks_version_major_number_tl {1} -\tl_const:Nn \c_tasks_version_minor_number_tl {2} -\tl_const:Nn \c_tasks_version_subrelease_tl {b} +\tl_const:Nn \c_tasks_version_minor_number_tl {3} +\tl_const:Nn \c_tasks_version_subrelease_tl {} \tl_const:Nx \c_tasks_version_number_tl { \c_tasks_version_major_number_tl . @@ -59,7 +59,7 @@ \cs_generate_variant:Nn \tl_set:Nn {cV} \cs_generate_variant:Nn \hbox_set:Nn {NV} \cs_generate_variant:Nn \msg_warning:nnnn {nnV,nnnx} -\cs_generate_variant:Nn \tl_replace_once:Nnn {Nne} +\cs_generate_variant:Nn \tl_replace_all:Nnn {Nne} % -------------------------------------------------------------------------- \msg_new:nnn {tasks} {width-too-small} @@ -111,6 +111,7 @@ \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_ref_bool \bool_new:N \l__tasks_custom_label_format_bool \bool_new:N \l__tasks_custom_after_item_skip_bool \bool_new:N \l__tasks_debug_bool @@ -121,6 +122,8 @@ \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_ref_tl +\tl_new:N \l__tasks_custom_ref_tl \tl_new:N \l__tasks_label_format_tl \tl_new:N \l__tasks_custom_label_format_tl \tl_new:N \l__tasks_counter_tl @@ -442,6 +445,7 @@ \DeclareTemplateInterface {tasks} {default} {3} { label : tokenlist = \alph*) , + ref : tokenlist , indent : length = 2.5em , label-format : tokenlist , label-width : length = 11pt , @@ -460,6 +464,7 @@ \DeclareTemplateCode {tasks} {default} {3} { label = \l__tasks_label_tl , + ref = \l__tasks_label_ref_tl , indent = \l__tasks_item_default_indent_dim , label-format = \l__tasks_label_format_tl , label-width = \l__tasks_label_default_width_dim , @@ -524,15 +529,23 @@ { \tl_to_str:V \l__tasks_custom_label_tl } { \tl_to_str:V \l__tasks_label_tl } } - \bool_set_false:N \l__tasks_tmpa_bool - \tl_if_in:NnT \l__tasks_tmpa_tl {*} + \tl_set:Nx \l__tasks_tmpb_tl { - \tl_replace_once:Nne \l__tasks_tmpa_tl {*} {{ \l__tasks_counter_tl }} - \bool_set_true:N \l__tasks_tmpa_bool + \bool_if:NTF \l__tasks_custom_ref_bool + { \tl_to_str:V \l__tasks_custom_ref_tl } + { \tl_to_str:V \l__tasks_ref_tl } } + % replace the stars: + \tl_replace_all:Nne \l__tasks_tmpa_tl {*} {{ \l__tasks_counter_tl }} \tl_set_rescan:NnV \l__tasks_tmpa_tl {} \l__tasks_tmpa_tl - \bool_if:NT \l__tasks_tmpa_bool - { \tl_set:cV { the \l__tasks_counter_tl } \l__tasks_tmpa_tl } + \tl_if_blank:VTF \l__tasks_tmpb_tl + { \tl_set_eq:NN \l__tasks_tmpb_tl \l__tasks_tmpa_tl } + { + \tl_replace_all:Nne \l__tasks_tmpb_tl {*} {{ \l__tasks_counter_tl }} + \tl_set_rescan:NnV \l__tasks_tmpb_tl {} \l__tasks_tmpb_tl + } + % update \thecounter: + \tl_set:cV { the \l__tasks_counter_tl } \l__tasks_tmpb_tl \dim_compare:nNnT { \l__tasks_item_indent_dim } < @@ -547,8 +560,10 @@ \seq_map_inline:Nn \l__tasks_seq { \__tasks_read_item:www ##1 \q_stop + % TODO \refstepcounter { \l__tasks_counter_tl } \tl_set:Nx \l__tasks_label_tl { { \exp_not:V \l__tasks_tmpa_tl } } + \tl_set:cV {tasklabel} \l__tasks_label_tl \bool_if:NTF \l__tasks_custom_label_format_bool { \tl_put_left:NV \l__tasks_label_tl \l__tasks_custom_label_format_tl } { \tl_put_left:NV \l__tasks_label_tl \l__tasks_label_format_tl } @@ -649,6 +664,9 @@ label .code:n = \bool_set_true:N \l__tasks_custom_label_bool \tl_set:Nn \l__tasks_custom_label_tl {#1} , + ref .code:n = + \bool_set_true:N \l__tasks_custom_ref_bool + \tl_set:Nn \l__tasks_custom_ref_tl {#1} , label-format .code:n = \bool_set_true:N \l__tasks_custom_label_format_bool \tl_set:Nn \l__tasks_custom_label_format_tl {#1} , @@ -864,3 +882,4 @@ - rename manual files 2020/04/19 v1.2a - only use arabic numbers for \theHtask 2020/05/11 v1.2b - options are set to late for `before-skip' -- fixed +2020/05/11 v1.3 - add `ref' option |