summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-10-05 20:50:33 +0000
committerKarl Berry <karl@freefriends.org>2019-10-05 20:50:33 +0000
commit71c5385b16afce7e5659929bd66ed077e203a8e7 (patch)
treebe5c690e18eb8f7ae8630f0dd1eff4a8c55c5bde
parent381c8fa423c49ec2229d11d4c3d2f005d1756787 (diff)
tasks (5oct19)
git-svn-id: svn://tug.org/texlive/trunk@52297 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/tasks/README6
-rw-r--r--Master/texmf-dist/doc/latex/tasks/tasks_en.pdfbin459628 -> 448511 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tasks/tasks_en.tex176
-rw-r--r--Master/texmf-dist/tex/latex/tasks/tasks.cfg32
-rw-r--r--Master/texmf-dist/tex/latex/tasks/tasks.sty507
5 files changed, 334 insertions, 387 deletions
diff --git a/Master/texmf-dist/doc/latex/tasks/README b/Master/texmf-dist/doc/latex/tasks/README
index 48d949ffac7..190287819ca 100644
--- a/Master/texmf-dist/doc/latex/tasks/README
+++ b/Master/texmf-dist/doc/latex/tasks/README
@@ -1,14 +1,14 @@
--------------------------------------------------------------------------
-the TASKS package v0.12 2016/08/13
+the TASKS package v1.0 2019/10/04
- Horizontal columned lists.
+ horizontally columned lists
--------------------------------------------------------------------------
Clemens Niederberger
Web: https://github.com/cgnieder/tasks/
E-Mail: contact@mychemistry.eu
--------------------------------------------------------------------------
-Copyright 2013-2016 Clemens Niederberger
+Copyright 2013--2019 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
index 0e7f51af91f..fb9d209ea2e 100644
--- a/Master/texmf-dist/doc/latex/tasks/tasks_en.pdf
+++ b/Master/texmf-dist/doc/latex/tasks/tasks_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/tasks/tasks_en.tex b/Master/texmf-dist/doc/latex/tasks/tasks_en.tex
index 35b56f74a26..25f5353eeed 100644
--- a/Master/texmf-dist/doc/latex/tasks/tasks_en.tex
+++ b/Master/texmf-dist/doc/latex/tasks/tasks_en.tex
@@ -1,14 +1,14 @@
% --------------------------------------------------------------------------
% the TASKS package
%
-% Horizontal columned lists.
+% horizontally columned lists
%
% --------------------------------------------------------------------------
% Clemens Niederberger
% Web: https://github.com/cgnieder/tasks/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
-% Copyright 2013-2014 Clemens Niederberger
+% Copyright 2013--2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -33,31 +33,23 @@
authors = Clemens Niederberger ,
email = {contact@mychemistry.eu} ,
url = {https://github.com/cgnieder/tasks/} ,
- info = {create horizontal columned lists} ,
+ info = {horizontally columned lists} ,
add-cmds = {
- checkedchoicebox ,
- choicebox,
- NewTasks,
+ NewTasksEnvironment,
+ RenewTasksEnvironment,
settasks,
startnewitemline ,
task
} ,
add-silent-cmds = {
- choice, correct,
DeclareInstance, DeclareTemplateInterface,
leftthumbsup,
- sample, Sample
+ sample, Sample , theexercise
}
}
-\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\xsim{xsim}
\newpackagename\Tasks{tasks}
% ----------------------------------------------------------------------------
@@ -75,15 +67,10 @@
\usepackage{filecontents}
\usepackage{csquotes}
-
-
% ----------------------------------------------------------------------------
% example definitions that have to be done in the preamble:
-\usepackage{exsheets}
+\usepackage{xsim}
\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.}
@@ -91,7 +78,8 @@
\begin{document}
-\section{Motivation}
+\section{Preface}
+\subsection{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
@@ -109,15 +97,24 @@ 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.
+\subsection{Changes}
+The step to version~1.0 brought some significant changes:
+\begin{itemize}
+ \item the option \option{counter-format} is deprecated. Labels can now be
+ set quite similar to the way they are set in \pkg{enumitem}. This also
+ made the \code{emuerate} option of the list template superfluous which has
+ been removed accordingly.
+ \item The commands \cs{NewTasks} and \cs{RenewTasks} have ben renamed.
+ \item The multiple choice lists have been removed.
+ \item Custom definitions can be put in a \code{tasks.cfg} file which is
+ automatically loaded if available.
+\end{itemize}
+
\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}.
-
+\needpackage{xparse} and \pkg{xtemplate}.
\section{How it works}
\subsection{The Basics}
@@ -272,17 +269,13 @@ 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{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}{code}\Default{\cs*{alph}\code{*)}}
+ \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{label-width}{dim}\Default{1em}
Sets the width of the item labels.
\keyval{label-offset}{dim}\Default{.3333em}
@@ -353,7 +346,7 @@ following ones that can be set using a setup command:
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)
+ \begin{tasks}[label=(\roman*),label-width=4ex](2)
\task \Sample
\task \sample\ \sample
\task \sample
@@ -361,32 +354,25 @@ Now the same list as above but with three columns and a different label:
\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}
+
+Let's use it inside a question, \ie, inside \xsim's \env{exercise}
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
+ label = \theexercise.\arabic* ,
+ item-indent = 2em ,
+ label-width = 2em ,
+ label-offset = 0pt
}
- \begin{question}[type=exam]{4}
+ \begin{exercise}
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}
+ \end{exercise}
\begin{solution}[print]
Now, let's see\ldots\ ah, yes:
\begin{tasks}
@@ -412,7 +398,7 @@ 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.
+ % \item[multiplechoice] a --~well~-- `multiple choice' list.
\end{description}
\begin{example}
\begin{tasks}[style=itemize](2)
@@ -423,11 +409,11 @@ available:
\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}
+ % \begin{tasks}[style=multiplechoice](2)
+ % \task that's just how\ldots
+ % \task \ldots we expected
+ % \end{tasks}
\section{Custom Labels}
If you want to change a single label inside a list, you can use the optional
@@ -441,28 +427,28 @@ argument of \cs{task}. This will temporarily overwrite the default label.
\end{tasks}
\end{example}
-\section{New Tasks}
+\section{New \code{tasks}-like Environments}
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}]
+ \command{NewTasksEnvironment}[\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}.
+ \command{RenewTasksEnvironment}[\oarg{options}\marg{name}\oarg{separator}\darg{cols}]
+ Renew environment previously defined with \cs{NewTasksEnvironment}.
\end{commands}
The \env{tasks} environment is defined as follows:
\begin{sourcecode}
- \NewTasks{tasks}
+ \NewTasksEnvironment{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}[*]
+ \NewTasksEnvironment[label=\footnotesize\leftthumbsup,label-width=15pt]{done}[*]
\begin{done}
* First task
* Second task
@@ -483,7 +469,7 @@ argument.
\begin{example}
% preamble:
% \usepackage{dingbat}
- \NewTasks[label=\footnotesize\leftthumbsup,label-width=1.3em]{done}[*]
+ \NewTasksEnvironment[label=\footnotesize\leftthumbsup,label-width=15pt]{done}[*]
\begin{done}(3)
* First task
* Second task
@@ -492,43 +478,8 @@ argument.
\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.
+\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
@@ -544,10 +495,8 @@ of their usage.
\DeclareTemplateInterface{tasks}{default}{3}
{
% option : type = default
- enumerate : boolean = true ,
- label : tokenlist ,
+ label : tokenlist = \alph*) ,
indent : length = 2.5em ,
- counter-format : tokenlist = tsk[a]) ,
label-format : tokenlist ,
label-width : length = 1em ,
label-offset : length = .3333em ,
@@ -558,24 +507,17 @@ of their usage.
\subsubsection{Predefined Instances}
This is rather brief this time:
\begin{sourcecode}
- % ALPHABETIZE: a) b) c)
+ % 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}
+ % itemize
+ \DeclareInstance {tasks} {itemize} {default}
{
- enumerate = false ,
- label = \choicebox ,
+ label-width = 1.125em ,
+ label = \labelitemi
}
+ % enumerate:
+ \DeclareInstance {tasks} {enumerate} {default}
+ { label = \arabic*. }
\end{sourcecode}
\end{document}
diff --git a/Master/texmf-dist/tex/latex/tasks/tasks.cfg b/Master/texmf-dist/tex/latex/tasks/tasks.cfg
index 7a62d42383f..d76ad264cdf 100644
--- a/Master/texmf-dist/tex/latex/tasks/tasks.cfg
+++ b/Master/texmf-dist/tex/latex/tasks/tasks.cfg
@@ -1,14 +1,14 @@
% --------------------------------------------------------------------------
% the TASKS package
%
-% Horizontal columned lists.
+% horizontally columned lists
%
% --------------------------------------------------------------------------
% Clemens Niederberger
% Web: https://github.com/cgnieder/tasks/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
-% Copyright 2013-2016 Clemens Niederberger
+% Copyright 2013--2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,29 +25,5 @@
% 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
- }
-
+%
+% fill this file with your custom definitions:
diff --git a/Master/texmf-dist/tex/latex/tasks/tasks.sty b/Master/texmf-dist/tex/latex/tasks/tasks.sty
index 81e265ed5ef..26260ba6a26 100644
--- a/Master/texmf-dist/tex/latex/tasks/tasks.sty
+++ b/Master/texmf-dist/tex/latex/tasks/tasks.sty
@@ -1,14 +1,14 @@
% --------------------------------------------------------------------------
% the TASKS package
%
-% Horizontal columned lists.
+% horizontally columned lists
%
% --------------------------------------------------------------------------
% Clemens Niederberger
% Web: https://github.com/cgnieder/tasks/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
-% Copyright 2013-2016 Clemens Niederberger
+% Copyright 2013--2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,45 +25,89 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-\RequirePackage { expl3 , xparse , epic , cntformats , xtemplate , environ }
+\RequirePackage {expl3,xparse,xtemplate}
\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}
-
+\tl_const:Nn \c_tasks_date_tl {2019/10/04}
+\tl_const:Nn \c_tasks_version_major_number_tl {1}
+\tl_const:Nn \c_tasks_version_minor_number_tl {0}
+\tl_const:Nn \c_tasks_version_subrelease_tl {}
+\tl_const:Nx \c_tasks_version_number_tl
+ {
+ \c_tasks_version_major_number_tl .
+ \c_tasks_version_minor_number_tl
+ }
+\tl_const:Nx \c_tasks_version_tl
+ {
+ \c_tasks_version_number_tl
+ \c_tasks_version_subrelease_tl
+ }
+\tl_const:Nn \c_tasks_info_tl {horizontally ~ columned ~ lists}
+
\ProvidesExplPackage
- {\c_tasks_name_tl}
+ {tasks}
{\c_tasks_date_tl}
{\c_tasks_version_tl}
- {\c_tasks_info_tl \c_space_tl (CN)}
+ {\c_tasks_info_tl}
% --------------------------------------------------------------------------
% variants of kernel functions:
-\cs_generate_variant:Nn \tl_if_eq:nnTF { V }
-\cs_generate_variant:Nn \tl_if_eq:nnT { V }
+\cs_generate_variant:Nn \tl_if_eq:nnTF {V}
+\cs_generate_variant:Nn \tl_if_eq:nnT {V}
+\cs_generate_variant:Nn \coffin_attach:NnnNnnnn {NnnNx}
+\cs_generate_variant:Nn \tl_set_rescan:Nnn {NnV}
+\cs_generate_variant:Nn \hbox_set:Nn {NV}
+\cs_generate_variant:Nn \msg_warning:nnnn {nnV,nnnx}
+
+% --------------------------------------------------------------------------
+\msg_new:nnn {tasks} {width-too-small}
+ {
+ The~ width~ off~ `#1'~ is~ too~ small~ \msg_line_context: .~
+ Please~ set~ it~ at~ least~ to~ #2.
+ }
+
+\msg_new:nnn {tasks} {no-item}
+ {
+ You've~ placed~ `#1'~ before~ the~ first~ #2~ \msg_line_context: .~
+ I~ will~ through~ it~ away~ and~ ignore~ it~ for~ the~ rest~ of~ the~
+ list.
+ }
+
+\msg_new:nnn {tasks} {deprecated}
+ {
+ You've~ tried~ setting~ #1~ `#2'~ \msg_line_context: .~ However,~
+ #1~ `#2'~ is~ deprecated.~
+ \tl_if_blank:nF {#2} {Please~ use~ #1~ `#3'~ instead.~}
+ Refer~ to~ the~ manual~ for~ details.
+ }
+
+% --------------------------------------------------------------------------
+\cs_new_protected:Npn \tasks_deprecated:NN #1#2
+ {
+ \cs_undefine:N #1
+ \cs_new:Npn #1
+ { \msg_warning:nnnnn {tasks} {deprecated} {command} {#1} {#2} #2 }
+ }
% --------------------------------------------------------------------------
% 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_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
+\int_new:N \g__tasks_env_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_label_format_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
@@ -72,8 +116,6 @@
\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
@@ -81,7 +123,6 @@
\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
@@ -93,6 +134,9 @@
\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
+\dim_new:N \l__tasks_correction_dim
+
+\dim_new:N \l__tasks_full_width_dim
\skip_new:N \l__tasks_after_item_skip
\skip_new:N \l__tasks_custom_after_item_skip
@@ -102,14 +146,14 @@
\coffin_new:N \l__tasks_item_coffin
\coffin_new:N \l__tasks_label_coffin
-\NewCounterPattern* [ tasks ] { task } { tsk }
-\ReadCounterFrom [ tasks ] { task } \g__tasks_int
+\newcounter {task}
% 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
+\box_new:N \l__tasks_tmpa_box
\cs_new:Npn \__tasks_debug:n #1
{
@@ -119,36 +163,28 @@
}
% --------------------------------------------------------------------------
-% 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
+\cs_new_protected:Npn \tasks_environment: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 }
+ \tl_if_blank:VF \l__tasks_tmpa_tl
+ { \msg_warning:nnVn {tasks}{no-item} \l__tasks_tmpa_tl {#3} }
\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 }
+\cs_generate_variant:Nn \tasks_environment:nnnn {V}
% #1: label
% #2: item format
@@ -169,17 +205,31 @@
\dim_set:Nn \l__tasks_item_width_dim
{
\bool_if:NTF \l__tasks_item_full_line_bool
- { \linewidth }
+ { \l__tasks_full_width_dim }
{
(
- \linewidth
+ \l__tasks_full_width_dim
- \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
+ - \l__tasks_item_indent_dim
\bool_if:NT \l__tasks_debug_bool { -2\fboxrule }
}
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \l__tasks_columns_int \l__tasks_item_width_dim
+ + \l__tasks_columns_int \l__tasks_column_sep_dim
+ - \l__tasks_column_sep_dim
+ + \l__tasks_columns_int \l__tasks_item_indent_dim
+ \bool_if:NT \l__tasks_debug_bool { +\l__tasks_columns_int\fboxrule }
+ \bool_if:NT \l__tasks_debug_bool { +\l__tasks_columns_int\fboxrule }
+ }
+ \dim_compare:nNnT
+ { \l_tmpa_dim }
+ >
+ { \l__tasks_full_width_dim }
+ { \dim_sub:Nn \l__tasks_item_width_dim { \l__tasks_correction_dim } }
\__tasks_gset_rows_num:NN
\g__tasks_total_items_int
\l__tasks_columns_int
@@ -188,17 +238,17 @@
\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
+ \int_gset:Nn \g__tasks_current_col_num_int {1}
+ \int_gincr:N \g__tasks_current_row_num_int
}
+ % if the next item fills rest of line:
\bool_if:NT \l__tasks_item_rest_of_line_bool
{
+ % number of remaining columns:
\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
- }
+ % check requested column number and adjust:
+ \int_compare:nNnF { \l__tasks_item_columns_int } = {0}
{
\int_compare:nNnTF
{ \l__tasks_tmpa_int } > { \l__tasks_item_columns_int }
@@ -207,16 +257,16 @@
\bool_if:nT
{
\l__tasks_item_rest_of_line_bool &&
- !\int_compare_p:nNn { \l__tasks_item_columns_int} = { 0 }
+ !\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 }
+ { \l__tasks_item_columns_int -1 }
\int_gadd:Nn \g__tasks_total_items_int
- { \l__tasks_item_columns_int -1 }
+ { \l__tasks_item_columns_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 }
\dim_set:Nn \l__tasks_item_width_dim
{
\l__tasks_tmpa_int \l__tasks_item_width_dim
@@ -231,7 +281,7 @@
{
\vcoffin_set:Nnn \l__tasks_tmpa_coffin
{ \l__tasks_item_width_dim }
- { \__tasks_setup: #2 {#3} \strut }
+ { \__tasks_setup: #2 {#3} \mode_if_horizontal:T { \strut } }
\__tasks_debug:n
{
\coffin_typeset:Nnnnn \l__tasks_tmpa_coffin
@@ -243,14 +293,15 @@
{
\vcoffin_set:Nnn \l__tasks_tmpa_coffin
{
- \l__tasks_label_width_dim
- \bool_if:NT \l__tasks_debug_bool {-2\fboxrule }
+ \dim_abs:n { \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
+ \l__tasks_item_fill_left_tl
+ #1
+ \l__tasks_item_fill_right_tl
+ \strut
}
\__tasks_debug:n
{
@@ -260,19 +311,26 @@
}
% 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_label_width_dim } < {0pt}
{
- \dim_compare:nNnTF
- { \l__tasks_item_indent_dim }
- <
- { \l__tasks_label_offset_dim + \l__tasks_label_width_dim }
+ \coffin_attach:NnnNnnnn
+ \l__tasks_item_coffin {l} {T}
+ \l__tasks_label_coffin {r} {T}
+ { - \l__tasks_label_offset_dim }
+ {0pt}
+ }
+ {
+ \coffin_attach:NnnNnnnn
+ \l__tasks_item_coffin {l} {T}
+ \l__tasks_label_coffin {l} {T}
+ {
+ - \l__tasks_label_offset_dim - \l__tasks_label_width_dim
+ \bool_if:NT \l__tasks_debug_bool {-2\fboxrule }
+ }
{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 }
+ \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
@@ -288,11 +346,11 @@
\l__tasks_item_full_line_bool ||
(
\l__tasks_item_rest_of_line_bool &&
- \int_compare_p:nNn { \l__tasks_item_columns_int } = { 0 }
+ \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 :
+ % are we between items in a row? Then 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 }
@@ -302,7 +360,7 @@
{
( \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 } )
+ ( \int_compare_p:n { \g__tasks_current_row_num_int != \g__tasks_rows_int } )
}
{ \skip_vertical:N \l__tasks_after_item_skip }
% clean up:
@@ -312,35 +370,23 @@
\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_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: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 }
+ \int_gset:Nn \g__tasks_rows_int { \int_div_truncate:nn {#1} {#2} }
+ \int_compare:nNnT { \int_mod:nn {#1} {#2} } > {0}
+ { \int_gincr:N \g__tasks_rows_int }
}
\cs_new_protected:Npn \__tasks_label_align:n #1
@@ -349,28 +395,27 @@
{
{left}
{
- \tl_clear:N \l__tasks_item_fill_left_tl
- \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill
+ \tl_clear:N \l__tasks_item_fill_left_tl
+ \tl_set: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
+ \tl_set: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_set:Nn \l__tasks_item_fill_left_tl {\hfill}
+ \tl_set: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
+ \tl_clear:N \l__tasks_item_fill_left_tl
+ \tl_set:Nn \l__tasks_item_fill_right_tl {\hfill}
}
}
-\cs_generate_variant:Nn \__tasks_label_align:n { V }
-\__tasks_label_align:n {left}
-
+\cs_generate_variant:Nn \__tasks_label_align:n {V}
+
% --------------------------------------------------------------------------
% the `tasks' object:
% #1: number of items
@@ -380,15 +425,13 @@
% the `default' template interface:
\DeclareTemplateInterface {tasks} {default} {3}
{
- enumerate : boolean = true ,
- label : tokenlist ,
- indent : length = 2.5em ,
- counter-format : tokenlist = tsk[a]) ,
+ label : tokenlist = \alph*) ,
+ indent : length = 2.5em ,
label-format : tokenlist ,
- label-width : length = 1em ,
- label-offset : length = .3333em ,
+ label-width : length = 11pt ,
+ label-offset : length = .3333em ,
item-format : tokenlist ,
- after-item-skip : skip = 1ex plus 1ex minus 1ex
+ after-item-skip : skip = 1ex plus 1ex minus 1ex
}
% in the next three commands we want a really unlikely to occur marker; for
@@ -400,10 +443,8 @@
% 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 ,
@@ -430,41 +471,20 @@
\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 }
+ \bool_if:NF \l__tasks_resume_bool
+ { \setcounter {task} {0} }
\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
- }
+ \int_gset:Nn \g__tasks_current_row_num_int {1}
\tl_if_blank:VF \l__tasks_custom_label_format_tl
{
\tl_set_eq:NN
@@ -477,27 +497,46 @@
\l__tasks_item_format_tl
\l__tasks_custom_item_format_tl
}
+ % prepare counter according to given format:
+ \tl_set:Nx \l__tasks_tmpa_tl
+ {
+ \bool_if:NTF \l__tasks_custom_label_bool
+ { \tl_to_str:V \l__tasks_custom_label_tl }
+ { \tl_to_str:V \l__tasks_label_tl }
+ }
+ \tl_replace_once:Nnn \l__tasks_tmpa_tl {*} {{task}}
+ \tl_set_rescan:NnV \l__tasks_tmpa_tl {} \l__tasks_tmpa_tl
+ \dim_compare:nNnT
+ { \l__tasks_item_indent_dim }
+ <
+ { \l__tasks_label_offset_dim + \l__tasks_label_width_dim }
+ {
+ \msg_warning:nnnx {tasks}
+ {width-too-small}
+ {item-indent}
+ { \dim_to_decimal:n { \l__tasks_label_offset_dim + \l__tasks_label_width_dim } }
+ }
+ % do the tasks:
\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 }
- }
- }
+ \refstepcounter {task}
+ \tl_set:NV \l__tasks_label_tl \l__tasks_tmpa_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 }
+ % check if the label width is big enough:
+ \hbox_set:NV \l__tasks_tmpa_box \l__tasks_label_tl
+ \dim_compare:nNnF
+ { \box_wd:N \l__tasks_tmpa_box }
+ <
+ { \l__tasks_label_width_dim }
{
- \tl_if_blank:VT \l__tasks_label_tl
- { \tl_set_eq:NN \l__tasks_label_tl \labelitemi }
+ \msg_warning:nnnx {tasks}
+ {width-too-small}
+ {label-width}
+ { \dim_to_decimal:n { \box_wd:N \l__tasks_tmpa_box } }
}
- \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
@@ -517,13 +556,13 @@
\cs_new_protected:Npn \__tasks_read_item:www
{
- \peek_meaning_remove:NTF !
+ \peek_charcode_remove:NTF !
{
\bool_set_true:N \l__tasks_item_full_line_bool
\__tasks_read_item_aux:ww
}
{
- \peek_meaning_remove:NTF *
+ \peek_charcode_remove:NTF *
{
\bool_set_true:N \l__tasks_item_rest_of_line_bool
\__tasks_read_item_rest_of_line:ww
@@ -555,7 +594,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_if_eq:nnF { #1 } { $tasks$default$label$ }
+ \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} }
}
@@ -563,100 +602,56 @@
\__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 =
+ debug .bool_set:N = \l__tasks_debug_bool ,
+ break-correction .dim_set:N = \l__tasks_correction_dim ,
+ break-correction .initial:n = .00001pt ,
+ style .tl_set:N = \l__tasks_instance_tl ,
+ style .initial:n = alphabetize ,
+ counter-format .code:n =
+ \msg_warning:nnnn {tasks} {deprecated} {option} {counter-format} {label}
+ \keys_set:nn {tasks/list} { label = #1 } ,
+ 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 =
+ label-format .code:n =
+ \bool_set_true:N \l__tasks_custom_label_format_bool
+ \tl_set:Nn \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 =
+ 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 =
+ 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 ,
+ 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
+ resume .bool_set:N = \l__tasks_resume_bool
}
% --------------------------------------------------------------------------
-% the generic environment:
-\NewEnviron {__tasks_env:} [3]
+
+\cs_new_protected:Npn \tasks_body:nnnn #1#2#3#4
{
- \if@inlabel
- \noindent\par\nobreak\vskip-\parskip\vskip-\baselineskip\hrule\@height\z@
- \fi
- \dim_compare:nNnF { \l__tasks_before_list_skip } = { 0pt }
+ \int_gincr:N \g__tasks_env_int
+ \legacy_if:nT {@inlabel}
+ {
+ \noindent\par
+ \nobreak
+ \vskip-\parskip
+ \vskip-\baselineskip
+ \hrule\@height\z@
+ }
+ \dim_compare:nNnF { \l__tasks_before_list_skip } = {0pt}
{ \vspace {\l__tasks_before_list_skip} }
\list {}
{
@@ -664,11 +659,11 @@
\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
+ \item \scan_stop:
+ \dim_set:Nn \l__tasks_full_width_dim { \linewidth }
+ \tasks_environment:Vnnn \l__tasks_instance_tl {#3} {#1} {#4}
\endlist
- \dim_compare:nNnF { \l__tasks_after_list_skip } = { 0pt }
+ \dim_compare:nNnF { \l__tasks_after_list_skip } = {0pt}
{ \vspace {\l__tasks_after_list_skip} }
}
@@ -693,25 +688,41 @@
% --------------------------------------------------------------------------
% the user environment:
-\NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} }
+\NewDocumentCommand \NewTasksEnvironment { O{}mO{\task}D(){1} }
{
- \NewDocumentEnvironment {#2} { O{}D(){#4} }
- { \__tasks_env: {#3} { #1,##1 } {##2} }
- { \end__tasks_env: }
+ \NewDocumentEnvironment {#2} { O{}D(){#4}+b }
+ { \tasks_body:nnnn {#3} {#1,##1} {##2} {##3} }
+ { }
}
-\NewDocumentCommand \RenewTasks { O{}mO{\task}D(){1} }
+\NewDocumentCommand \RenewTasksEnvironment { O{}mO{\task}D(){1} }
{
- \RenewDocumentEnvironment {#2} { O{}D(){#4} }
- { \__tasks_env: {#3} { #1,##1 } {##2} }
- { \end__tasks_env: }
+ \RenewDocumentEnvironment {#2} { O{}D(){#4}+b }
+ { \tasks_body:nnnn {#3} {#1,##1} {##2} {##3} }
+ { }
}
+\tasks_deprecated:NN \NewTasks \NewTasksEnvironment
+\tasks_deprecated:NN \RenewTasks \RenewTasksEnvironment
+
% --------------------------------------------------------------------------
% default list:
-\NewTasks {tasks}
+\NewTasksEnvironment {tasks}
-\file_if_exist:nT {tasks.cfg} { \file_input:n {tasks.cfg} }
+% base instance:
+% ALPHABETIZE: a) b) c)
+\DeclareInstance {tasks} {alphabetize} {default} { }
+
+% ITEMIZE:
+\DeclareInstance {tasks} {itemize} {default}
+ {
+ label-width = 1.125em ,
+ label = \labelitemi
+ }
+
+% ENUMERATE:
+\DeclareInstance {tasks} {enumerate} {default}
+ { label = \arabic*. }
% --------------------------------------------------------------------------
% setup:
@@ -721,9 +732,21 @@
\NewDocumentCommand \settasks { m }
{ \tasks_setup:n {#1} }
+% default:
+ \__tasks_label_align:n {left}
+
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_if_exist:nT {tasks.cfg} { \file_input:n {tasks.cfg} }
+
+\AtBeginDocument
+ {
+ \@ifpackageloaded {hyperref}
+ { \tl_set:Nn \theHtask { \int_use:N \g__tasks_env_int . \thetask } }
+ {}
+ }
+\file_input_stop:
+% --------------------------------------------------------------------------
% 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
@@ -776,3 +799,9 @@
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
+2016/08/16 v0.13 - a negative value for label width will make the label
+ protrude to the margin
+2019/10/04 v1.0 - get rid of `cntformats', `environ' and `epic'
+ - no default multiple choice any more
+ - rename \NewTasks and \RenewTasks
+ - the option `counter-format' is deprecated