summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/exsheets
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-11-08 23:07:27 +0000
committerKarl Berry <karl@freefriends.org>2012-11-08 23:07:27 +0000
commit2f4b454ae76e5151ecb060ba24f829d1234cd737 (patch)
tree228e42baa545520a5b29180c80255b632e5e92cc /Master/texmf-dist/tex/latex/exsheets
parent136f39c4716d4adccfd552ba03e269e58b8d7a69 (diff)
exsheets (8nov12)
git-svn-id: svn://tug.org/texlive/trunk@28212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets')
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/cntformats.sty6
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets.sty38
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def10
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def134
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/translations.sty4
5 files changed, 117 insertions, 75 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
index df81ccb7c1b..84f599f41dc 100644
--- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
@@ -29,11 +29,11 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-\def\cntfmts@date{2012/10/23}
-\def\cntfmts@version{v0.3}
+\def\cntfmts@date{2012/11/08}
+\def\cntfmts@version{v0.4}
\ProvidesPackage{cntformats}[\cntfmts@date\space \cntfmts@version\space A different way to read counters.]
-\RequirePackage{etoolbox,xparse}
+\RequirePackage{etoolbox}
% --------------------------------------------------------------------------
% message handling
\def\@cntfmts@error@message{%
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
index 54c803127f2..ac5272f23aa 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{2012/10/23}
-\def\exsheets@version{0.3}
+\def\exsheets@date{2012/11/08}
+\def\exsheets@version{0.4}
\RequirePackage { expl3 , xparse }
\ProvidesExplPackage
@@ -809,7 +809,6 @@
\NewEnviron { __exsheets_questions_internal: }
{
- \cspreto { BODY } { \ifhmode \vspace*{0pt} \fi }
\csappto { BODY }
{
\par
@@ -1059,10 +1058,7 @@
% title of a question:
\input { exsheets_headings.def }
\bool_if:NT \l__exsheets_load_headings_bool
- {
- \RequirePackage { amssymb }
- \input { exsheets_headings.cfg }
- }
+ { \input { exsheets_headings.cfg } }
% #1: instance
% #2: title
% #3: number
@@ -1440,7 +1436,7 @@
{
\bool_if:nT { \g__exsheets_questions_use_bool && \l__exsheets_solutions_use_bool }
{
- \cspreto { BODY } { \ifhmode \fi }% what's that good for?
+% \cspreto { BODY } { \ifhmode \fi }% what's that good for?
\__exsheets_save_solution:V \BODY
}
}
@@ -1884,6 +1880,8 @@
\dim_new:N \l__exsheets_blank_dim
\tl_new:N \l__exsheets_blank_linespread_tl
\tl_set:Nn \l__exsheets_blank_linespread_tl { 1 }
+\tl_new:N \l__exsheets_blank_scale_tl
+\tl_set:Nn \l__exsheets_blank_scale_tl { 1 }
\box_new:N \l__exsheets_blank_box
\bool_new:N \l__exsheets_blank_width_bool
\bool_new:N \l__exsheets_blank_linespread_bool
@@ -1904,6 +1902,7 @@
{ \cs_set_eq:NN \exsheets_write_blank:n \dotuline } ,
style / dashed .code:n =
{ \cs_set_eq:NN \exsheets_write_blank:n \dashuline } ,
+ scale .tl_set:N = \l__exsheets_blank_scale_tl ,
width .code:n =
{
\bool_set_true:N \l__exsheets_blank_width_bool
@@ -1942,13 +1941,22 @@
{
\bool_if:NTF \l__exsheets_blank_width_bool
{ \__exsheets_blank_skip:N \l__exsheets_blank_dim }
- { \__exsheets_blank_skip:n { \box_wd:N \l__exsheets_blank_box } }
+ {
+ \__exsheets_blank_skip:n
+ { \box_wd:N \l__exsheets_blank_box }
+ }
}
}
\cs_new:Npn \__exsheets_blank_skip:N #1
{
- \dim_set:Nn \l__exsheets_tmpa_dim { #1 }
+ \bool_if:NTF \l__exsheets_blank_width_bool
+ { \dim_set:Nn \l__exsheets_tmpa_dim { #1 } }
+ {
+ \fp_set:Nn \l_tmpa_fp { \dim_to_fp:n { #1 } }
+ \fp_mul:Nn \l_tmpa_fp { \l__exsheets_blank_scale_tl }
+ \dim_set:Nn \l__exsheets_tmpa_dim { \fp_to_dim:N \l_tmpa_fp }
+ }
\dim_compare:nTF { \l__exsheets_tmpa_dim > 2em }
{
\exsheets_write_blank:n { \skip_horizontal:n { 1em } }
@@ -2155,8 +2163,16 @@ HISTORY:
2012/10/23 v0.3 - bugfix in \exref
- new: \NewQuSolPair, \RenewQuSolPair, \examspace
+2012/10/24 v0.3a - fix of headings when followed by a list
+ - changed syntax of {tasks} list to resemble the real
+ lists like enumerate
+2012/10/26 v0.3b - small fix to the {tasks} environment, \NewTasks,
+ \RenewTasks, resolve stupid bug:
+ \ckeckedchoicebox => \checkedchoicebox
+2012/11/08 v0.4 - compatibility with KOMA-Script's `parskip' option:
+ now no unwanted skip and no overfull hbox is produced
+ - env {task} now supports inner environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
- points/decimal-marker, points/frac (?), points/format (?,im interface)
-- grading table? Should not be necessary...? Access via meta-data
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
index c5e9eeebe4d..5e38802fe70 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
@@ -278,7 +278,6 @@
\group_end:
\tl_use:N \l__exsheets_heading_points_pre_code_tl
{
- % TODO: \l__exsheets_points_separate_bonus_bool beachten
\fp_compare:nF { #3 = 0 }
{
\bool_if:nTF
@@ -315,7 +314,7 @@
}
\bool_if:NF \l__exsheets_heading_runin_bool
{
- \coffin_resize:Nnn \l__exsheets_heading_main_coffin { \linewidth }
+ \coffin_resize:Nnn \l__exsheets_heading_main_coffin { \linewidth }
{
\fp_to_decimal:N \l__exsheets_heading_scale_fp
\coffin_ht:N \l__exsheets_heading_main_coffin +
@@ -332,13 +331,18 @@
\l__exsheets_heading_below_dim +
\baselineskip
}
+ \skip_set:Nn \parfillskip { 0pt plus 1fil }
\noindent
\coffin_typeset:Nnnnn \l__exsheets_heading_main_coffin
{ H } { l } { 0pt }{ 0pt }
\bool_if:NF \l__exsheets_heading_runin_bool
{
\skip_vertical:N \l__exsheets_heading_below_dim
- \bool_if:NF \l__exsheets_heading_indent_first_bool { \noindent }
+ \dim_compare:nF { \parskip = 0pt }
+ { \skip_vertical:n { -\parskip } }
+ \bool_if:NTF \l__exsheets_heading_indent_first_bool
+ { \@afterheading }
+ { \@afterindentfalse\@afterheading }
}
}
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def
index 8ff8c581753..3d36f2a435c 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def
@@ -40,28 +40,26 @@
% variables:
\seq_new:N \l__exsheets_tasks_seq
\int_new:N \l__exsheets_tasks_depth_int
-\int_new:N \l__exsheets_tasks_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_after_item_skip_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_set:Nn \l__exsheets_tasks_before_list_skip { .33\baselineskip }
\skip_new:N \l__exsheets_tasks_after_list_skip
-\skip_new:N \l__exsheets_tasks_after_list_default_skip
-\skip_set:Nn \l__exsheets_tasks_after_list_default_skip { .33\baselineskip }
\NewCounterPattern* [ exsheets ] { task } { tsk }
-\ReadCounterFrom [ exsheets ] { task } \l__exsheets_tasks_int
+\ReadCounterFrom [ exsheets ] { task } \g__exsheets_tasks_int
% scratch coffins:
\cs_if_exist:NF \l__exsheets_tmpa_coffin { \coffin_new:N \l__exsheets_tmpa_coffin }
@@ -69,18 +67,25 @@
\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: environment body
-\cs_new:Npn \__exsheets_tasks:nnw #1#2#3 \end
+% #3: item separator
+% #4: environment body
+\cs_new:Npn \__exsheets_tasks:nnnn #1#2#3#4
{
- \par \addvspace { \l__exsheets_tasks_before_list_skip }
- \seq_set_split:Nnn \l__exsheets_tasks_seq { ; } { #3 }
- % remove the last (empty) item:
- \seq_pop_right:NN \l__exsheets_tasks_seq \l__exsheets_tmpa_tl
+ \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
- { % TODO ERROR
- }
+ { \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 }
@@ -89,18 +94,15 @@
{ \l__exsheets_tasks_custom_label_format_tl }
% just to be sure:
\seq_clear:N \l__exsheets_tasks_seq
- \par \skip_vertical:N \l__exsheets_tasks_after_list_skip
- % we gobbled this from the input stream, let's put it back:
- \end
}
-\cs_generate_variant:Nn \__exsheets_tasks:nnw { V }
+\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
+ \l__exsheets_tasks_depth_int \l__exsheets_tasks_item_indent_dim
}
\int_incr:N \l__exsheets_tmpa_int
\__exsheets_tasks_set_rows_num:NN
@@ -124,12 +126,13 @@
\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 } { \par\noindent }
+ \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_dim }
+ { \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
@@ -139,7 +142,7 @@
\cs_new:Npn \__exsheets_tasks_setup:
{
\dim_set:Nn \parskip { 0pt }
- \noindent
+ \skip_set:Nn \parfillskip { 0pt plus 1fil }
\dim_set_eq:NN \parskip \parsep
\dim_set_eq:NN \parindent \listparindent
\strut
@@ -165,7 +168,7 @@
indent : length = 2.5em ,
label-format : tokenlist = tsk[a]) ,
label-width : length = 3ex ,
- after-item-skip : length = 2ex
+ after-item-skip : skip = 1ex plus 1ex minus 1ex
}
% the `default' template code:
\DeclareTemplateCode { exsheets-tasks } { default } { 3 }
@@ -175,15 +178,10 @@
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_dim
+ after-item-skip = \l__exsheets_tasks_after_item_skip
}
{
\AssignTemplateKeys
- \skip_set:Nn \l__exsheets_tasks_after_list_skip
- {
- \l__exsheets_tasks_after_list_default_skip -
- \l__exsheets_tasks_after_item_skip_dim
- }
\dim_compare:nT { \l__exsheets_tasks_label_width_dim = 0pt }
{
\dim_set_eq:NN
@@ -191,7 +189,8 @@
\l__exsheets_tasks_default_label_width_dim
}
% need this for enumerate list:
- \int_zero:N \l__exsheets_tasks_int
+ \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
@@ -203,10 +202,10 @@
}
\seq_map_inline:Nn \l__exsheets_tasks_seq
{
- \__exsheets_read_item:w ##1\task{}{}\q_stop
+ \__exsheets_read_item:w ##1 \q_stop
\bool_if:NTF \l__exsheets_tasks_enumerate_bool
{
- \int_incr:N \l__exsheets_tasks_int
+ \int_gincr:N \g__exsheets_tasks_int
\tl_if_blank:VT \l__exsheets_tasks_label_tl
{
\tl_set:Nn \l__exsheets_tasks_label_tl
@@ -241,17 +240,18 @@
\tl_new:N \l__exsheets_tasks_item_tl
\tl_new:N \l__exsheets_tasks_tmp_label_tl
-\cs_new:Npn \__exsheets_read_item:w #1 \task #2#3 \q_stop
+\cs_new:Npn \__exsheets_read_item:w
{
- \tl_set:Nn \l__exsheets_tmpa_tl { #1 }
- \tl_set:Nn \l__exsheets_tmpb_tl { #2 }
- \tl_set:Nn \l__exsheets_tmpc_tl { #3 }
- \tl_if_blank:VTF \l__exsheets_tmpa_tl
- {
- \tl_set_eq:NN \l__exsheets_tasks_item_tl \l__exsheets_tmpc_tl
- \tl_set_eq:NN \l__exsheets_tasks_tmp_label_tl \l__exsheets_tmpb_tl
- }
- { \tl_set_eq:NN \l__exsheets_tasks_item_tl \l__exsheets_tmpa_tl }
+ \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:
@@ -298,10 +298,8 @@
\end{picture}%
}
-\cs_if_exist:NF \choicebox
- { \cs_new:Npn \choicebox { \exsheets_choice: } }
-\cs_if_exist:NF \ckeckedchoicebox
- { \cs_new:Npn \ckeckedchoicebox { \exsheets_choice_checked: } }
+\providecommand* \choicebox { \exsheets_choice: }
+\providecommand* \checkedchoicebox { \exsheets_choice_checked: }
% base instance:
% ALPHABETIZE: a) b) c)
@@ -313,22 +311,46 @@
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
+ after-skip .skip_set:N = \l__exsheets_tasks_after_list_skip ,
+ resume .bool_set:N = \l__exsheets_tasks_resume_bool
}
-% the user environment:
-\NewDocumentEnvironment { tasks } { oG{1} }
+% the generic environment:
+\NewEnviron { __exsheets_tasks_env: } [ 3 ]
{
- \IfNoValueTF { #1 }
+ \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 {}
{
- \keys_set:nn { exsheets / tasks } { #1 }
- \tl_if_blank:VT \l__exsheets_tasks_instance_tl
- { \keys_set:nn { exsheets / tasks } { style = alphabetize } }
+ \dim_set:Nn \leftmargin { 0pt }
+ \dim_set:Nn \rightmargin { 0pt }
}
+ \item \scan_stop:
\int_incr:N \l__exsheets_tasks_depth_int
- \__exsheets_tasks:Vnw \l__exsheets_tasks_instance_tl { #2 }
+ \__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: }
}
- { }
-\tex_endinput:D \ No newline at end of file
+\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/translations.sty b/Master/texmf-dist/tex/latex/exsheets/translations.sty
index feb1ff1d369..5164acaf08c 100644
--- a/Master/texmf-dist/tex/latex/exsheets/translations.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/translations.sty
@@ -29,8 +29,8 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-\def\@trnslt@date{2012/10/23}
-\def\@trnslt@version{v0.3}
+\def\@trnslt@date{2012/11/08}
+\def\@trnslt@version{v0.4}
\ProvidesPackage{translations}[\@trnslt@date\space \@trnslt@version\space a simple translator]
\RequirePackage{etoolbox}