summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tasks
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-03-22 03:00:48 +0000
committerNorbert Preining <norbert@preining.info>2020-03-22 03:00:48 +0000
commit75d8dfa80524727ddb7d8ae217ed6463efba84cf (patch)
treea1a1db248828dd36aecb1697d64d28a2ff813d29 /macros/latex/contrib/tasks
parent3e43bc594a14e8c4fc21d6a71f22a23dd78fe252 (diff)
CTAN sync 202003220300
Diffstat (limited to 'macros/latex/contrib/tasks')
-rw-r--r--macros/latex/contrib/tasks/README4
-rw-r--r--macros/latex/contrib/tasks/tasks-manual.pdfbin0 -> 465232 bytes
-rw-r--r--macros/latex/contrib/tasks/tasks-manual.tex (renamed from macros/latex/contrib/tasks/tasks_en.tex)145
-rw-r--r--macros/latex/contrib/tasks/tasks.cfg2
-rw-r--r--macros/latex/contrib/tasks/tasks.sty102
-rw-r--r--macros/latex/contrib/tasks/tasks_en.pdfbin448228 -> 0 bytes
6 files changed, 125 insertions, 128 deletions
diff --git a/macros/latex/contrib/tasks/README b/macros/latex/contrib/tasks/README
index aa177739fa..76abb73d31 100644
--- a/macros/latex/contrib/tasks/README
+++ b/macros/latex/contrib/tasks/README
@@ -1,7 +1,7 @@
--------------------------------------------------------------------------
-the TASKS package v1.1a 2020/01/11
+the TASKS package v1.2 2020/03/21
- horizontally columned lists
+ lists with columns filled horizontally
--------------------------------------------------------------------------
Clemens Niederberger
diff --git a/macros/latex/contrib/tasks/tasks-manual.pdf b/macros/latex/contrib/tasks/tasks-manual.pdf
new file mode 100644
index 0000000000..e16f2d755b
--- /dev/null
+++ b/macros/latex/contrib/tasks/tasks-manual.pdf
Binary files differ
diff --git a/macros/latex/contrib/tasks/tasks_en.tex b/macros/latex/contrib/tasks/tasks-manual.tex
index 8821283a82..2bcfb18d3e 100644
--- a/macros/latex/contrib/tasks/tasks_en.tex
+++ b/macros/latex/contrib/tasks/tasks-manual.tex
@@ -1,7 +1,7 @@
% --------------------------------------------------------------------------
% the TASKS package
%
-% horizontally columned lists
+% lists with columns filled horizontally
%
% --------------------------------------------------------------------------
% Clemens Niederberger
@@ -25,76 +25,27 @@
% 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 = {horizontally columned lists} ,
- add-cmds = {
- NewTasksEnvironment,
- RenewTasksEnvironment,
- settasks,
- startnewitemline ,
- task
- } ,
- add-silent-cmds = {
- DeclareInstance, DeclareTemplateInterface,
- leftthumbsup,
- sample, Sample , theexercise
- }
-}
-
-\newpackagename\ExSheets{ExSheets}
-\newpackagename\xsim{xsim}
-\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{xsim}
-\usepackage{dingbat}
-
-\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}
+\documentclass{tasks-manual}
\begin{document}
\section{Preface}
-\subsection{Motivation}
+\subsection{Motivation \& History}
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.
+\ExSheets\changedversion{0.7} package~\cite{pkg:exsheets}. 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
+better off using traditional \LaTeX\ lists and the \pkg{enumitem} package for
customization.
\subsection{Changes}
@@ -117,26 +68,33 @@ The \sinceversion{1.0} step to version~1.0 brought some significant changes:
\needpackage{xparse} and \pkg{xtemplate}.
\section{How it works}
-\subsection{The Basics}
+\subsection{Background}
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
+\begin{tasks}[style=enumerate]
+ \task there is no pagebreak possible inside an item but only between items.
+ \task the enumeration default is a), b), c) \ldots
+ \task 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
+ \task \ldots\ the fact that 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
+ \task 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}
+\end{tasks}
+
+\begin{bewareofthedog}
+ The environments of \Tasks\ are what I like to call
+ \enquote{pseudo-environments}. This means like environments defined by the
+ package \pkg{environ}~\cite{pkg:environ} the body of the environment is read
+ as argument before it is processed. This is why verbatim material cannot be
+ used in \Tasks' lists.
+\end{bewareofthedog}
+\subsection{The Basics}
\begin{environments}
\environment{tasks}[\oarg{options}\darg{num of columns}]
List like environment where the single items are introduced with
@@ -234,6 +192,11 @@ following command:
\command{startnewitemline}
Introduce a new line in a \env{tasks} environment.
\end{commands}
+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.
+
\begin{example}
\begin{tasks}(4)
\task the first
@@ -250,14 +213,9 @@ following command:
\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 \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:
@@ -315,6 +273,8 @@ following ones that can be set using a setup command:
\keyval{start}{integer}\Default{1}
\sinceversion{1.1}Set the starting value with which the list starts
counting.
+ \keyval{counter}{counter}\Default{task}
+ \sinceversion{1.2}The counter to be used to count the 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
@@ -359,8 +319,8 @@ Now the same list as above but with three columns and a different label:
\end{tasks}
\end{example}
-Let's use it inside a question, \ie, inside \xsim's \env{exercise}
-environment:
+Let's use it inside a question, \ie, inside \pkg{xsim}'s \env{exercise}
+environment~\cite{pkg:xsim}:
\begin{example}
% since settings are local the following ones will be lost
% outside this example;
@@ -431,6 +391,14 @@ argument of \cs{task}. This will temporarily overwrite the default label.
\end{tasks}
\end{example}
+\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}.
+\end{commands}
+
\section{New \code{tasks}-like Environments}
It is possible to add custom environments that work like the \code{tasks}
environment.
@@ -451,8 +419,8 @@ The \env{tasks} environment is defined as follows:
The separator does not have to be a control sequence:
\begin{example}
% preamble:
- % \usepackage{dingbat}
- \NewTasksEnvironment[label=\footnotesize\leftthumbsup,label-width=15pt]{done}[*]
+ % \usepackage{fontawesome}
+ \NewTasksEnvironment[label=\faThumbsOUp,label-width=15pt]{done}[*]
\begin{done}
* First task
* Second task
@@ -472,8 +440,8 @@ argument.
\begin{example}
% preamble:
- % \usepackage{dingbat}
- \NewTasksEnvironment[label=\footnotesize\leftthumbsup,label-width=15pt]{done}[*]
+ % \usepackage{fontawesome}
+ \NewTasksEnvironment[label=\faThumbsOUp,label-width=15pt]{done}[*]
\begin{done}(3)
* First task
* Second task
@@ -524,4 +492,7 @@ This is rather brief this time:
{ label = \arabic*. }
\end{sourcecode}
+\clearpage
+\printbibliography
+
\end{document}
diff --git a/macros/latex/contrib/tasks/tasks.cfg b/macros/latex/contrib/tasks/tasks.cfg
index 127d78f273..c04ea4dabe 100644
--- a/macros/latex/contrib/tasks/tasks.cfg
+++ b/macros/latex/contrib/tasks/tasks.cfg
@@ -1,7 +1,7 @@
% --------------------------------------------------------------------------
% the TASKS package
%
-% horizontally columned lists
+% lists with columns filled horizontally
%
% --------------------------------------------------------------------------
% Clemens Niederberger
diff --git a/macros/latex/contrib/tasks/tasks.sty b/macros/latex/contrib/tasks/tasks.sty
index e9332a378c..3a0e23cb7a 100644
--- a/macros/latex/contrib/tasks/tasks.sty
+++ b/macros/latex/contrib/tasks/tasks.sty
@@ -1,7 +1,7 @@
% --------------------------------------------------------------------------
% the TASKS package
%
-% horizontally columned lists
+% lists with columns filled horizontally
%
% --------------------------------------------------------------------------
% Clemens Niederberger
@@ -28,10 +28,10 @@
\RequirePackage {expl3,xparse,xtemplate}
\ExplSyntaxOn
-\tl_const:Nn \c_tasks_date_tl {2020/01/11}
+\tl_const:Nn \c_tasks_date_tl {2020/03/21}
\tl_const:Nn \c_tasks_version_major_number_tl {1}
-\tl_const:Nn \c_tasks_version_minor_number_tl {1}
-\tl_const:Nn \c_tasks_version_subrelease_tl {a}
+\tl_const:Nn \c_tasks_version_minor_number_tl {2}
+\tl_const:Nn \c_tasks_version_subrelease_tl {}
\tl_const:Nx \c_tasks_version_number_tl
{
\c_tasks_version_major_number_tl .
@@ -42,7 +42,7 @@
\c_tasks_version_number_tl
\c_tasks_version_subrelease_tl
}
-\tl_const:Nn \c_tasks_info_tl {horizontally ~ columned ~ lists}
+\tl_const:Nn \c_tasks_info_tl {lists~ with~ columns~ filled~ horizontally}
\ProvidesExplPackage
{tasks}
@@ -56,8 +56,10 @@
\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 \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}
% --------------------------------------------------------------------------
\msg_new:nnn {tasks} {width-too-small}
@@ -68,9 +70,10 @@
\msg_new:nnn {tasks} {no-item}
{
- You've~ placed~ `#1'~ before~ the~ first~ #2~ \msg_line_context: .~
- I~ will~ throw~ it~ away~ and~ ignore~ it~ for~ the~ rest~ of~ the~
- list.
+ You've~ placed \\ \\
+ #1 \\ \\
+ before~ the~ first~ #2~ \msg_line_context: .~ I~ will~ throw~ it~ away~
+ and~ ignore~ it~ for~ the~ rest~ of~ the~ list.
}
\msg_new:nnn {tasks} {deprecated}
@@ -113,12 +116,14 @@
\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
+\bool_new:N \l__tasks_measuring_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_format_tl
\tl_new:N \l__tasks_custom_label_format_tl
+\tl_new:N \l__tasks_counter_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
@@ -164,6 +169,22 @@
{ \use:n {#1} }
}
+\prg_new_conditional:Npnn \tasks_if_measuring: {p,T,F,TF}
+ {
+ \bool_if:NTF \l__tasks_measuring_bool
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+
+\DeclareExpandableDocumentCommand \tasksifmeasuringTF {+m+m}
+ { \tasks_if_measuring:TF {#1} {#2} }
+
+\DeclareExpandableDocumentCommand \tasksifmeasuringT {+m}
+ { \tasks_if_measuring:T {#1} }
+
+\DeclareExpandableDocumentCommand \tasksifmeasuringF {+m}
+ { \tasks_if_measuring:F {#1} }
+
% --------------------------------------------------------------------------
% #1: instance
% #2: number of columns
@@ -256,11 +277,9 @@
{ \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}
- }
+ \bool_lazy_and:nnT
+ { \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 }
@@ -283,7 +302,10 @@
{
\vcoffin_set:Nnn \l__tasks_tmpa_coffin
{ \l__tasks_item_width_dim }
- { \__tasks_setup: #2 {#3} \mode_if_horizontal:T { \strut } }
+ {
+ \__tasks_setup:
+ #2 { #3 \mode_if_horizontal:T { \strut } }
+ }
\__tasks_debug:n
{
\coffin_typeset:Nnnnn \l__tasks_tmpa_coffin
@@ -338,18 +360,13 @@
\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
+ \coffin_typeset:Nnnnn \l__tasks_item_coffin {l} {T} {0pt} {0pt}
+ \bool_lazy_or:nnT
+ { \l__tasks_item_full_line_bool }
{
- \l__tasks_item_full_line_bool ||
- (
- \l__tasks_item_rest_of_line_bool &&
- \int_compare_p:nNn { \l__tasks_item_columns_int } = {0}
- )
+ \bool_lazy_and_p:nn
+ { \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? Then skip by \l__tasks_column_sep_dim :
@@ -358,12 +375,9 @@
{ \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 != \g__tasks_rows_int } )
- }
+ \bool_lazy_and:nnT
+ { \int_compare_p:nNn { \g__tasks_current_col_num_int } = { \l__tasks_columns_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:
\coffin_clear:N \l__tasks_item_coffin
@@ -429,10 +443,10 @@
{
label : tokenlist = \alph*) ,
indent : length = 2.5em ,
- label-format : tokenlist ,
+ label-format : tokenlist ,
label-width : length = 11pt ,
label-offset : length = .3333em ,
- item-format : tokenlist ,
+ item-format : tokenlist ,
after-item-skip : skip = 1ex plus 1ex minus 1ex
}
@@ -482,7 +496,11 @@
\__tasks_label_align:V \l__tasks_label_align_tl
% need this for enumerate list:
\bool_if:NF \l__tasks_resume_bool
- { \setcounter {task} { \int_eval:n { \l__tasks_start_int -1 } } }
+ {
+ \setcounter
+ { \l__tasks_counter_tl }
+ { \int_eval:n { \l__tasks_start_int -1 } }
+ }
\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
@@ -509,12 +527,12 @@
\bool_set_false:N \l__tasks_tmpa_bool
\tl_if_in:NnT \l__tasks_tmpa_tl {*}
{
- \tl_replace_once:Nnn \l__tasks_tmpa_tl {*} {{task}}
+ \tl_replace_once:Nne \l__tasks_tmpa_tl {*} {{ \l__tasks_counter_tl }}
\bool_set_true:N \l__tasks_tmpa_bool
}
\tl_set_rescan:NnV \l__tasks_tmpa_tl {} \l__tasks_tmpa_tl
\bool_if:NT \l__tasks_tmpa_bool
- { \tl_set:NV \thetask \l__tasks_tmpa_tl }
+ { \tl_set:cV { the \l__tasks_counter_tl } \l__tasks_tmpa_tl }
\dim_compare:nNnT
{ \l__tasks_item_indent_dim }
<
@@ -529,12 +547,13 @@
\seq_map_inline:Nn \l__tasks_seq
{
\__tasks_read_item:www ##1 \q_stop
- \refstepcounter {task}
+ \refstepcounter { \l__tasks_counter_tl }
\tl_set:Nx \l__tasks_label_tl { { \exp_not:V \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:
+ \bool_set_true:N \l__tasks_measuring_bool
\hbox_set:NV \l__tasks_tmpa_box \l__tasks_label_tl
\dim_compare:nNnT
{ \box_wd:N \l__tasks_tmpa_box }
@@ -546,6 +565,7 @@
{label-width}
{ \dim_to_decimal:n { \box_wd:N \l__tasks_tmpa_box } }
}
+ \bool_set_false:N \l__tasks_measuring_bool
\tl_if_eq:VnTF \l__tasks_tmp_label_tl { $tasks$default$label$ }
{
\__tasks_task:VVV
@@ -624,6 +644,8 @@
counter-format .code:n =
\msg_warning:nnnnn {tasks} {deprecated} {option} {counter-format} {label}
\keys_set:nn {tasks/list} { label = #1 } ,
+ counter .tl_set:N = \l__tasks_counter_tl ,
+ counter .initial:n = task ,
label .code:n =
\bool_set_true:N \l__tasks_custom_label_bool
\tl_set:Nn \l__tasks_custom_label_tl {#1} ,
@@ -828,5 +850,9 @@
2019/11/03 v1.1 - fix typo
- make \settasks' argument long
- new option `start'
-2020/01/11 v1.2 - allow `label-format' to end with command that needs an
+2020/01/11 v1.1a - allow `label-format' to end with command that needs an
argument
+2020/03/21 v1.2 - prefer lazy boolean evaluation
+ - \tasksifmeasuringTF
+ - new option `counter'
+ - rename manual files
diff --git a/macros/latex/contrib/tasks/tasks_en.pdf b/macros/latex/contrib/tasks/tasks_en.pdf
deleted file mode 100644
index 27389741a3..0000000000
--- a/macros/latex/contrib/tasks/tasks_en.pdf
+++ /dev/null
Binary files differ