summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-11-19 22:42:11 +0000
committerKarl Berry <karl@freefriends.org>2015-11-19 22:42:11 +0000
commit197d2563d3d5a70465f9b6f942cfc1b9afd8d771 (patch)
tree6e0a59e2995dd9e1c0c57026626364cbe308ca98
parent7b703227755f59f6d8e6aa04eedefe0b86e20cc3 (diff)
exsheets (18nov15)
git-svn-id: svn://tug.org/texlive/trunk@38898 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/exsheets/README6
-rw-r--r--Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdfbin682240 -> 684443 bytes
-rw-r--r--Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex59
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty6
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets.sty244
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def149
6 files changed, 308 insertions, 156 deletions
diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README
index c3671a498ee..3953b46a0a7 100644
--- a/Master/texmf-dist/doc/latex/exsheets/README
+++ b/Master/texmf-dist/doc/latex/exsheets/README
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------
-EXSHEETS 2015/07/04
+EXSHEETS 2015/11/18
bundled packages:
-the EXSHEETS package v0.19
+the EXSHEETS package v0.20
Yet another package for the creation of exercise sheets
-the EXSHEETS-LISTINGS package v0.19
+the EXSHEETS-LISTINGS package v0.20
Using listings in exsheets
--------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf
index 41a36943031..37ccf2c720c 100644
--- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf
+++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex
index 442df6ef252..5c88bad6151 100644
--- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex
+++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex
@@ -1028,10 +1028,10 @@ possibilities.
In the next subsections the usage of the following command is discussed.
\begin{commands}
\command{printsolutions}[\oarg{setting}]
- Print solutions of questions(exercises.
+ Print solutions of questions/exercises.
\end{commands}
-Before we do that a hint: remember that you can set the option \key{print}
+Before we do that a hint: remember that you can set the option \option{print}
globally:
\begin{sourcecode}
% in the preamble
@@ -1042,14 +1042,20 @@ Now if you want to typeset some text depending on the option being true or not
you can use the following commands:
\begin{commands}
\expandable\command{PrintSolutionsTF}[\marg{true code}\marg{false code}]
- Checks if inside of a \env{solution} environment and either leaves the
- \meta{true code} or the \meta{false code} in the input stream.
+ Either leaves \meta{true code} or \meta{false code} in the input stream
+ depending on wether solutions are printed or not, \ie, on the value of the
+ solution's option \option{print}. Inside a \env{solution} environment
+ this always prints \meta{true code}.
\expandable\command{PrintSolutionsT}[\marg{true code}]
- Checks if inside of a \env{solution} environment and either leaves the
- \meta{true code} in the input stream if yes.
+ Either leaves \meta{true code} or nothing in the input stream depending on
+ wether solutions are printed or not, \ie, on the value of the solution's
+ option \option{print}. Inside a \env{solution} environment this always
+ prints \meta{true code}.
\expandable\command{PrintSolutionsF}[\marg{false code}]
- Checks if inside of a \env{solution} environment and either leaves the
- \meta{false code} in the input stream if not.
+ Either leaves nothing or \meta{false code} in the input stream depending
+ on wether solutions are printed or not, \ie, on the value of the
+ solution's option \option{print}. Inside a \env{solution}environment this
+ always prints nothing.
\end{commands}
They might come in handy if you want two versions of an exercise sheet, one
with the exercises and one with the solutions, and you want to add different
@@ -1221,7 +1227,7 @@ the order given you can use the option
Sort solutions given by \acs{id} or don't.
\end{options}
-\section{Dividing Questions into Classes}\label{sec:dividing-concepts}
+\section{Conditional Printing of Questions}\label{sec:cond-print-quest}
\subsection{Using Classes}\label{sec:classes}
For creating different variants of a written exam or different difficulty
levels of an exercise sheet it comes in handy if one can assign certain
@@ -1348,6 +1354,22 @@ say. This is possible with the following commands:
\bool_set_false:N \g__exsheets_use_difficulties_bool
\ExplSyntaxOff
+\subsection{Tagging Questions}
+There\sinceversion{0.20} is another way of dividing questions: you can assign
+tags to questions:
+\begin{sourcecode}
+ \begin{question}[tags={foo,bar,baz}]
+ ...
+ \end{question}
+\end{sourcecode}
+You can then decide to print only questions with certain tags by using the
+following option:
+\begin{options}
+ \keyval{use-tags}{csv list of tags to include}
+ Select tags. When used only questions being tagged with at least one of
+ the tags in \meta{csv list of tags to include} are printed.
+\end{options}
+
\section{Adding and Using Additional Information to
Questions}\label{sec:additional_info}
\subsection{Question Properties -- the Basics}
@@ -1442,7 +1464,7 @@ It is now possible to recover these values later:
\end{example}
Please note that properties \emph{are not the same} as the dividing concepts
-explained in section~\ref{sec:dividing-concepts} although they may seem
+explained in section~\ref{sec:cond-print-quest} although they may seem
similar in meaning or even have the same name.
When properties are set they are also written to the \code{aux} file which
@@ -1697,7 +1719,7 @@ following commands for control:
\end{commands}
The selection can be refined further by selecting questions belonging to a
-specific class of questions (see section~\ref{sec:dividing-concepts}) before
+specific class of questions (see section~\ref{sec:cond-print-quest}) before
using \cs{includequestions}.
\sinceversion{0.8}After you've used \cs{includequestions} the \acp{id} of the
@@ -1852,7 +1874,7 @@ The \ExSheets\ package makes extensive use of \LaTeX3's coffins\footnote{See
documentation to the \pkg{xtemplate} package.}. The latter allows a
rather easy extension and customization of some of \ExSheets' environments.
To be more precise: you can define your own instances for the headings used
-for questions and solutions and for the \env{tasks} environment.
+for questions and solutions.
What this package doesn't provide is changing the background of questions or
framing them. But this is easily possible using the \pkg{mdframed} package
@@ -1869,7 +1891,7 @@ the solution environment. With them it is rather straightforward to add a
}
\end{sourcecode}
-Last\sinceversion{0.18} but not least there is the macro
+Then\sinceversion{0.18} there is the macro
\cs{exsheetsprintsolution}\marg{heading}\marg{body}\label{exsheetsprintsolution}
which may be redefined to suit your needs. The default definition is
equivalent to
@@ -1957,6 +1979,13 @@ handle pairs.
\caption{Available handles for a horizontal coffin.}\label{fig:handles}
\end{figure}
+It is possible\sinceversion{0.20} to add own static coffins:
+\begin{commands}
+ \command{DeclareExSheetsHeadingContainer}[\marg{name}\marg{code}]
+ Defines a new coffin \meta{name} containing \meta{code}. You can refer to
+ the current question's \ac{id} with \cs{CurrentQuestionID}.
+\end{commands}
+
The following subsections will show all definitions of the instances available
and how they look. This will hopefully give you enough ideas to create your
own instance if you want to have another heading style than the ones
@@ -2511,7 +2540,7 @@ this by writing the listing to a unique auxiliary file --
questions to \code{\cs*{jobname}-ex\meta{num}.lst} and solutions to
\code{\cs*{jobname}-sol\meta{num}.lst} where \meta{num} is an increasing
integer that ensures that each listing gets a unique file name. Those files
-are then included with \cs{lstinutlisting} if and when the question or
+are then included with \cs{lstinputlisting} if and when the question or
solution is printed.
\begin{environments}
@@ -2532,7 +2561,7 @@ loaded already.
% this uses my listings style used in this documentation for all pieces of
% code:
\begin{lstquestion}[%
- pre=Explain what this piece of \LaTeX\ code does:,
+ pre=Explain what this piece of \TeX\ code does:,
listings={style=cnltx}]
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname foo\endcsname\relax
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty
index 279178c075c..81a504ca6b8 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty
@@ -50,7 +50,7 @@
% ----------------------------------------------------------------------------
% listings style for questions and solutions:
-\keys_define:nn { exsheets }
+\keys_define:nn {exsheets}
{
question / listings .tl_set:N = \l__exsheets_listings_question_code_tl ,
solution / listings .tl_set:N = \l__exsheets_listings_solution_code_tl
@@ -92,7 +92,7 @@
\keys_set:nn {exsheets/listings/question} {#1,#4,##1}
\int_gincr:N \g__exsheets_listings_question_int
\lst@BeginWriteFile
- { \c_job_name_tl - ex \int_use:N\g__exsheets_listings_question_int .lst }
+ { \c_job_name_tl - ex \int_use:N \g__exsheets_listings_question_int . lst }
}
{
\lst@EndWriteFile
@@ -104,7 +104,7 @@
\exp_not:V \l__exsheets_listings_question_pre_tl
\exp_not:N \lstinputlisting
[ \exp_not:V \l__exsheets_listings_question_code_tl ]
- { \c_job_name_tl - ex \int_use:N\g__exsheets_listings_question_int .lst }
+ { \c_job_name_tl - ex \int_use:N \g__exsheets_listings_question_int . lst }
\exp_not:V \l__exsheets_listings_question_post_tl
}
\end {#3}
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
index 7e7c5e86aad..4ee87c0109a 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
@@ -5,7 +5,7 @@
%
% ----------------------------------------------------------------------------
% Clemens Niederberger
-% Web: https://bitbucket.org/cgnieder/exsheets/
+% Web: http://www.mychemistry.eu/forums/forum/exsheets
% E-Mail: contact@mychemistry.eu
% ----------------------------------------------------------------------------
% Copyright 2011-2015 Clemens Niederberger
@@ -25,8 +25,8 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% ----------------------------------------------------------------------------
-\def\exsheets@date{2015/07/04}
-\def\exsheets@version{0.19}
+\def\exsheets@date{2015/11/18}
+\def\exsheets@version{0.20}
\RequirePackage { expl3 , xparse }
\ProvidesExplPackage
@@ -37,13 +37,15 @@
% ----------------------------------------------------------------------------
% variants of kernel functions:
-\cs_generate_variant:Nn \prop_get:NnN { Nx , cf }
+\cs_generate_variant:Nn \prop_get:NnN { NV , Nx , cV , cf }
\cs_generate_variant:Nn \prop_get:NnNTF { Nx }
\cs_generate_variant:Nn \prop_gput:Nnn { Nf , Nff , Nfx , Nx , Nxx , NxV , cf , cff }
\cs_generate_variant:Nn \prop_gput_if_new:Nnn { Nxx }
\cs_generate_variant:Nn \tl_if_blank:nTF { x }
\cs_generate_variant:Nn \tl_if_eq:nnF { x }
\cs_generate_variant:Nn \int_to_arabic:n { V }
+\cs_generate_variant:Nn \seq_set_split:Nnn { NnV }
+\cs_generate_variant:Nn \quark_if_no_value:nTF { V }
% ----------------------------------------------------------------------------
% temporary variables
@@ -107,8 +109,7 @@
\msg_new:nnn {exsheets} {deprecated-command}
{
- The~ command~ `~ \token_to_str:N #1 \c_space_tl'~ is~ deprecated.~
- Use~ `~ \token_to_str:N #2 \c_space_tl'~ instead.
+ The~ command~ `#1'~ is~ deprecated.~ Use~ `#2'~ instead.
}
\msg_new:nnn {exsheets} {dropped-option}
@@ -135,10 +136,17 @@
`#2'~ hence~ I'm~ doing~ nothing.
}
-\cs_new_protected:Npn \exsheets_depr_cmd:nn #1#2
+\cs_new_protected:Npn \exsheets_deprecate_cs:Npnn #1#2#
+ { \__exsheets_deprecate_cs:Nnnn #1 {#2} }
+\cs_new_protected:Npn \__exsheets_deprecate_cs:Nnnn #1#2#3#4
{
- \cs_new_protected:Npn #1
- { \msg_warning:nnnn {exsheets} { deprecated-command } {#1} {#2} #2 }
+ \cs_new_protected:Npn #1 #2
+ {
+ \tl_if_blank:nTF {#3}
+ { \msg_warning:nnnn {exsheets} { deprecated-command } {#1} {#4} }
+ { \msg_warning:nnnn {exsheets} { deprecated-command } {#1} {#3} }
+ #4
+ }
}
\cs_new_protected:Npn \exsheets_option_dropped:n #1
@@ -401,7 +409,7 @@
\cs_generate_variant:Nn \exsheets_parse_bonus:n { V }
\cs_new:Npn \exsheets_num:n #1
- { \fp_to_tl:n {#1} }
+ { \fp_to_decimal:n {#1} }
\cs_generate_variant:Nn \exsheets_num:n { V,x }
\cs_new:Npn \__exsheets_print_points_name:nNN #1#2#3
@@ -571,7 +579,7 @@
\group_end:
}
-\exsheets_depr_cmd:nn { \sumpoints } { \totalpoints* }
+\exsheets_deprecate_cs:Npnn \sumpoints {} { \totalpoints* }
\cs_new_protected:Npn \exsheets_totalpoints:
{
@@ -810,7 +818,7 @@
\cs_new:Npn \exsheets_glue:N #1
{ \cleaders \vbox:n {} \skip_vertical:N #1 }
-% Einteilung in Klassen, Themen und andere Gruppierungen:
+% classes, topics and other group concepts:
\prop_new:N \l__exsheets_class_prop
\tl_new:N \g__exsheets_use_current_question_tl
\bool_new:N \l__exsheets_use_this_question_bool
@@ -891,14 +899,17 @@
{
% is the question to this solution an active one?
% get question number from ID
- \prop_get:NoN \g__exsheets_questions_id_prop
- { \g__exsheets_questions_current_id_tl } \l__exsheets_tmpa_tl
+ \prop_get:NVN \g__exsheets_questions_id_prop
+ \g__exsheets_questions_current_id_tl
+ \l__exsheets_tmpa_tl
% get question #1 from number
- \prop_get:coN { g__exsheets_questions_#1_prop }
- { \l__exsheets_tmpa_tl } \l__exsheets_tmpb_tl
+ \prop_get:cVN { g__exsheets_questions_#1_prop }
+ \l__exsheets_tmpa_tl
+ \l__exsheets_tmpb_tl
% test if #1 is active
- \prop_get:coN { g__exsheets_#2_active_prop }
- { \l__exsheets_tmpb_tl } \l__exsheets_tmpc_tl
+ \prop_get:cVN { g__exsheets_#2_active_prop }
+ \l__exsheets_tmpb_tl
+ \l__exsheets_tmpc_tl
\tl_if_eq:NNT \l__exsheets_tmpc_tl \q_no_value
{ \bool_set_false:N \l__exsheets_solutions_use_bool }
}
@@ -916,49 +927,103 @@
{ \exsheets_declare_question_class:nn {#1} {#2} }
\@onlypreamble \DeclareQuestionClass
+% #1: class name
\cs_new:Npn \exsheets_get_question_class:n #1
{
\cs_if_exist:cT { l__exsheets_questions_#1_tl }
{ \tl_use:c { l__exsheets_questions_#1_tl } }
}
+% #1: class name
\DeclareExpandableDocumentCommand \GetQuestionClass { m }
{ \exsheets_get_question_class:n {#1} }
+% #1: class name
+\prg_new_conditional:Npnn \exsheets_if_question_class:n #1 {T,F,TF}
+ {
+ \tl_if_blank:fTF { \exsheets_get_question_class:n {#1} }
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+\cs_generate_variant:Nn \tl_if_blank:nTF {f}
+
+% #1: class name
\cs_new_protected:Npn \exsheets_print_question_class:nTF #1#2#3
{
- \group_begin:
- \tl_set:Nx \l__exsheets_tmpa_tl
- { \exsheets_get_question_class:n {#1} }
- \tl_if_blank:VTF \l__exsheets_tmpa_tl
- {#3}
- {
- \cs_set_protected:Npn \__exsheets_print_question_class:n ##1 {#2}
- \__exsheets_print_question_class:n
- { \exsheets_get_question_class:n {#1} }
- }
- \group_end:
+ \exsheets_if_question_class:nTF {#1}
+ {
+ \cs_set_protected:Npn \__exsheets_print_question_class:n ##1 {#2}
+ \__exsheets_print_question_class:n
+ { \exsheets_get_question_class:n {#1} }
+ }
+ {#3}
}
+
\NewDocumentCommand \PrintQuestionClassTF { mmm }
{ \exsheets_print_question_class:nTF {#1} {#2} {#3} }
\NewDocumentCommand \PrintQuestionClassT { mm }
- { \exsheets_print_question_class:nTF {#1} {#2} { } }
+ { \exsheets_print_question_class:nTF {#1} {#2} { } }
\NewDocumentCommand \PrintQuestionClassF { mm }
- { \exsheets_print_question_class:nTF {#1} { } {#2} }
+ { \exsheets_print_question_class:nTF {#1} { } {#2} }
+
+% ----------------------------------------------------------------------------
+% question tags:
+\prop_new:N \g__exsheets_tags_prop
+\seq_new:N \l__exsheets_use_tags_seq
+
+% #1: ID
+% #2: tags
+\cs_new_protected:Npn \exsheets_set_question_tags:nn #1#2
+ { \prop_gput:Nnn \g__exsheets_tags_prop {#1} {#2} }
+\cs_generate_variant:Nn \exsheets_set_question_tags:nn {V}
+
+\cs_new_protected:Npn \exsheets_set_this_question_tags:n #1
+ { \exsheets_set_question_tags:Vn \g__exsheets_questions_current_id_tl {#1} }
+
+\keys_define:nn {exsheets}
+ {
+ use-tags .code:n = \seq_set_split:Nnn \l__exsheets_use_tags_seq {,} {#1} ,
+ question / tags .code:n =
+ \exsheets_after_begin_question:n { \exsheets_set_this_question_tags:n {#1} }
+ }
+
+% #1: ID
+\prg_new_protected_conditional:Npnn \exsheets_check_question_tags:n #1 {T,F,TF}
+ {
+ \bool_set_false:N \l__exsheets_tmpa_bool
+ \seq_if_empty:NTF \l__exsheets_use_tags_seq
+ { \bool_set_true:N \l__exsheets_tmpa_bool }
+ {
+ \prop_get:NnN \g__exsheets_tags_prop {#1} \l__exsheets_tmpa_tl
+ \seq_map_inline:Nn \l__exsheets_use_tags_seq
+ {
+ \tl_if_in:NnT \l__exsheets_tmpa_tl {##1}
+ {
+ \bool_set_true:N \l__exsheets_tmpa_bool
+ \seq_map_break:
+ }
+ }
+ }
+ \bool_if:NTF \l__exsheets_tmpa_bool
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+\cs_generate_variant:Nn \exsheets_check_question_tags:nF {V}
% ----------------------------------------------------------------------------
% die 'question' Umgebung
-\tl_new:N \l__exsheets_questions_name_tl
-\tl_set:Nn \l__exsheets_questions_name_tl { Question }
-\tl_new:N \l__exsheets_exercise_name_tl
-\tl_set:Nn \l__exsheets_exercise_name_tl { Exercise }
+\tl_new:N \l__exsheets_questions_name_tl
+\tl_set:Nn \l__exsheets_questions_name_tl {Question}
+\tl_new:N \l__exsheets_exercise_name_tl
+\tl_set:Nn \l__exsheets_exercise_name_tl {Exercise}
-\tl_new:N \l__exsheets_questions_pre_hook_tl
-\tl_new:N \l__exsheets_questions_post_hook_tl
-\tl_new:N \l__exsheets_questions_pre_body_hook_tl
-\tl_new:N \l__exsheets_questions_post_body_hook_tl
+\tl_new:N \l__exsheets_questions_pre_hook_tl
+\tl_new:N \l__exsheets_questions_post_hook_tl
+\tl_new:N \l__exsheets_questions_pre_body_hook_tl
+\tl_new:N \l__exsheets_questions_post_body_hook_tl
+\tl_new:N \l__exsheets_after_begin_question_tl
-\tl_new:N \CurrentQuestionID
+\tl_new:N \CurrentQuestionID
\bool_new:N \l__exsheets_questions_print_bool
\bool_set_true:N \l__exsheets_questions_print_bool
@@ -976,15 +1041,17 @@
\cs_new_eq:NN \exsheets_par: \par
-\cs_new:Npn \exsheets_h_or_vspace:N #1
+\cs_new_protected:Npn \exsheets_after_begin_question:n #1
+ { \tl_put_right:Nn \l__exsheets_after_begin_question_tl {#1} }
+
+\cs_new_protected:Npn \exsheets_add_space:N #1
{
- \bool_if:nTF
+ \bool_if:nF
{
- \l__exsheets_heading_runin_bool ||
+ % \l__exsheets_heading_runin_bool ||
\l__exsheets_heading_inline_bool ||
\l__exsheets_no_skip_after_bool
}
- { } % { \c_space_tl }
{
\exsheets_par:
\dim_compare:nNnT { \parskip } = { 0pt }
@@ -1031,9 +1098,9 @@
\bool_if:NF \l__exsheets_points_questions_default_bool
{
\fp_compare:nT { \g__exsheets_this_question_points_fp > 0 }
- { points = \fp_to_tl:N \g__exsheets_this_question_points_fp , }
+ { points = \fp_to_decimal:N \g__exsheets_this_question_points_fp , }
\fp_compare:nT { \g__exsheets_this_question_bonus_fp > 0 }
- { bonus-points = \fp_to_tl:N \g__exsheets_this_question_bonus_fp }
+ { bonus-points = \fp_to_decimal:N \g__exsheets_this_question_bonus_fp }
}
}
#2
@@ -1053,7 +1120,7 @@
#2
{ #1 }
#3
- \exsheets_h_or_vspace:N \l__exsheets_questions_skip_below_dim
+ \exsheets_add_space:N \l__exsheets_questions_skip_below_dim
}
\cs_generate_variant:Nn \__exsheets_save_and_print_question_body:nnn { VVV }
@@ -1207,6 +1274,8 @@
{ \tl_use:N \l__exsheets_questions_id_tl }
}
}
+ \tl_use:N \l__exsheets_after_begin_question_tl
+ \tl_clear:N \l__exsheets_after_begin_question_tl
\bool_if:nT
{
!\l__exsheets_questions_deactivate_bool &&
@@ -1276,6 +1345,8 @@
\__exsheets_select_question:V \g__exsheets_questions_current_id_tl
\prop_map_inline:Nn \l__exsheets_class_prop
{ \use:c { __exsheets_questions_use_##1: } }
+ \exsheets_check_question_tags:VF \g__exsheets_questions_current_id_tl
+ { \bool_gset_false:N \g__exsheets_questions_use_bool }
\bool_if:nT
{
\g__exsheets_questions_use_bool &&
@@ -1655,6 +1726,11 @@
\colorlet { exsheetsdebugcolor } { yellow }
+\keys_define:nn {exsheets}
+ {
+ debug .bool_set:N = \l__exsheets_questions_debug_bool
+ }
+
\cs_new_protected:Npn \exsheets_debug_box:nn #1#2
{
\par
@@ -1669,39 +1745,41 @@
\cs_new:Npn \__exsheets_list_comma: {}
-\cs_new_protected:Npn \exsheets_questions_debug:
+\cs_new_protected:Npn \exsheets_questions_debug:n #1
{
\bool_if:nT
{ \l__exsheets_questions_debug_bool && \l__exsheets_inside_question_bool }
{
\exsheets_debug_box:nn { \linewidth }
{
- \fbox
- {
- ID:~
- \textit
- {
- \tl_if_blank:VTF \l__exsheets_questions_id_tl
- { \int_use:N \g__exsheets_questions_id_int }
- { \tl_use:N \l__exsheets_questions_id_tl }
- }
- }
- \cs_set_protected:Npn \__exsheets_list_comma:
- { ~ \cs_set:Npn \__exsheets_list_comma: { ,~ } }
+ \textbf {ID} :~ \textit {#1}
\prop_map_inline:Nn \l__exsheets_class_prop
{
\bool_if:cT { l__exsheets_questions_##2_bool }
{
- \__exsheets_list_comma: ##2:~
+ ;~ \textbf {##2} :~
\textit { \tl_use:c { l__exsheets_questions_##2_tl } }
}
}
+ \prop_get:NnN \g__exsheets_tags_prop
+ {#1}
+ \l__exsheets_tmpa_tl
+ \quark_if_no_value:VTF \l__exsheets_tmpa_tl
+ { ;~ \textbf {not~tagged} }
+ {
+ ;~ \textbf {tags} : ~
+ \seq_set_split:NnV \l__exsheets_tmpa_seq
+ {,}
+ \l__exsheets_tmpa_tl
+ \textit { \seq_use:Nn \l__exsheets_tmpa_seq {,~} }
+ }
}
}
}
-\NewDocumentCommand \DebugExSheets { G{true} }
- { \use:c { bool_set_#1:N } \l__exsheets_questions_debug_bool }
+\exsheets_deprecate_cs:Npnn \DebugExSheets #1
+ {the~ option~ debug}
+ { \keys_set:nn {exsheets} { debug = #1 } }
% ----------------------------------------------------------------------------
% include random/selected questions from a file:
@@ -1716,6 +1794,8 @@
\clist_new:N \l__exsheets_exclude_id_clist
\clist_new:N \questionsincludedlast
+\seq_new:N \g_exsheets_included_questions_seq
+
\int_new:N \l__exsheets_include_random_int
\int_zero:N \l__exsheets_include_random_int
@@ -1876,6 +1956,7 @@
{
\bool_gset_true:N \g__exsheets_questions_use_bool
\clist_gput_right:Nn \questionsincludedlast {#1}
+ \seq_gput_right:Nn \g_exsheets_included_questions_seq {#1}
\int_gincr:N \g__exsheets_questions_used_int
\__exsheets_mark_as_used_x:nn
{ \int_use:N \g__exsheets_questions_used_int }
@@ -1900,6 +1981,7 @@
{
\bool_gset_true:N \g__exsheets_questions_use_bool
\clist_gput_right:Nn \questionsincludedlast {#1}
+ \seq_gput_right:Nn \g_exsheets_included_questions_seq {#1}
% \prop_gput:NnV \g__exsheets_questions_used_prop
% {#1}
% \g__exsheets_questions_id_int
@@ -1996,27 +2078,43 @@
{
\prop_if_in:cVTF { g__exsheets_##1_active_prop }
\l__exsheets_tmpc_tl
- { \tl_put_right:Nn \l__exsheets_include_id_tl { y } }
- { \tl_put_right:Nn \l__exsheets_include_id_tl { n } }
+ { \tl_put_right:Nn \l__exsheets_include_id_tl {y} }
+ { \tl_put_right:Nn \l__exsheets_include_id_tl {n} }
}
}
}
- \tl_if_in:NnF \l__exsheets_include_id_tl { n }
- {
- \clist_if_in:NVF \l__exsheets_exclude_id_clist \l__exsheets_tmpb_tl
+ \bool_set_true:N \l__exsheets_tmpa_bool
+ \clist_if_in:NVT
+ \l__exsheets_exclude_id_clist
+ \l__exsheets_tmpb_tl
+ { \bool_set_false:N \l__exsheets_tmpa_bool }
+ \seq_if_in:NnT
+ \g_exsheets_included_questions_seq
+ \l__exsheets_tmpb_tl
+ { \bool_set_false:N \l__exsheets_tmpa_bool }
+ \tl_if_in:NnT \l__exsheets_include_id_tl {n}
+ { \bool_set_false:N \l__exsheets_tmpa_bool }
+ \bool_if:NT \l__exsheets_tmpa_bool
+ % \tl_if_in:NnF \l__exsheets_include_id_tl { n }
+ % {
+ % \clist_if_in:NVF
+ % \l__exsheets_exclude_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
}
- }
+ % }
}
}
}
}
}
}
+% \cs_generate_variant:Nn \clist_if_in_p:Nn {NV}
+% \cs_generate_variant:Nn \seq_if_in_p:Nn {NV}
\NewDocumentCommand \PrintIfIncludeActiveTF { mm }
{ \bool_if:NTF \l__exsheets_questions_deactivate_bool {#2} {#1} }
@@ -2594,7 +2692,7 @@
}
\l__exsheets_solutions_pre_hook_tl
\l__exsheets_solutions_post_hook_tl
- \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
+ \exsheets_add_space:N \l__exsheets_solutions_skip_below_dim
\group_end:
}
\cs_generate_variant:Nn \__exsheets_print_solution:nnnn { VVV, VVVV }
@@ -2922,8 +3020,8 @@
\DeclareTranslation { Turkish } { exsheets-solution-name } { \c C\"oz\"um }
\DeclareTranslation { Croatian } { exsheets-solution-name } { Rje\v{s}enje }
\DeclareTranslation { Hungarian } { exsheets-solution-name } { Megold\'{a}s }
-\DeclareTranslation { Danish } { exsheets-solution-name } { L\o{}sning }
-\DeclareTranslation { Norsk } { exsheets-solution-name } { L\o{}sning }
+\DeclareTranslation { Danish } { exsheets-solution-name } { L\o sning }
+\DeclareTranslation { Norsk } { exsheets-solution-name } { L\o sning }
\DeclareTranslation { Portuges } { exsheets-solution-name } { Solu\c c\~ao }
% the actual translating
\tl_set:Nn \l__exsheets_exercise_name_tl
@@ -3191,10 +3289,10 @@ HISTORY:
2015/07/04 v0.19 - add http://tex.stackexchange.com/q/222814
- allow begin and end of pseudo-environments as hooks
to the question an solution environments
+2015/11/18 v0.20 - add tagging feature
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
-- add a `tags' concept => major task
- points/decimal-marker, points/frac (?), points/format (?,im interface)
- points: swedish style
- \examspace inside {tasks} => possible? (\pagegoal-\pagetotal) gives wrong
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
index 89e09c51574..3c8cded5ca9 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def
@@ -30,14 +30,6 @@
\ProvidesFile{exsheets_headings.def}
[\exsheets@date\space v\exsheets@version\space ExSheets headings object]
-\coffin_new:N \l__exsheets_heading_main_coffin
-\coffin_new:N \l__exsheets_heading_pre_coffin
-\coffin_new:N \l__exsheets_heading_post_coffin
-\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_subtitle_coffin
-
% the object variables:
\bool_new:N \l__exsheets_heading_runin_bool
\bool_new:N \l__exsheets_heading_inline_bool
@@ -117,15 +109,16 @@
\cs_new:Npn \__exsheets_join_coffins:nnnnnnnn #1#2#3#4#5#6#7#8
{
\coffin_join:cnncnnnn
- { l__exsheets_heading_#1_coffin } { #2 } { #3 }
- { l__exsheets_heading_#4_coffin } { #5 } { #6 }
- { #7 } { #8 }
+ { l__exsheets_heading_#1_coffin } {#2} {#3}
+ { l__exsheets_heading_#4_coffin } {#5} {#6}
+ {#7}
+ {#8}
}
\cs_new:Npn \__exsheets_attach:N #1
{
\seq_map_inline:Nn #1
{
- \tl_if_blank:nF { ##1 }
+ \tl_if_blank:nF {##1}
{ \exp_after:wN \__exsheets_attach_coffin_sequence:w ##1 }
}
}
@@ -135,21 +128,52 @@
\cs_new:Npn \__exsheets_attach_coffins:nnnnnnnn #1#2#3#4#5#6#7#8
{
\coffin_attach:cnncnnnn
- { l__exsheets_heading_#1_coffin } { #2 } { #3 }
- { l__exsheets_heading_#4_coffin } { #5 } { #6 }
- { #7 } { #8 }
+ { l__exsheets_heading_#1_coffin } {#2} {#3}
+ { l__exsheets_heading_#4_coffin } {#5} {#6}
+ {#7}
+ {#8}
+ }
+
+\prop_new:N \l__exsheets_heading_coffins_prop
+
+\prg_new_conditional:Npnn \exsheets_if_heading_coffin:n #1 {T,F,TF}
+ {
+ \coffin_if_exist:cTF {l__exsheets_heading_#1_coffin}
+ { \prg_return_true: }
+ { \prg_return_false: }
}
+\cs_new_protected:Npn \exsheets_new_heading_coffin:n #1
+ { \coffin_new:c {l__exsheets_heading_#1_coffin} }
+
+\cs_new_protected:Npn \exsheets_set_heading_coffin:nn #1#2
+ {
+ \exsheets_if_heading_coffin:nF {#1}
+ { \exsheets_new_heading_coffin:n {#1} }
+ \prop_put:Nnn \l__exsheets_heading_coffins_prop {#1} {#2}
+ }
+
+\NewDocumentCommand \DeclareExSheetsHeadingContainer {m+m}
+ { \exsheets_set_heading_coffin:nn {#1} {#2} }
+
+\exsheets_new_heading_coffin:n {main}
+\exsheets_new_heading_coffin:n {pre}
+\exsheets_new_heading_coffin:n {post}
+\exsheets_new_heading_coffin:n {title}
+\exsheets_new_heading_coffin:n {number}
+\exsheets_new_heading_coffin:n {points}
+\exsheets_new_heading_coffin:n {subtitle}
+
% the `exsheets-heading' object:
% #1 = title,
% #2 = number,
% #3 = points
% #4 = bonus
% #5 = id
-\DeclareObjectType { exsheets-heading } { 5 }
+\DeclareObjectType {exsheets-heading} {5}
% the `default' template interface:
-\DeclareTemplateInterface { exsheets-heading } { default } { 5 }
+\DeclareTemplateInterface {exsheets-heading} {default} {5}
{
inline : boolean = false ,
runin : boolean = false ,
@@ -178,31 +202,31 @@
}
% the `default' template code:
-\DeclareTemplateCode { exsheets-heading } { default } { 5 }
+\DeclareTemplateCode {exsheets-heading} {default} {5}
{
- 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 ,
- vscale = \l__exsheets_heading_scale_fp ,
- above = \l__exsheets_heading_above_dim ,
- below = \l__exsheets_heading_below_dim ,
- main = \l__exsheets_heading_main_tl ,
- pre-code = \l__exsheets_heading_pre_code_tl ,
- post-code = \l__exsheets_heading_post_code_tl ,
- title-format = \l__exsheets_heading_title_format_tl ,
- title-pre-code = \l__exsheets_heading_title_pre_code_tl ,
- title-post-code = \l__exsheets_heading_title_post_code_tl ,
- 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 ,
- subtitle-format = \l__exsheets_heading_title_format_tl ,
- subtitle-pre-code = \l__exsheets_heading_subtitle_pre_code_tl ,
- subtitle-post-code = \l__exsheets_heading_subtitle_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 ,
- join = \l__exsheets_heading_joined_coffins_tl ,
+ 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 ,
+ vscale = \l__exsheets_heading_scale_fp ,
+ above = \l__exsheets_heading_above_dim ,
+ below = \l__exsheets_heading_below_dim ,
+ main = \l__exsheets_heading_main_tl ,
+ pre-code = \l__exsheets_heading_pre_code_tl ,
+ post-code = \l__exsheets_heading_post_code_tl ,
+ title-format = \l__exsheets_heading_title_format_tl ,
+ title-pre-code = \l__exsheets_heading_title_pre_code_tl ,
+ title-post-code = \l__exsheets_heading_title_post_code_tl ,
+ 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 ,
+ subtitle-format = \l__exsheets_heading_title_format_tl ,
+ subtitle-pre-code = \l__exsheets_heading_subtitle_pre_code_tl ,
+ subtitle-post-code = \l__exsheets_heading_subtitle_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 ,
+ join = \l__exsheets_heading_joined_coffins_tl ,
attach = \l__exsheets_heading_attached_coffins_tl
}
{
@@ -234,16 +258,6 @@
}
}
}
- \hcoffin_set:Nn \l__exsheets_heading_pre_coffin
- { \tl_use:N \l__exsheets_heading_pre_code_tl }
- \hcoffin_set:Nn \l__exsheets_heading_post_coffin
- { \tl_use:N \l__exsheets_heading_post_code_tl }
- \coffin_join:NnnNnnnn
- \l__exsheets_heading_main_coffin { l } { t }
- \l__exsheets_heading_pre_coffin { l } { b } { 0pt } { 0pt }
- \coffin_join:NnnNnnnn
- \l__exsheets_heading_main_coffin { l } { b }
- \l__exsheets_heading_post_coffin { l } { t } { 0pt } { 0pt }
\hcoffin_set:Nn \l__exsheets_heading_title_coffin
{
\tl_use:N \l__exsheets_heading_title_format_tl
@@ -274,7 +288,7 @@
{
\group_begin:
\tl_use:N \l_exsheets_heading_subtitle_user_format_tl
- { \exsheets_get_question_property:nn { subtitle } { #5 } }
+ { \exsheets_get_question_property:nn {subtitle} {#5} }
\group_end:
}
\tl_use:N \l__exsheets_heading_subtitle_post_code_tl
@@ -303,10 +317,10 @@
\fp_compare_p:n { #4 = 0 }
}
{
- \exsheets_parse_points:n { #3 }
- \exsheets_points_name:n { #3 }
+ \exsheets_parse_points:n {#3}
+ \exsheets_points_name:n {#3}
}
- { \exsheets_parse_points:n { #3 } }
+ { \exsheets_parse_points:n {#3} }
}
\fp_compare:nF { #4 = 0 }
{
@@ -317,11 +331,11 @@
\fp_compare_p:n { #3 = 0 }
}
{
- \exsheets_print_bonus:n { #4 }
+ \exsheets_print_bonus:n {#4}
\tl_use:N \l__exsheets_points_post_bonus_marker_tl
}
{
- \exsheets_parse_bonus:n { #4 }
+ \exsheets_parse_bonus:n {#4}
\tl_use:N \l__exsheets_points_post_bonus_marker_tl
\exsheets_points_name:n { #3 + #4 }
}
@@ -336,11 +350,10 @@
\group_begin:
\tl_use:N \l__exsheets_heading_title_format_tl \strut
\group_end:
- % \exp_args:Nx \tl_show:n { #3 }
- \tl_if_eq:xnF { #3 } { 0 }
+ \tl_if_eq:xnF {#3} {0}
{
\tl_use:N \l__exsheets_heading_points_pre_code_tl
- { \exsheets_print_points:n { #3 } }
+ { \exsheets_print_points:n {#3} }
\tl_use:N \l__exsheets_heading_points_post_code_tl
}
}
@@ -358,10 +371,22 @@
\l__exsheets_heading_below_dim
}
}
+ \hcoffin_set:Nn \l__exsheets_heading_pre_coffin
+ { \tl_use:N \l__exsheets_heading_pre_code_tl }
+ \hcoffin_set:Nn \l__exsheets_heading_post_coffin
+ { \tl_use:N \l__exsheets_heading_post_code_tl }
+ \coffin_join:NnnNnnnn
+ \l__exsheets_heading_main_coffin {l} {t}
+ \l__exsheets_heading_pre_coffin {l} {b} {0pt} {0pt}
+ \coffin_join:NnnNnnnn
+ \l__exsheets_heading_main_coffin {l} {b}
+ \l__exsheets_heading_post_coffin {l} {t} {0pt} {0pt}
+ \prop_map_inline:Nn \l__exsheets_heading_coffins_prop
+ { \hcoffin_set:cn {l__exsheets_heading_##1_coffin} {##2} }
\__exsheets_join:N \l__exsheets_heading_joined_coffins_seq
\__exsheets_attach:N \l__exsheets_heading_attached_coffins_seq
\bool_if:NTF \l__exsheets_heading_inline_bool
- { \exsheets_questions_debug: }
+ { \exsheets_questions_debug:n {#5} }
{
\skip_vertical:N \l__exsheets_heading_above_dim
\exsheets_needspace:n
@@ -371,7 +396,7 @@
\l__exsheets_heading_below_dim +
\baselineskip
}
- \exsheets_questions_debug:
+ \exsheets_questions_debug:n {#5}
\noindent
}
\skip_set:Nn \parfillskip { 0pt plus 1fil }