summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-22 23:46:45 +0000
committerKarl Berry <karl@freefriends.org>2013-01-22 23:46:45 +0000
commit48f8b21c2d50f6df0ccca85645ed3d6f7f0dd4a0 (patch)
tree08a17e173875933c9e18478ba2a67372821512fc /Master/texmf-dist/tex
parent9a53151298ad029ce1c0c77c1f30922ee837ee07 (diff)
exsheets/tasks 0.7a (22jan13)
git-svn-id: svn://tug.org/texlive/trunk@28907 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets.sty217
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def356
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/tasks.cfg (renamed from Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.cfg)23
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/tasks.sty445
4 files changed, 585 insertions, 456 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
index 7c939d9de03..6ac2e4dddc0 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
@@ -31,8 +31,8 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% ----------------------------------------------------------------------------
-\def\exsheets@date{2013/01/06}
-\def\exsheets@version{0.6b}
+\def\exsheets@date{2013/01/21}
+\def\exsheets@version{0.7a}
\RequirePackage { expl3 , xparse }
\ProvidesExplPackage
@@ -48,6 +48,8 @@
\tl_new:N \l__exsheets_tmpc_tl
\int_new:N \l__exsheets_tmpa_int
\int_new:N \l__exsheets_tmpb_int
+\int_new:N \l__exsheets_tmpc_int
+\int_new:N \l__exsheets_tmpd_int
\dim_new:N \l__exsheets_tmpa_dim
\seq_new:N \l__exsheets_tmpa_seq
\fp_new:N \l__exsheets_tmpa_fp
@@ -119,7 +121,7 @@
% ----------------------------------------------------------------------------
\RequirePackage
- { xtemplate , l3sort , l3keys2e , xcolor , etoolbox , environ , lcg , silence }
+ { xtemplate , l3sort , l3keys2e , xcolor , etoolbox , environ , pgfcore }
% ----------------------------------------------------------------------------
% color:
@@ -161,6 +163,7 @@
\bool_new:N \l__exsheets_solutions_by_ref_bool
\bool_new:N \l__exsheets_questions_totoc_bool
\bool_new:N \l__exsheets_solutions_totoc_bool
+\bool_new:N \l__exsheets_auto_label_bool
\tl_new:N \l__exsheets_heading_instance_tl
\tl_set:Nn \l__exsheets_heading_instance_tl { block }
@@ -206,7 +209,8 @@
\tl_set:Nn \l__exsheets_questions_toclevel_tl { #1 }
\tl_set:Nn \l__exsheets_solutions_toclevel_tl { #1 } ,
questions-toc-level .tl_set:N = \l__exsheets_questions_toclevel_tl ,
- solutions-toc-level .tl_set:N = \l__exsheets_solutions_toclevel_tl
+ solutions-toc-level .tl_set:N = \l__exsheets_solutions_toclevel_tl ,
+ auto-label .bool_set:N = \l__exsheets_auto_label_bool
}
\keys_set:nn { exsheets} { counter-format = qu. }
@@ -939,6 +943,7 @@
\tl_new:N \l__exsheets_questions_meta_tl
\tl_new:N \g__exsheets_questions_current_id_tl
\tl_new:N \l__exsheets_title_tl
+\tl_new:N \l__exsheets_questions_label_tl
\bool_new:N \l__exsheets_points_not_given_bool
@@ -966,35 +971,63 @@
% Optionen:
\IfNoValueF { #1 } { \keys_set:nn { exsheets / question } { #1 } }
% ID:
- \int_gincr:N \g__exsheets_questions_id_int
- \tl_if_blank:VTF \l__exsheets_questions_id_tl
+ \bool_if:nT
+ {
+ (\l__exsheets_questions_deactivate_bool && \l__exsheets_select_questions_bool)
+ ||
+ !\l__exsheets_select_questions_bool
+ }
{
- \prop_gput:NVV \g__exsheets_questions_id_prop
- \g__exsheets_questions_id_int
- \g__exsheets_questions_id_int
- \bool_if:NT \l__exsheets_questions_use_bool
+ \int_gincr:N \g__exsheets_questions_id_int
+ \tl_if_blank:VTF \l__exsheets_questions_id_tl
{
- \prop_gput:NVV \g__exsheets_questions_used_prop
+ \prop_gput:NVV \g__exsheets_questions_id_prop
\g__exsheets_questions_id_int
\g__exsheets_questions_id_int
- \int_gincr:N \g__exsheets_questions_used_int
+ \bool_if:NT \l__exsheets_questions_use_bool
+ {
+ \prop_gput:NVV \g__exsheets_questions_used_prop
+ \g__exsheets_questions_id_int
+ \g__exsheets_questions_id_int
+ \int_gincr:N \g__exsheets_questions_used_int
+ }
+ \tl_gset:Nx \g__exsheets_questions_current_id_tl
+ { \int_use:N \g__exsheets_questions_id_int }
}
- \tl_gset:Nx \g__exsheets_questions_current_id_tl
- { \int_use:N \g__exsheets_questions_id_int }
- }
- {
- \prop_gput:NVV \g__exsheets_questions_id_prop
- \l__exsheets_questions_id_tl
- \g__exsheets_questions_id_int
- \bool_if:NT \l__exsheets_questions_use_bool
{
- \prop_gput:NVV \g__exsheets_questions_used_prop
+ \prop_gput:NVV \g__exsheets_questions_id_prop
\l__exsheets_questions_id_tl
\g__exsheets_questions_id_int
- \int_gincr:N \g__exsheets_questions_used_int
+ \bool_if:NT \l__exsheets_questions_use_bool
+ {
+ \prop_gput:NVV \g__exsheets_questions_used_prop
+ \l__exsheets_questions_id_tl
+ \g__exsheets_questions_id_int
+ \int_gincr:N \g__exsheets_questions_used_int
+ }
+ \tl_gset:Nx \g__exsheets_questions_current_id_tl
+ { \tl_use:N \l__exsheets_questions_id_tl }
+ }
+ \tl_if_blank:VTF \l__exsheets_questions_label_tl
+ {
+ \bool_if:NT \l__exsheets_auto_label_bool
+ {
+ \exp_args:Nx \label { qu : \g__exsheets_questions_current_id_tl }
+ \exp_args:Nx \SetQuestionProperties
+ {
+ ref = \exp_not:N \ref { qu : \g__exsheets_questions_current_id_tl } ,
+ pageref = \exp_not:N \pageref { qu : \g__exsheets_questions_current_id_tl }
+ }
+ }
+ }
+ {
+ \exp_args:Nx \label { \l__exsheets_questions_label_tl }
+ \exp_args:Nx \SetQuestionProperties
+ {
+ ref = \exp_not:N \ref { \l__exsheets_questions_label_tl } ,
+ pageref = \exp_not:N \pageref { \l__exsheets_questions_label_tl }
+ }
}
- \tl_gset:Nx \g__exsheets_questions_current_id_tl
- { \tl_use:N \l__exsheets_questions_id_tl }
}
% Punktevergabe:
\IfNoValueTF { #2 }
@@ -1062,6 +1095,7 @@
}
\bool_if:NT \l__exsheets_questions_print_bool
{
+% \exsheets_questions_debug:
\bool_if:NTF \l__exsheets_exam_bool
{ \tl_set_eq:NN \l__exsheets_title_tl \l__exsheets_questions_name_tl }
{ \tl_set_eq:NN \l__exsheets_title_tl \l__exsheets_exsheets_name_tl }
@@ -1217,6 +1251,7 @@
print .bool_set:N = \l__exsheets_questions_print_bool ,
print .default:n = true ,
ID .tl_set:N = \l__exsheets_questions_id_tl ,
+ label .tl_set:N = \l__exsheets_questions_label_tl ,
class .code:n =
\bool_set_true:N \l__exsheets_questions_class_bool
\tl_set:Nn \l__exsheets_questions_class_tl { #1 } ,
@@ -1251,6 +1286,11 @@
\@onlypreamble\DeclareQuestionProperty
\DeclareQuestionProperty{points}
+\bool_if:NT \l__exsheets_auto_label_bool
+ {
+ \DeclareQuestionProperty{ref}
+ \DeclareQuestionProperty{pageref}
+ }
\NewDocumentCommand \SetQuestionProperties { m }
{ \exsheets_set_question_properties:n { #1 } }
@@ -1345,11 +1385,8 @@
\clist_new:N \l__exsheets_include_id_clist
\int_new:N \l__exsheets_include_random_int
\int_zero:N \l__exsheets_include_random_int
-\tl_new:N \l__exsheets_random_seed_tl
-\tl_set:Nn \l__exsheets_random_seed_tl { -1 }
-\newcounter {exsheets@include@random}
-\cs_new:Npn \file_input_if_exist:n #1
+\cs_new:Npn \exsheets_file_input_if_exist:n #1
{ \file_if_exist:nT { #1 } { \file_input:n { #1 } } }
\cs_if_exist:NF \prop_length:N
@@ -1379,16 +1416,16 @@
\cs_new:Npn \exsheets_include_questions:n #1
{
+ \bool_set_true:N \l__exsheets_select_questions_bool
\seq_set_split:Nnn \l__exsheets_tmpa_seq { , } { #1 }
\seq_map_inline:Nn \l__exsheets_tmpa_seq
{
\bool_set_true:N \l__exsheets_questions_deactivate_bool
- \file_input_if_exist:n { ##1 }
+ \int_set_eq:NN \l__exsheets_tmpc_int \g__exsheets_questions_id_int
+ \exsheets_file_input_if_exist:n { ##1 }
\prop_length:NN
\g__exsheets_selected_questions_prop
\l__exsheets_tmpa_int
- \int_gsub:Nn \g__exsheets_questions_id_int
- { \l__exsheets_tmpa_int }
\bool_if:NT \l__exsheets_questions_debug_bool
{
\colorbox { exsheetsdebugcolor }
@@ -1400,18 +1437,22 @@
\exsheets_par:
}
\bool_set_false:N \l__exsheets_questions_deactivate_bool
+ \int_set_eq:NN \l__exsheets_tmpd_int \g__exsheets_questions_id_int
+ \int_gset_eq:NN \g__exsheets_questions_id_int \l__exsheets_tmpc_int
\__exsheets_select_question_random:n { ##1 }
- \file_input_if_exist:n { ##1 }
+ \exsheets_file_input_if_exist:n { ##1 }
+ \int_gset_eq:NN \g__exsheets_questions_id_int \l__exsheets_tmpd_int
\prop_gclear:N \g__exsheets_selected_questions_prop
\clist_clear:N \l__exsheets_include_id_clist
+ \int_gzero:N \g__exsheets_selection_number_int
}
+ \bool_set_false:N \l__exsheets_select_questions_bool
}
% options:
% - IDs=<list of IDs>
% - all=true|false % default when no option is given
% - random=<num>
-% - seed=<num> % set the seed for the random selection
\keys_define:nn { exsheets / include }
{
all .bool_set:N = \l__exsheets_include_all_bool ,
@@ -1422,20 +1463,34 @@
random .code:n =
\bool_set_false:N \l__exsheets_include_all_bool
\bool_set_true:N \l__exsheets_include_random_bool
- \int_set:Nn \l__exsheets_include_random_int { #1 } ,
- seed .tl_set:N = \l__exsheets_random_seed_tl
+ \int_set:Nn \l__exsheets_include_random_int { #1 }
}
+\int_new:N \g__exsheets_selection_number_int
+
\cs_new:Npn \__exsheets_select_question:n #1
{
- \bool_if:NTF \l__exsheets_questions_deactivate_bool
+ \bool_if:NT \l__exsheets_select_questions_bool
{
- \prop_gput:Nnn \g__exsheets_selected_questions_prop
- { #1 } { \__exsheets_dummy: }
- }
- {
- \bool_if:NF \l__exsheets_include_all_bool
- { \__exsheets_select_question_by_id:n { #1 } }
+ \bool_if:NTF \l__exsheets_questions_deactivate_bool
+ {
+ \bool_if:NT \l__exsheets_questions_use_bool
+ {
+ \int_gincr:N \g__exsheets_selection_number_int
+ \exp_args:NNx
+ \prop_gput:Nnn \g__exsheets_selected_questions_prop
+ { \int_use:N \g__exsheets_selection_number_int } { #1 }
+ }
+ }
+ {
+ \int_gincr:N \g__exsheets_questions_id_int
+ \exp_args:NNx
+ \prop_get:NnN \g__exsheets_questions_id_prop
+ { \int_use:N \g__exsheets_questions_id_int }
+ \l_tmpa_tl
+ \bool_if:NF \l__exsheets_include_all_bool
+ { \__exsheets_select_question_by_id:V \l_tmpa_tl }
+ }
}
}
\cs_generate_variant:Nn \__exsheets_select_question:n { V }
@@ -1448,6 +1503,7 @@
{ \bool_gset_true:N \g__exsheets_questions_use_bool }
{ \bool_gset_false:N \g__exsheets_questions_use_bool }
}
+\cs_generate_variant:Nn \__exsheets_select_question_by_id:n { V }
% TODO: don't select questions whose topics or classes aren't chosen
\cs_new:Npn \__exsheets_select_question_random:n #1
@@ -1464,44 +1520,22 @@
\bool_set_true:N \l__exsheets_include_all_bool
}
{
- \group_begin:
- \WarningsOff[lcg]
- \tl_set:Nx \l__exsheets_tmpa_tl { \int_use:N \l__exsheets_tmpa_int }
- \reinitrand
- [
- first = 1 ,
- last = \l__exsheets_tmpa_tl ,
- counter = exsheets@include@random ,
- seed = \l__exsheets_random_seed_tl ,
- quiet = y
- ]
- \int_zero:N \l__exsheets_tmpa_int
- \int_do_while:nNnn \l__exsheets_tmpa_int < \l__exsheets_include_random_int
- {
- \rand
- \int_zero:N \l__exsheets_tmpb_int
- \prop_map_inline:Nn \g__exsheets_selected_questions_prop
- {
- \int_incr:N \l__exsheets_tmpb_int
- \int_compare:nT
- { \l__exsheets_tmpb_int = \value{exsheets@include@random} }
- {
- \tl_set_rescan:Nnn \l__exsheets_tmpa_tl {} { ##1 }
- \clist_if_in:NVTF \l__exsheets_include_id_clist \l__exsheets_tmpa_tl
- { \int_decr:N \l__exsheets_tmpb_int }
- {
- \clist_gput_right:NV \l__exsheets_include_id_clist
- \l__exsheets_tmpa_tl
- \prop_map_break:
- }
- }
- }
- \clist_remove_duplicates:N \l__exsheets_include_id_clist
- \int_set:Nn \l__exsheets_tmpa_int
- { \clist_count:N \l__exsheets_include_id_clist }
- }
- \WarningsOn[lcg]
- \group_end:
+ \int_zero:N \l__exsheets_tmpb_int
+ \int_do_while:nn { \l__exsheets_tmpb_int < \l__exsheets_include_random_int }
+ {
+ \pgfmathparse { random(\int_use:N \l__exsheets_tmpa_int) }
+ \tl_set_eq:NN \l__exsheets_tmpa_tl \pgfmathresult
+ \prop_get:NVN \g__exsheets_selected_questions_prop
+ \l__exsheets_tmpa_tl
+ \l__exsheets_tmpb_tl
+ \clist_if_in:NVF \l__exsheets_include_id_clist \l__exsheets_tmpb_tl
+ {
+ \clist_put_right:NV
+ \l__exsheets_include_id_clist
+ \l__exsheets_tmpb_tl
+ \int_incr:N \l__exsheets_tmpb_int
+ }
+ }
}
}
}
@@ -2040,12 +2074,11 @@
% ----------------------------------------------------------------------------
% the `tasks' list
-\input { exsheets_tasks.def }
-\bool_if:NT \l__exsheets_load_tasks_bool
- {
- \RequirePackage { amssymb }
- \input { exsheets_tasks.cfg }
- }
+\bool_if:NTF \l__exsheets_load_tasks_bool
+ { \RequirePackage [ more ] { tasks } }
+ { \RequirePackage { tasks } }
+\AddCounterPattern* [ tasks ] { question } { qu }
+\ReadCounterFrom [ tasks ] { question } \l__exsheets_counter_qu_int
% ----------------------------------------------------------------------------
% the \blank{<words>} command
@@ -2365,9 +2398,17 @@ HISTORY:
2012/12/23 v0.6a - bug fix: labels and items of {tasks} weren't joined at
their baselines
2013/01/06 v0.6b - bug fix: ID counting fixed in \includequestions
+2013/01/19 v0.7 - extracted `tasks' environment into standalone package;
+ this also lead to a slightly new syntax and a few new
+ options for it
+ - changed internals for random selection of questions:
+ uses `pgf' instead of `lcg' and seems to be more reliable
+ than before
+2013/01/21 v0.7a - added option `auto-label' and questions key `label',
+ also added question properties `ref' and `pageref'
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
- points/decimal-marker, points/frac (?), points/format (?,im interface)
-- bug in {tasks} in {solution}: label werden nicht richtig upgedatet!
-- bug: counter-format=se.qu und \begin{solution}[print] \ No newline at end of file
+- rewrite random selection
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def
deleted file mode 100644
index facab8e6553..00000000000
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def
+++ /dev/null
@@ -1,356 +0,0 @@
-% --------------------------------------------------------------------------
-% the EXSHEETS package
-%
-% Yet another package for the creation of exercise sheets
-%
-% --------------------------------------------------------------------------
-% Clemens Niederberger
-% Web: https://bitbucket.org/cgnieder/exsheets/
-% E-Mail: contact@mychemistry.eu
-% --------------------------------------------------------------------------
-% Copyright 2011-2013 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 exsheets package consists of the files
-% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg,
-% exsheets_tasks.def, exsheets_tasks.cfg, exsheets_configurations.cfg,
-% - exsheets_en.tex, exsheets_en.pdf,
-% - README
-% --------------------------------------------------------------------------
-% If you have any ideas, questions, suggestions or bugs to report, please
-% feel free to contact me.
-% --------------------------------------------------------------------------
-% TASKS: LIST-LIKE ENVIRONMENT
-\ProvidesFile{exsheets_tasks.def}
- [\exsheets@date\space v\exsheets@version\space ExSheets tasks object]
-
-\RequirePackage { epic }
-
-% variables:
-\seq_new:N \l__exsheets_tasks_seq
-\int_new:N \l__exsheets_tasks_depth_int
-\int_new:N \g__exsheets_tasks_int
-\int_new:N \l__exsheets_tasks_total_items_int
-\int_new:N \l__exsheets_tasks_columns_int
-\int_new:N \l__exsheets_tasks_rows_int
-\bool_new:N \l__exsheets_tasks_enumerate_bool
-\bool_new:N \l__exsheets_tasks_resume_bool
-\tl_new:N \l__exsheets_tasks_instance_tl
-\tl_new:N \l__exsheets_tasks_label_tl
-\tl_new:N \l__exsheets_tasks_label_pattern_tl
-\tl_new:N \l__exsheets_tasks_custom_label_format_tl
-\dim_new:N \l__exsheets_tasks_item_indent_dim
-\dim_new:N \l__exsheets_tasks_item_width_dim
-\dim_new:N \l__exsheets_tasks_label_width_dim
-\dim_new:N \l__exsheets_tasks_default_label_width_dim
-\skip_new:N \l__exsheets_tasks_after_item_skip
-\skip_new:N \l__exsheets_tasks_before_list_skip
-\skip_new:N \l__exsheets_tasks_after_list_skip
-
-\NewCounterPattern* [ exsheets ] { task } { tsk }
-\ReadCounterFrom [ exsheets ] { task } \g__exsheets_tasks_int
-
-% scratch coffins:
-\cs_if_exist:NF \l__exsheets_tmpa_coffin { \coffin_new:N \l__exsheets_tmpa_coffin }
-\cs_if_exist:NF \l__exsheets_tmpb_coffin { \coffin_new:N \l__exsheets_tmpb_coffin }
-\cs_if_exist:NF \l__exsheets_tmpc_coffin { \coffin_new:N \l__exsheets_tmpc_coffin }
-
-% collect the tasks:
-\cs_new:Npn \__exsheets_collect_tasks:nw #1#2 \end #3
- {
- \tl_put_right:Nn \l__exsheets_tasks_body_tl { #1 }
- \end { #3 }
- \tl_if_eq:nnF { #1 } { #3 }
- { \__exsheets_collect_tasks:nw { #1 } }
- }
-
-% #1: instance
-% #2: number of columns
-% #3: item separator
-% #4: environment body
-\cs_new:Npn \__exsheets_tasks:nnnn #1#2#3#4
- {
- \seq_set_split:Nnn \l__exsheets_tasks_seq { #3 } { #4 }
- % remove the first (empty) item:
- \seq_pop_left:NN \l__exsheets_tasks_seq \l__exsheets_tmpa_tl
- \tl_if_blank:VF \l__exsheets_tmpa_tl
- { \tl_show:N \l__exsheets_tmpa_tl \@noitemerr }
- \int_set:Nn \l__exsheets_tasks_total_items_int
- { \seq_length:N \l__exsheets_tasks_seq }
- \UseInstance { exsheets-tasks } { #1 }
- { \l__exsheets_tasks_total_items_int }
- { #2 }
- { \l__exsheets_tasks_custom_label_format_tl }
- % just to be sure:
- \seq_clear:N \l__exsheets_tasks_seq
- }
-\cs_generate_variant:Nn \__exsheets_tasks:nnnn { VnnV }
-
-\cs_new:Npn \__exsheets_task:nnw #1#2[#3,#4][#5,#6](#7,#8)
- {
- \dim_set:Nn \l__exsheets_tasks_item_width_dim
- {
- \linewidth / \l__exsheets_tasks_columns_int -
- \l__exsheets_tasks_depth_int \l__exsheets_tasks_item_indent_dim
- }
- \int_incr:N \l__exsheets_tmpa_int
- \__exsheets_tasks_set_rows_num:NN
- \l__exsheets_tasks_total_items_int
- \l__exsheets_tasks_columns_int
- \int_compare:nT { \l__exsheets_tmpa_int > \l__exsheets_tasks_columns_int }
- { \int_set:Nn \l__exsheets_tmpa_int { 1 } }
- % the item:
- \hcoffin_set:Nn \l__exsheets_tmpa_coffin
- {
- \vcoffin_set:Nnn \l__exsheets_tmpc_coffin
- { \l__exsheets_tasks_item_width_dim }
- { \__exsheets_tasks_setup: #2 }
- \coffin_typeset:Nnnnn \l__exsheets_tmpc_coffin
- { l } { T } { 0pt } { 0pt }
- }
- % the label:
- \hcoffin_set:Nn \l__exsheets_tmpb_coffin { \strut #1 }
- \coffin_attach:NnnNnnnn
- \l__exsheets_tmpa_coffin { l } { T }
- \l__exsheets_tmpb_coffin { l } { T } { -\l__exsheets_tasks_label_width_dim } { 0pt }
- % typeset label & item:
- % need this when a new row starts:
- \int_compare:nT { \l__exsheets_tmpa_int = 1 }
- { \skip_vertical:N \c_zero_skip }
- \skip_horizontal:N \l__exsheets_tasks_item_indent_dim
- \coffin_typeset:Nnnnn \l__exsheets_tmpa_coffin { l } { T } { 0pt } { 0pt }
- % need this before a new row starts:
- \int_compare:nT { \l__exsheets_tmpa_int = \l__exsheets_tasks_columns_int }
- { \skip_vertical:N \l__exsheets_tasks_after_item_skip }
- \coffin_clear:N \l__exsheets_tmpa_coffin
- \coffin_clear:N \l__exsheets_tmpb_coffin
- \coffin_clear:N \l__exsheets_tmpc_coffin
- }
-\cs_generate_variant:Nn \__exsheets_task:nnw { VV }
-
-\cs_new:Npn \__exsheets_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
- \strut
- }
-
-\cs_new:Npn \__exsheets_tasks_set_rows_num:NN #1#2
- {
- \int_set:Nn \l__exsheets_tasks_rows_int { \int_div_truncate:nn { #1 } { #2 } }
- \int_compare:nNnT { \int_mod:nn { #1 } { #2 } } > { 0 }
- { \int_incr:N \l__exsheets_tasks_rows_int }
- }
-
-% the `exsheets-tasks' object:
-% #1: number of items
-% #2: number of columns
-% #3: label-format
-\DeclareObjectType { exsheets-tasks } { 3 }
-% the `default' template interface:
-\DeclareTemplateInterface { exsheets-tasks } { default } { 3 }
- {
- enumerate : boolean = true ,
- label : tokenlist ,
- indent : length = 2.5em ,
- label-format : tokenlist = tsk[a]) ,
- label-width : length = 3ex ,
- after-item-skip : skip = 1ex plus 1ex minus 1ex
- }
-% the `default' template code:
-\DeclareTemplateCode { exsheets-tasks } { default } { 3 }
- {
- enumerate = \l__exsheets_tasks_enumerate_bool ,
- label = \l__exsheets_tasks_label_tl ,
- indent = \l__exsheets_tasks_item_indent_dim ,
- label-format = \l__exsheets_tasks_label_pattern_tl ,
- label-width = \l__exsheets_tasks_default_label_width_dim ,
- after-item-skip = \l__exsheets_tasks_after_item_skip
- }
- {
- \AssignTemplateKeys
- \dim_compare:nT { \l__exsheets_tasks_label_width_dim = 0pt }
- {
- \dim_set_eq:NN
- \l__exsheets_tasks_label_width_dim
- \l__exsheets_tasks_default_label_width_dim
- }
- % need this for enumerate list:
- \bool_if:nT { !\l__exsheets_tasks_resume_bool && \l__exsheets_tasks_enumerate_bool }
- { \int_gzero:N \g__exsheets_tasks_int }
- \int_set:Nn \l__exsheets_tasks_columns_int { #2 }
- % set all the items in their own coffins and join with the ground:
- \int_zero:N \l__exsheets_tmpa_int
- \tl_if_blank:VF \l__exsheets_tasks_custom_label_format_tl
- {
- \tl_set_eq:NN
- \l__exsheets_tasks_label_pattern_tl
- \l__exsheets_tasks_custom_label_format_tl
- }
- \seq_map_inline:Nn \l__exsheets_tasks_seq
- {
- \__exsheets_read_item:w ##1 \q_stop
- \bool_if:NTF \l__exsheets_tasks_enumerate_bool
- {
- \int_gincr:N \g__exsheets_tasks_int
- \tl_if_blank:VT \l__exsheets_tasks_label_tl
- {
- \tl_set:Nn \l__exsheets_tasks_label_tl
- {
- \ReadCounterPatternFrom [ exsheets ]
- \l__exsheets_tasks_label_pattern_tl
- }
- }
- }
- {
- \tl_if_blank:VT \l__exsheets_tasks_label_tl
- { \tl_set_eq:NN \l__exsheets_tasks_label_tl \labelitemi }
- }
- \tl_if_blank:VTF \l__exsheets_tasks_tmp_label_tl
- {
- \__exsheets_task:VVw
- \l__exsheets_tasks_label_tl
- \l__exsheets_tasks_item_tl
- [ l , b ] [ l , t ] ( 0pt , 0pt )
- }
- {
- \__exsheets_task:VVw
- \l__exsheets_tasks_tmp_label_tl
- \l__exsheets_tasks_item_tl
- [ l , b ] [ l , t ] ( 0pt , 0pt )
- \tl_clear:N \l__exsheets_tasks_tmp_label_tl
- }
- }
- }
-
-\tl_new:N \task
-\tl_new:N \l__exsheets_tasks_item_tl
-\tl_new:N \l__exsheets_tasks_tmp_label_tl
-
-\cs_new:Npn \__exsheets_read_item:w
- {
- \peek_meaning:NTF [
- { \__exsheets_read_item_aux:w }
- { \__exsheets_read_item_aux:w[] }
- }
-
-\cs_new:Npn \__exsheets_read_item_aux:w [#1]#2 \q_stop
- {
- \tl_if_blank:nF { #1 }
- { \tl_set:Nn \l__exsheets_tasks_tmp_label_tl { #1 } }
- \tl_set:Nn \l__exsheets_tasks_item_tl { \ignorespaces #2 }
- }
-
-% choice box:
-\bool_new:N \l__exsheets_choice_checked_bool
-\dim_new:N \l__exsheets_choice_width_dim
-\dim_set:Nn \l__exsheets_choice_width_dim { 1.25ex }
-\dim_new:N \l__exsheets_choice_linewidth_dim
-\dim_set:Nn \l__exsheets_choice_linewidth_dim { .3pt }
-\dim_new:N \l__exsheets_choice_checkwidth_dim
-\dim_set:Nn \l__exsheets_choice_checkwidth_dim { .5pt }
-\dim_new:N \l__exsheets_choice_raise_dim
-\dim_set:Nn \l__exsheets_choice_raise_dim { .1ex }
-
-\cs_new:Npn \exsheets_choice:
- {
- \leavevmode
- \bool_set_false:N \l__exsheets_choice_checked_bool
- \box_move_up:nn
- { \l__exsheets_choice_raise_dim }
- { \hbox:n { \__exsheets_choice: } }
- }
-
-\cs_new:Npn \exsheets_choice_checked:
- {
- \leavevmode
- \bool_set_true:N \l__exsheets_choice_checked_bool
- \box_move_up:nn
- { \l__exsheets_choice_raise_dim }
- { \hbox:n { \__exsheets_choice: } }
- }
-
-\cs_new:Npn \__exsheets_choice:
- {%
- \dim_set:Nn \unitlength { .1\l__exsheets_choice_width_dim }
- \begin{picture}(10,0)
- \linethickness \l__exsheets_choice_linewidth_dim
- \drawline(0,0)(0,10)(10,10)(10,0)(0,0)
- \linethickness \l__exsheets_choice_checkwidth_dim
- \bool_if:NT \l__exsheets_choice_checked_bool
- {
- \drawline(2,2)(8,8)
- \drawline(2,8)(8,2)
- }
- \end{picture}%
- }
-
-\providecommand* \choicebox { \exsheets_choice: }
-\providecommand* \checkedchoicebox { \exsheets_choice_checked: }
-
-% base instance:
-% ALPHABETIZE: a) b) c)
-\DeclareInstance { exsheets-tasks } { alphabetize } { default } { }
-
-\keys_define:nn { exsheets / tasks }
- {
- style .tl_set:N = \l__exsheets_tasks_instance_tl ,
- label .tl_set:N = \l__exsheets_tasks_custom_label_format_tl ,
- label-width .dim_set:N = \l__exsheets_tasks_label_width_dim ,
- before-skip .skip_set:N = \l__exsheets_tasks_before_list_skip ,
- after-skip .skip_set:N = \l__exsheets_tasks_after_list_skip ,
- resume .bool_set:N = \l__exsheets_tasks_resume_bool
- }
-
-% the generic environment:
-\NewEnviron { __exsheets_tasks_env: } [ 3 ]
- {
- \keys_set:nn { exsheets / tasks } { #2 }
- \tl_if_blank:VT \l__exsheets_tasks_instance_tl
- { \keys_set:nn { exsheets / tasks } { style = alphabetize } }
- \skip_vertical:N \l__exsheets_tasks_before_list_skip
- \skip_vertical:N \c_zero_skip
- \list {}
- {
- \dim_set:Nn \leftmargin { 0pt }
- \dim_set:Nn \rightmargin { 0pt }
- }
- \item \scan_stop:
- \int_incr:N \l__exsheets_tasks_depth_int
- \__exsheets_tasks:VnnV \l__exsheets_tasks_instance_tl { #3 } { #1 } \BODY
- \endlist
- \skip_vertical:N \l__exsheets_tasks_after_list_skip
- }
-
-% the user environment:
-\NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} }
- {
- \NewDocumentEnvironment { #2 } { O{}G{#4} }
- { \__exsheets_tasks_env: { #3 } { #1,##1 } { ##2 } }
- { \end__exsheets_tasks_env: }
- }
-
-\NewDocumentCommand \RenewTasks { O{}mO{\task}D(){1} }
- {
- \RenewDocumentEnvironment { #2 } { O{}G{#4} }
- { \__exsheets_tasks_env: { #3 } { #1,##1 } { ##2 } }
- { \end__exsheets_tasks_env: }
- }
-
-\NewTasks { tasks }
-
-\tex_endinput:D
-% TODO: option für after-item-skip \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.cfg b/Master/texmf-dist/tex/latex/exsheets/tasks.cfg
index b99fdda993f..fb8923ef0d6 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.cfg
+++ b/Master/texmf-dist/tex/latex/exsheets/tasks.cfg
@@ -1,7 +1,7 @@
% --------------------------------------------------------------------------
-% the EXSHEETS package
+% the TASKS package
%
-% Yet another package for the creation of exercise sheets
+% Horizontal columned lists.
%
% --------------------------------------------------------------------------
% Clemens Niederberger
@@ -22,32 +22,31 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-% The exsheets package consists of the files
-% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg,
-% exsheets_tasks.def, exsheets_tasks.cfg, exsheets_configurations.cfg,
-% - exsheets_en.tex, exsheets_en.pdf,
-% - README
+% The tasks package consists of the files
+% - tasks.sty, tasks.cfg
% --------------------------------------------------------------------------
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
% further instances for the `tasks' environment
-\ProvidesFile{exsheets_tasks.cfg}
- [\exsheets@date\space v\exsheets@version\space ExSheets tasks instances]
+\ProvidesFile{tasks.cfg}
+ [\@tasks@date\space v\@tasks@version\space tasks instances]
+
+\cs_new:Npn \tasks_config_file_loaded: {}
% ITEMIZE:
-\DeclareInstance { exsheets-tasks } { itemize } { default }
+\DeclareInstance { tasks } { itemize } { default }
{
enumerate = false ,
label-width = 2.25ex
}
% ENUMERATE:
-\DeclareInstance { exsheets-tasks } { enumerate } { default }
+\DeclareInstance { tasks } { enumerate } { default }
{ label-format = tsk. }
% MULTIPLECHOICE
-\DeclareInstance { exsheets-tasks } { multiplechoice } { default }
+\DeclareInstance { tasks } { multiplechoice } { default }
{
enumerate = false ,
label = \choicebox
diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.sty b/Master/texmf-dist/tex/latex/exsheets/tasks.sty
new file mode 100644
index 00000000000..88b613d7dbd
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/exsheets/tasks.sty
@@ -0,0 +1,445 @@
+% --------------------------------------------------------------------------
+% the TASKS package
+%
+% Horizontal columned lists.
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% Web: https://bitbucket.org/cgnieder/exsheets/
+% E-Mail: contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% Copyright 2011-2013 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
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+\def\@tasks@date{2013/01/20}
+\def\@tasks@version{0.7}
+
+\RequirePackage { expl3 , xparse , l3keys2e }
+\ProvidesExplPackage
+ {tasks}
+ {\@tasks@date}
+ {\@tasks@version}
+ {Horizontal columned lists.}
+
+% requirements:
+\RequirePackage { epic , cntformats , xtemplate , environ }
+
+% variables:
+\seq_new:N \l__tasks_seq
+
+\int_new:N \l__tasks_depth_int
+\int_new:N \g__tasks_int
+\int_new:N \l__tasks_total_items_int
+\int_new:N \l__tasks_columns_int
+\int_new:N \l__tasks_rows_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_label_offset_bool
+
+\tl_new:N \l__tasks_instance_tl
+\tl_new:N \l__tasks_label_tl
+\tl_new:N \l__tasks_label_pattern_tl
+\tl_new:N \l__tasks_custom_label_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_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
+
+\skip_new:N \l__tasks_after_item_skip
+\skip_new:N \l__tasks_before_list_skip
+\skip_new:N \l__tasks_after_list_skip
+
+\NewCounterPattern* [ tasks ] { task } { tsk }
+\ReadCounterFrom [ tasks ] { task } \g__tasks_int
+
+% scratch variables:
+\tl_new:N \l__tasks_tmpa_tl
+\int_new:N \l__tasks_tmpa_int
+\coffin_new:N \l__tasks_tmpa_coffin
+\coffin_new:N \l__tasks_tmpb_coffin
+\coffin_new:N \l__tasks_tmpc_coffin
+
+% collect the tasks:
+\cs_new:Npn \__tasks_collect_tasks:nw #1#2 \end #3
+ {
+ \tl_put_right:Nn \l__tasks_body_tl { #1 }
+ \end { #3 }
+ \tl_if_eq:nnF { #1 } { #3 }
+ { \__tasks_collect_tasks:nw { #1 } }
+ }
+
+% #1: instance
+% #2: number of columns
+% #3: item separator
+% #4: environment body
+\cs_new:Npn \__tasks:nnnn #1#2#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
+ { \tl_show:N \l__tasks_tmpa_tl \@noitemerr }
+ \int_set:Nn \l__tasks_total_items_int
+ { \seq_length:N \l__tasks_seq }
+ \UseInstance { tasks } { #1 }
+ { \l__tasks_total_items_int }
+ { #2 }
+ { \l__tasks_custom_label_format_tl }
+ % just to be sure:
+ \seq_clear:N \l__tasks_seq
+ }
+\cs_generate_variant:Nn \__tasks:nnnn { VnnV }
+
+\cs_new:Npn \__tasks_task:nnw #1#2[#3,#4][#5,#6](#7,#8)
+ {
+ \dim_set:Nn \l__tasks_item_width_dim
+ {
+ \linewidth / \l__tasks_columns_int -
+ \l__tasks_depth_int \l__tasks_item_indent_dim
+ }
+ \int_incr:N \l__tasks_tmpa_int
+ \__tasks_set_rows_num:NN
+ \l__tasks_total_items_int
+ \l__tasks_columns_int
+ \int_compare:nT { \l__tasks_tmpa_int > \l__tasks_columns_int }
+ { \int_set:Nn \l__tasks_tmpa_int { 1 } }
+ % the item:
+ \hcoffin_set:Nn \l__tasks_tmpa_coffin
+ {
+ \vcoffin_set:Nnn \l__tasks_tmpc_coffin
+ { \l__tasks_item_width_dim }
+ { \__tasks_setup: #2 }
+ \coffin_typeset:Nnnnn \l__tasks_tmpc_coffin
+ { l } { T } { 0pt } { 0pt }
+ }
+ % the label:
+ \vcoffin_set:Nnn \l__tasks_tmpb_coffin
+ { \l__tasks_label_width_dim }
+ {
+ \tl_use:N \l__tasks_item_fill_left_tl
+ \strut #1
+ \tl_use:N \l__tasks_item_fill_right_tl
+ }
+ \coffin_attach:NnnNnnnn
+ \l__tasks_tmpa_coffin { l } { T }
+ \l__tasks_tmpb_coffin { l } { T }
+ { -\l__tasks_label_width_dim - \l__tasks_label_offset_dim } { 0pt }
+ % typeset label & item:
+ % need this when a new row starts:
+ \int_compare:nT { \l__tasks_tmpa_int = 1 }
+ { \skip_vertical:N \c_zero_skip }
+ \skip_horizontal:N \l__tasks_item_indent_dim
+ \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin
+ { l } { T } { 0pt } { 0pt }
+ % need this before a new row starts:
+ \int_compare:nT { \l__tasks_tmpa_int = \l__tasks_columns_int }
+ { \skip_vertical:N \l__tasks_after_item_skip }
+ \coffin_clear:N \l__tasks_tmpa_coffin
+ \coffin_clear:N \l__tasks_tmpb_coffin
+ \coffin_clear:N \l__tasks_tmpc_coffin
+ }
+\cs_generate_variant:Nn \__tasks_task:nnw { VV }
+
+\cs_new: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
+ \strut
+ }
+
+\cs_new:Npn \__tasks_set_rows_num:NN #1#2
+ {
+ \int_set:Nn \l__tasks_rows_int { \int_div_truncate:nn { #1 } { #2 } }
+ \int_compare:nNnT { \int_mod:nn { #1 } { #2 } } > { 0 }
+ { \int_incr:N \l__tasks_rows_int }
+ }
+
+\cs_new:Npn \__tasks_label_align:n #1
+ {
+ \clist_if_in:nnTF { left , center , right } { #1 }
+ {
+ \tl_if_eq:nnT { #1 } { left }
+ {
+ \tl_clear:N \l__tasks_item_fill_left_tl
+ \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfil
+ }
+ \tl_if_eq:nnT { #1 } { 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 }
+ {
+ \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfil
+ \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfil
+ }
+ }
+ {
+ \tl_clear:N \l__tasks_item_fill_left_tl
+ \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfil
+ }
+ }
+\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 ,
+ label-format : tokenlist = tsk[a]) ,
+ label-width : length = 3ex ,
+ label-offset : length = 1ex ,
+ after-item-skip : skip = 1ex plus 1ex minus 1ex
+ }
+% the `default' template code:
+\DeclareTemplateCode { tasks } { default } { 3 }
+ {
+ enumerate = \l__tasks_enumerate_bool ,
+ label = \l__tasks_label_tl ,
+ indent = \l__tasks_item_indent_dim ,
+ label-format = \l__tasks_label_pattern_tl ,
+ label-width = \l__tasks_label_default_width_dim ,
+ label-offset = \l__tasks_label_default_offset_dim ,
+ 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_label_offset_bool
+ {
+ \dim_set_eq:NN
+ \l__tasks_label_offset_dim
+ \l__tasks_label_default_offset_dim
+ }
+ \__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_zero:N \l__tasks_tmpa_int
+ \tl_if_blank:VF \l__tasks_custom_label_format_tl
+ {
+ \tl_set_eq:NN
+ \l__tasks_label_pattern_tl
+ \l__tasks_custom_label_format_tl
+ }
+ \seq_map_inline:Nn \l__tasks_seq
+ {
+ \__tasks_read_item:w ##1 \q_stop
+ \bool_if:NTF \l__tasks_enumerate_bool
+ {
+ \int_gincr:N \g__tasks_int
+ \tl_if_blank:VT \l__tasks_label_tl
+ {
+ \tl_set:Nn \l__tasks_label_tl
+ {
+ \ReadCounterPatternFrom [ tasks ]
+ \l__tasks_label_pattern_tl
+ }
+ }
+ }
+ {
+ \tl_if_blank:VT \l__tasks_label_tl
+ { \tl_set_eq:NN \l__tasks_label_tl \labelitemi }
+ }
+ \tl_if_blank:VTF \l__tasks_tmp_label_tl
+ {
+ \__tasks_task:VVw
+ \l__tasks_label_tl
+ \l__tasks_item_tl
+ [ l , b ] [ l , t ] ( 0pt , 0pt )
+ }
+ {
+ \__tasks_task:VVw
+ \l__tasks_tmp_label_tl
+ \l__tasks_item_tl
+ [ l , b ] [ l , t ] ( 0pt , 0pt )
+ \tl_clear:N \l__tasks_tmp_label_tl
+ }
+ }
+ }
+
+\cs_new:Npn \__tasks_read_item:w
+ {
+ \peek_meaning:NTF [
+ { \__tasks_read_item_aux:w }
+ { \__tasks_read_item_aux:w[] }
+ }
+
+\cs_new:Npn \__tasks_read_item_aux:w [#1]#2 \q_stop
+ {
+ \tl_if_blank:nF { #1 }
+ { \tl_set:Nn \l__tasks_tmp_label_tl { #1 } }
+ \tl_set:Nn \l__tasks_item_tl { \ignorespaces #2 }
+ }
+
+% 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:Npn \tasks_choice:
+ {
+ \leavevmode
+ \bool_set_false:N \l__tasks_choice_checked_bool
+ \box_move_up:nn
+ { \l__tasks_choice_raise_dim }
+ { \hbox:n { \__tasks_choice: } }
+ }
+
+\cs_new:Npn \tasks_choice_checked:
+ {
+ \leavevmode
+ \bool_set_true:N \l__tasks_choice_checked_bool
+ \box_move_up:nn
+ { \l__tasks_choice_raise_dim }
+ { \hbox:n { \__tasks_choice: } }
+ }
+
+\cs_new: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 }
+ {
+ style .tl_set:N = \l__tasks_instance_tl ,
+ label .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 ,
+ before-skip .skip_set:N = \l__tasks_before_list_skip ,
+ after-skip .skip_set:N = \l__tasks_after_list_skip ,
+ resume .bool_set:N = \l__tasks_resume_bool
+ }
+
+% the generic environment:
+\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 } }
+ \skip_vertical:N \l__tasks_before_list_skip
+ \skip_vertical:N \c_zero_skip
+ \list {}
+ {
+ \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
+ \skip_vertical:N \l__tasks_after_list_skip
+ }
+
+% 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 }
+
+% package options:
+\keys_define:nn { tasks / options }
+ {
+ more .bool_set:N = \l__tasks_load_tasks_bool
+ }
+
+\ProcessKeysOptions { tasks / options }
+
+\bool_if:NT \l__tasks_load_tasks_bool
+ {
+ \cs_if_exist:NF \tasks_config_file_loaded:
+ { \input { tasks.cfg } }
+ }
+
+\cs_new:Npn \tasks_setup:n #1
+ { \keys_set:nn { tasks / list } { #1 } }
+
+\NewDocumentCommand \settasks { m }
+ { \tasks_setup:n { #1 } }
+
+\tex_endinput:D \ No newline at end of file