summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/exsheets
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-12-04 00:08:31 +0000
committerKarl Berry <karl@freefriends.org>2012-12-04 00:08:31 +0000
commit58281f233aa382e37f0e840e29a978aa95cc3f85 (patch)
treeb9a8a7e78f41abbf0b65ed292aa4cd809f142568 /Master/texmf-dist/tex/latex/exsheets
parent8cd7ddbc358233e8754c1bbfe3e76f8d6d9adec5 (diff)
exsheets (3dec12)
git-svn-id: svn://tug.org/texlive/trunk@28436 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets')
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets.sty132
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg37
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def56
3 files changed, 180 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
index ac5272f23aa..4d3c3481917 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/11/08}
-\def\exsheets@version{0.4}
+\def\exsheets@date{2012/12/02}
+\def\exsheets@version{0.5}
\RequirePackage { expl3 , xparse }
\ProvidesExplPackage
@@ -151,6 +151,8 @@
\tl_new:N \l__exsheets_heading_instance_tl
\tl_set:Nn \l__exsheets_heading_instance_tl { block }
+\tl_new:N \l__exsheets_question_heading_instance_tl
+\tl_new:N \l__exsheets_solution_heading_instance_tl
\tl_new:N \l__exsheets_heading_title_user_format_tl
\tl_set:Nn \l__exsheets_heading_title_user_format_tl { \normalsize\bfseries }
\tl_new:N \l__exsheets_questions_toclevel_tl
@@ -807,13 +809,19 @@
\cs_new:Npn \IfInsideQuestionF
{ \bool_if:NF \l__exsheets_inside_question_bool }
+\cs_new_eq:NN \exsheets_par: \par
+
\NewEnviron { __exsheets_questions_internal: }
{
\csappto { BODY }
{
- \par
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_questions_skip_below_dim }
+ \cs_if_eq:NNTF \exsheets_par: \scan_stop:
+ { \c_space_tl }
+ {
+ \exsheets_par:
+ \dim_compare:nNnT { \parskip } = { 0pt }
+ { \exsheets_glue:N \l__exsheets_questions_skip_below_dim }
+ }
}
\bool_if:nT
{
@@ -828,10 +836,12 @@
}
\prop_new:N \g__exsheets_questions_id_prop
+\prop_new:N \g__exsheets_questions_meta_prop
\prop_new:N \g__exsheets_questions_used_prop
\int_new:N \g__exsheets_questions_used_int
\tl_new:N \l__exsheets_questions_id_tl
+\tl_new:N \l__exsheets_questions_meta_tl
\tl_new:N \g__exsheets_questions_current_id_tl
\tl_new:N \l__exsheets_title_tl
@@ -860,18 +870,6 @@
{ \bool_gset_true:N \g__exsheets_questions_use_bool }
% Optionen:
\IfNoValueF { #1 } { \keys_set:nn { exsheets / question } { #1 } }
- % Punktevergabe:
- \IfNoValueTF { #2 }
- {
- \__exsheets_read_points:n { 0 }
- \bool_if:NT \l__exsheets_points_questions_default_bool
- {
- \fp_set_eq:NN
- \l__exsheets_question_points_fp
- \l__exsheets_points_default_fp
- }
- }
- { \__exsheets_read_points:n { #2 } }
% ID:
\int_gincr:N \g__exsheets_questions_id_int
\tl_if_blank:VTF \l__exsheets_questions_id_tl
@@ -903,6 +901,36 @@
\tl_gset:Nx \g__exsheets_questions_current_id_tl
{ \tl_use:N \l__exsheets_questions_id_tl }
}
+ % Punktevergabe:
+ \IfNoValueTF { #2 }
+ {
+ \__exsheets_read_points:n { 0 }
+ \bool_if:NT \l__exsheets_points_questions_default_bool
+ {
+ \fp_set_eq:NN
+ \l__exsheets_question_points_fp
+ \l__exsheets_points_default_fp
+ \exp_args:Nx \SetQuestionProperties
+ { points = \fp_to_tl:N \l__exsheets_points_default_fp }
+ }
+ }
+ {
+ \__exsheets_read_points:n { #2 }
+ \SetQuestionProperties{points=#2}
+ }
+ \tl_if_blank:VT \l__exsheets_question_heading_instance_tl
+ {
+ \tl_set_eq:NN
+ \l__exsheets_question_heading_instance_tl
+ \l__exsheets_heading_instance_tl
+ }
+ % meta:
+ \tl_if_blank:VF \l__exsheets_questions_meta_tl
+ {
+ \prop_gput:NVV \g__exsheets_questions_meta_prop
+ \g__exsheets_questions_current_id_tl
+ \l__exsheets_questions_meta_tl
+ }
% Auswahl der Frage:
\__exsheets_select_question:V \g__exsheets_questions_current_id_tl
\bool_if:nT
@@ -946,7 +974,7 @@
{ \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 }
\__exsheets_use_heading:VVVnn
- \l__exsheets_heading_instance_tl
+ \l__exsheets_question_heading_instance_tl
\l__exsheets_title_tl
\l__exsheets_qu_counter_interpretation_tl
{ \l__exsheets_question_points_fp }
@@ -1092,6 +1120,8 @@
name .code:n =
\tl_set:Nn \l__exsheets_exsheets_name_tl { #1 }
\tl_set:Nn \l__exsheets_questions_name_tl { #1 } ,
+ headings .tl_set:N = \l__exsheets_question_heading_instance_tl ,
+ meta .tl_set:N = \l__exsheets_questions_meta_tl ,
print .bool_set:N = \l__exsheets_questions_print_bool ,
print .default:n = true ,
ID .tl_set:N = \l__exsheets_questions_id_tl ,
@@ -1128,6 +1158,8 @@
{ \exsheets_declare_question_property:n { #1 } }
\@onlypreamble\DeclareQuestionProperty
+\DeclareQuestionProperty{points}
+
\NewDocumentCommand \SetQuestionProperties { m }
{ \exsheets_set_question_properties:n { #1 } }
@@ -1209,6 +1241,8 @@
\NewDocumentCommand \DebugExSheets { G{true} }
{ \use:c { bool_set_#1:N } \l__exsheets_questions_debug_bool }
+\cs_new:Npn \CurrentQuestionID { \g__exsheets_questions_current_id_tl }
+
% ----------------------------------------------------------------------------
% include random/selected questions from a file:
\bool_new:N \l__exsheets_select_questions_bool
@@ -1266,7 +1300,7 @@
\prop_length:N \g__exsheets_selected_questions_prop \c_space_tl
questions.
}
- \par
+ \exsheets_par:
}
\bool_set_false:N \l__exsheets_questions_deactivate_bool
\__exsheets_select_question_random:n { ##1 }
@@ -1424,9 +1458,14 @@
\__exsheets_solutions_name:VV
\l__exsheets_qu_counter_interpretation_tl
\l__exsheets_solutions_name_tl
- \use:n { #1 } \par
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ \use:n { #1 }
+ \cs_if_eq:NNTF \exsheets_par: \scan_stop:
+ { \c_space_tl }
+ {
+ \exsheets_par:
+ \dim_compare:nNnT { \parskip } = { 0pt }
+ { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ }
}
}
\cs_generate_variant:Nn \prop_gput:Nnn { Nff,Nfx,Nfn,Nxx }
@@ -1455,6 +1494,12 @@
\bool_set_true:N \l__exsheets_inside_solution_bool
\IfNoValueF { #1 } { \keys_set:nn { exsheets / solution } { #1 } }
}
+ \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl
+ {
+ \tl_set_eq:NN
+ \l__exsheets_solution_heading_instance_tl
+ \l__exsheets_heading_instance_tl
+ }
\__exsheets_solution_internal:
}
{ \end__exsheets_solution_internal: }
@@ -1465,7 +1510,7 @@
\cs_new_nopar:Npn \__exsheets_solutions_name:nn #1#2
{
\__exsheets_use_heading:Vnnnn
- \l__exsheets_heading_instance_tl
+ \l__exsheets_solution_heading_instance_tl
{ #2 } { #1 } { 0 } { 0 }
}
\cs_generate_variant:Nn \__exsheets_solutions_name:nn { VV }
@@ -1574,9 +1619,14 @@
\exsheets_solutions_print_name:VV
\l__exsheets_current_pattern_tl
\l__exsheets_tmpa_tl
- \tl_use:N \l__exsheets_tmpb_tl \par
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ \tl_use:N \l__exsheets_tmpb_tl
+ \cs_if_eq:NNTF \exsheets_par: \scan_stop:
+ { \c_space_tl }
+ {
+ \exsheets_par:
+ \dim_compare:nNnT { \parskip } = { 0pt }
+ { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ }
}
}
@@ -1719,9 +1769,14 @@
\exsheets_solutions_print_name:VV
\l__exsheets_current_pattern_tl
\l__exsheets_tmpa_tl
- \tl_use:N \l__exsheets_tmpb_tl \par
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ \tl_use:N \l__exsheets_tmpb_tl
+ \cs_if_eq:NNTF \exsheets_par: \scan_stop:
+ { \c_space_tl }
+ {
+ \exsheets_par:
+ \dim_compare:nNnT { \parskip } = { 0pt }
+ { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ }
}
}
@@ -1767,9 +1822,14 @@
\exsheets_solutions_print_name:VV
\l__exsheets_current_pattern_tl
\l__exsheets_tmpa_tl
- \tl_use:N \l__exsheets_tmpb_tl \par
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ \tl_use:N \l__exsheets_tmpb_tl
+ \cs_if_eq:NNTF \exsheets_par: \scan_stop:
+ { \c_space_tl }
+ {
+ \exsheets_par:
+ \dim_compare:nNnT { \parskip } = { 0pt }
+ { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
+ }
}
}
}
@@ -1814,6 +1874,7 @@
\keys_define:nn { exsheets / solution }
{
+ headings .tl_set:N = \l__exsheets_solution_heading_instance_tl ,
print .choice: ,
print / true .code:n =
{
@@ -2051,6 +2112,7 @@
\DeclareTranslation { Spanish } { exsheets-exercise-name } { Ejercicio }
\DeclareTranslation { Catalan } { exsheets-exercise-name } { Exercir }
\DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz }
+ \DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer }
% translation for the question
\DeclareTranslation { English } { exsheets-question-name } { Question }
\DeclareTranslation { British } { exsheets-question-name } { Question }
@@ -2061,6 +2123,7 @@
\DeclareTranslation { Spanish } { exsheets-question-name } { Pregunta }
\DeclareTranslation { Catalan } { exsheets-question-name } { Q\"uesti\'o }
\DeclareTranslation { Turkish } { exsheets-question-name } { Soru }
+ \DeclareTranslation { Croatian } { exsheets-question-name } { Zadatak }
% translation for the solutions
\DeclareTranslation { English } { exsheets-solution-name } { Solution }
\DeclareTranslation { British } { exsheets-solution-name } { Solution }
@@ -2071,6 +2134,7 @@
\DeclareTranslation { Spanish } { exsheets-solution-name } { Soluci\'on }
\DeclareTranslation { Catalan } { exsheets-solution-name } { Soluci\'o }
\DeclareTranslation { Turkish } { exsheets-solution-name } { \c C\"oz\"um }
+ \DeclareTranslation { Croatian } { exsheets-solution-name } { Rje\v{s}enje }
% the actual translating
\tl_set:Nn \l__exsheets_exsheets_name_tl
{ \GetTranslation { exsheets-exercise-name } }
@@ -2172,7 +2236,11 @@ HISTORY:
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
+2012/12/02 v0.5 - added \CurrentQuestionID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
- points/decimal-marker, points/frac (?), points/format (?,im interface)
+- bug in {tasks} in {solution}: label werden nicht richtig upgedatet!
+- add possibility to choose different headings instances for questions and
+ solutions \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg
index 3ec2ae06bf5..5d195010c8b 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg
@@ -185,6 +185,43 @@
join = { main[r,vc]number[l,vc](0pt,0pt) }
}
+% INLINE
+\DeclareInstance { exsheets-heading } { inline } { default }
+ {
+ inline = true ,
+ number-pre-code = \c_space_tl ,
+ number-post-code = \c_space_tl ,
+ join =
+ {
+ main[r,vc] title[r,vc] (0pt,0pt) ;
+ main[r,vc] number[l,vc] (0pt,0pt)
+ }
+ }
+
+% INLINE, POINTS WITH THE TITLE
+\DeclareInstance { exsheets-heading } { inline-wp } { default }
+ {
+ inline = true ,
+ number-pre-code = \c_space_tl ,
+ number-post-code = \c_space_tl ,
+ points-pre-code = ( ,
+ points-post-code = ) \c_space_tl ,
+ join =
+ {
+ main[r,vc] title[r,vc] (0pt,0pt) ;
+ main[r,vc] number[l,vc] (0pt,0pt) ;
+ main[r,vc] points[l,vc] (0pt,0pt)
+ }
+ }
+
+% INLINE WITH NO TITLE:
+\DeclareInstance { exsheets-heading } { inline-nr } { default }
+ {
+ inline = true ,
+ number-post-code = \c_space_tl ,
+ join = { main[r,vc] number[l,vc] (0pt,0pt) }
+ }
+
% CENTERED:
\DeclareInstance { exsheets-heading } { centered } { default }
{
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
index 5e38802fe70..7c1637de0a5 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
@@ -42,9 +42,11 @@
\coffin_new:N \l__exsheets_heading_title_coffin
\coffin_new:N \l__exsheets_heading_number_coffin
\coffin_new:N \l__exsheets_heading_points_coffin
+\coffin_new:N \l__exsheets_heading_meta_coffin
-% the object varaibles:
+% the object variables:
\bool_new:N \l__exsheets_heading_runin_bool
+\bool_new:N \l__exsheets_heading_inline_bool
\bool_new:N \l__exsheets_heading_indent_first_bool
\bool_new:N \l__exsheets_heading_toc_reversed_bool
@@ -64,6 +66,9 @@
\tl_new:N \l__exsheets_heading_number_pre_code_tl
\tl_new:N \l__exsheets_heading_number_post_code_tl
+\tl_new:N \l__exsheets_heading_meta_pre_code_tl
+\tl_new:N \l__exsheets_heading_meta_post_code_tl
+
\tl_new:N \l__exsheets_heading_points_format_tl
\tl_new:N \l__exsheets_heading_points_pre_code_tl
\tl_new:N \l__exsheets_heading_points_post_code_tl
@@ -145,6 +150,7 @@
% the `default' template interface:
\DeclareTemplateInterface { exsheets-heading } { default } { 4 }
{
+ inline : boolean = false ,
runin : boolean = false ,
indent-first : boolean = false ,
toc-reversed : boolean = false ,
@@ -160,6 +166,8 @@
number-format : tokenlist = ,
number-pre-code : tokenlist = ,
number-post-code : tokenlist = ,
+ meta-pre-code : tokenlist = ,
+ meta-post-code : tokenlist = ,
points-format : tokenlist = ,
points-pre-code : tokenlist = ,
points-post-code : tokenlist = ,
@@ -170,6 +178,7 @@
% the `default' template code:
\DeclareTemplateCode { exsheets-heading } { default } { 4 }
{
+ inline = \l__exsheets_heading_inline_bool ,
runin = \l__exsheets_heading_runin_bool ,
indent-first = \l__exsheets_heading_indent_first_bool ,
toc-reversed = \l__exsheets_heading_toc_reversed_bool ,
@@ -185,6 +194,8 @@
number-format = \l__exsheets_heading_number_format_tl ,
number-pre-code = \l__exsheets_heading_number_pre_code_tl ,
number-post-code = \l__exsheets_heading_number_post_code_tl ,
+ meta-pre-code = \l__exsheets_heading_meta_pre_code_tl ,
+ meta-post-code = \l__exsheets_heading_meta_post_code_tl ,
points-format = \l__exsheets_heading_points_format_tl ,
points-pre-code = \l__exsheets_heading_points_pre_code_tl ,
points-post-code = \l__exsheets_heading_points_post_code_tl ,
@@ -193,6 +204,8 @@
}
{
\AssignTemplateKeys
+ \bool_if:NT \l__exsheets_heading_inline_bool
+ { \cs_set_eq:NN \exsheets_par: \scan_stop: }
\bool_if:nT
{ \l__exsheets_questions_totoc_bool && \l__exsheets_inside_question_bool }
{
@@ -201,7 +214,7 @@
{
\bool_if:NTF \l__exsheets_heading_toc_reversed_bool
{ #2 \ #1 }
- { #1\ #2 }
+ { #1 \ #2 }
}
}
\bool_if:nT
@@ -212,14 +225,15 @@
{
\bool_if:NTF \l__exsheets_heading_toc_reversed_bool
{ #2 \ #1 }
- { #1\ #2 }
+ { #1 \ #2 }
}
}
\seq_set_split:NnV \l__exsheets_heading_joined_coffins_seq { ; }
\l__exsheets_heading_joined_coffins_tl
\seq_set_split:NnV \l__exsheets_heading_attached_coffins_seq { ; }
\l__exsheets_heading_attached_coffins_tl
- \bool_if:NTF \l__exsheets_heading_runin_bool
+ \bool_if:nTF
+ { \l__exsheets_heading_runin_bool || \l__exsheets_heading_inline_bool }
{
\hcoffin_set:Nn \l__exsheets_heading_main_coffin
{
@@ -268,6 +282,17 @@
{ \tl_use:N \l__exsheets_heading_title_user_format_tl #2 }
\tl_use:N \l__exsheets_heading_number_post_code_tl
}
+ \hcoffin_set:Nn \l__exsheets_heading_meta_coffin
+ {
+ \prop_get:NoNT \g__exsheets_questions_meta_prop
+ { \g__exsheets_questions_current_id_tl }
+ \l__exsheets_questions_meta_tl
+ {
+ \tl_use:N \l__exsheets_heading_meta_pre_code_tl
+ \tl_use:N \l__exsheets_questions_meta_tl
+ \tl_use:N \l__exsheets_heading_meta_post_code_tl
+ }
+ }
\hcoffin_set:Nn \l__exsheets_heading_points_coffin
{
\bool_if:nF { \fp_compare_p:n { #3 = 0 } && \fp_compare_p:n { #4 = 0 } }
@@ -312,7 +337,8 @@
\tl_use:N \l__exsheets_heading_points_post_code_tl
}
}
- \bool_if:NF \l__exsheets_heading_runin_bool
+ \bool_if:nT
+ { !\l__exsheets_heading_runin_bool && !\l__exsheets_heading_inline_bool }
{
\coffin_resize:Nnn \l__exsheets_heading_main_coffin { \linewidth }
{
@@ -323,19 +349,23 @@
}
\__exsheets_join:N \l__exsheets_heading_joined_coffins_seq
\__exsheets_attach:N \l__exsheets_heading_attached_coffins_seq
- \skip_vertical:N \l__exsheets_heading_above_dim
- \exsheets_needspace:n
+ \bool_if:NF \l__exsheets_heading_inline_bool
{
- \coffin_ht:N \l__exsheets_heading_main_coffin +
- \coffin_dp:N \l__exsheets_heading_main_coffin +
- \l__exsheets_heading_below_dim +
- \baselineskip
+ \skip_vertical:N \l__exsheets_heading_above_dim
+ \exsheets_needspace:n
+ {
+ \coffin_ht:N \l__exsheets_heading_main_coffin +
+ \coffin_dp:N \l__exsheets_heading_main_coffin +
+ \l__exsheets_heading_below_dim +
+ \baselineskip
+ }
+ \noindent
}
\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
+ \bool_if:nT
+ { !\l__exsheets_heading_runin_bool && !\l__exsheets_heading_inline_bool }
{
\skip_vertical:N \l__exsheets_heading_below_dim
\dim_compare:nF { \parskip = 0pt }