diff options
author | Karl Berry <karl@freefriends.org> | 2012-11-08 23:07:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-11-08 23:07:27 +0000 |
commit | 2f4b454ae76e5151ecb060ba24f829d1234cd737 (patch) | |
tree | 228e42baa545520a5b29180c80255b632e5e92cc | |
parent | 136f39c4716d4adccfd552ba03e269e58b8d7a69 (diff) |
exsheets (8nov12)
git-svn-id: svn://tug.org/texlive/trunk@28212 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf | bin | 689795 -> 713108 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex | 216 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/cntformats.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 38 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def | 10 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_tasks.def | 134 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/translations.sty | 4 |
8 files changed, 264 insertions, 146 deletions
diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README index 74803b4238a..0a082e1f372 100644 --- a/Master/texmf-dist/doc/latex/exsheets/README +++ b/Master/texmf-dist/doc/latex/exsheets/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -EXSHEETS v0.3 - 2012/10/23 +EXSHEETS v0.4 - 2012/11/08 bundled packages: the EXSHEETS package diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf Binary files differindex 502693a22cf..16fb782c201 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex index e9fb998099b..1c7fdfe63f1 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex @@ -58,14 +58,13 @@ skipbelow = .6\baselineskip plus .5ex minus .5ex , skipabove = .6\baselineskip plus .5ex minus .5ex , innerleftmargin = 1.5em , - innerrightmargin = 2.5em , - ignorelastdescenders + innerrightmargin = 2.5em } , gobble = 1 } \cnpkgusecolorscheme{friendly} -\usepackage{embrac}[2012/06/29] +\usepackage[biblatex]{embrac}[2012/06/29] \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] \usepackage{microtype} @@ -86,16 +85,17 @@ % code examples % ExSheets: \addcmds{ - acs, addpoints, blank, bigstar, bottomrule, citetitle, cmd, color, + acs, addpoints, blank, bigstar, bottomrule, checkedchoicebox, choice, choicebox, + citetitle, cmd, color, correct, DeclareInstance, DeclareTemplateInterface, DeclareQuestionProperty, DebugExSheets, endspacing, examspace, ForEachQuestion, GetQuestionProperty, grade, includequestions, iflastquestion, - midrule, NewQuSolPair, numberofquestions, points, PrintIfIncludeActiveF, - PrintIfIncludeActiveT, PrintIfIncludeActiveTF, printsolutions, - PrintSolutionsTF, - QuestionNumber, RenewQuSolPair, s, sample, setlength, SetQuestionProperties, - SetupExSheets, spacing, square, sumpoints, tabcolsep, task, textcite, textcolor, - toprule, totalpoints + midrule, NewQuSolPair, NewTasks, numberofquestions, points, + PrintIfIncludeActiveF, PrintIfIncludeActiveT, PrintIfIncludeActiveTF, + printsolutions, PrintSolutionsF, PrintSolutionsTF, PrintSolutionsT, + QuestionNumber, RenewQuSolPair, rightarrow, s, sample, setlength, + SetQuestionProperties, SetupExSheets, spacing, square, sumpoints, + tabcolsep, task, textcite, textcolor, toprule, totalpoints } % translations: @@ -215,8 +215,11 @@ \usepackage{amssymb} \NewQuSolPair - {question*}[name=\llap{$\bigstar$\space}Bonus Question] - {solution*}[name=\llap{$\bigstar$\space}Solution] + {question*}[name=\protect\llap{$\bigstar$\space}Bonus Question] + {solution*}[name=\protect\llap{$\bigstar$\space}Solution] + +\NewTasks[style=multiplechoice]{choices}[\choice](3) +\newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} \DeclareTranslation{English}{Kueche}{kitchen} \DeclareTranslation{German}{Kueche}{K\"uche} @@ -269,6 +272,8 @@ \@esphack} \makeatother +\pdfstringdefDisableCommands{\def\llap#1{#1\space}\def\bigstar{*}} + % ---------------------------------------------------------------------------- % title page \TitlePicture{% @@ -287,7 +292,7 @@ \part{Preliminary}\secidx{Preliminary} \section{Licence and Requirements} \secidx[Licence]{Preliminary}\secidx[Requirements]{Preliminary} -\ExSheets is placed under the terms of the LaTeX Project Public License, +\ExSheets is placed under the terms of the \LaTeX{} Project Public License, version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). It has the status ``maintained.'' @@ -498,7 +503,7 @@ argument. \end{question} \end{beispiel} -\sinceversion{3.0}On additional thing: you might want to define custom +\sinceversion{0.3}On additional thing: you might want to define custom commands that should behave differently if they're inside or outside of the \code{question} environment. In this case you can use these commands: \begin{beschreibung} @@ -618,6 +623,15 @@ of the respective counter. \code{1}: \cmd{arabic}, \code{a}: \cmd{alph}, \code{A A question with a differently formatted number. \end{question} \end{beispiel} +Since the strings associated with the counters are replaced one has to hide them +if they are actually wanted in the counter format. The easiest way would to +interrupt them by an empty group. +\begin{beispiel} + \SetupExSheets{counter-format=s{}ection\,se~q{}uestion\,(qu[a])} + \begin{question} + A question with a yet differently formatted number. + \end{question} +\end{beispiel} \secidx*{Setting the Counter} \subsubsection{Language Settings}\secidx{Language Settings} @@ -714,7 +728,7 @@ You have two possibilities to display and count them: \begin{beschreibung} \Option[points]{name}{<name>}\Default{P.} Choose the ``unit'' for the points. If you like to differentiate between a - single point and more than one point you can give a plural ending seperated + single point and more than one point you can give a plural ending separated with a slash: \key{name}{point/s}. This sets also the name of the bonus points. \Option[points]{name-plural}{<plural form of name>}\Default{} Instead of forming the plural form with an ending to the singular form this @@ -722,7 +736,7 @@ You have two possibilities to display and count them: the bonus points. \Option[points]{bonus-name}{<name>}\Default{P.} Choose the ``unit'' for the bonus points. If you like to differentiate between a - single point and more than one point you can give a plural ending seperated + single point and more than one point you can give a plural ending separated with a slash: \key{bonus-name}{point/s}. \Option[points]{bonus-plural}{<plural form of name>}\Default{} Instead of forming the plural form with an ending to the singular form this @@ -1100,7 +1114,7 @@ It is now possible to recover these values later: \end{center} \end{beispiel} -\sinceversion{3.0}There are additional commands that might prove useful: +\sinceversion{0.3}There are additional commands that might prove useful: \begin{beschreibung} \Befehl{ForEachQuestion}{<code to be executed for each used question>}\newline Inside the argument one can refer to the \ac{id} of a question with \code{\#1}. @@ -1124,7 +1138,7 @@ For example one could use these commands to create a grading table: \pointssum* \\ \hline Reached & \ForEachQuestion{\iflastquestion{}{&}} & \\ \hline -\end{tabular} + \end{tabular} \end{beispiel} For four questions the table now would look similar to figure~\ref{fig:grading-table}. @@ -1210,7 +1224,7 @@ are included anyway. I'm still not sure this is a feature or a bug\ldots \secidx*{Include from External Files} \subsection{Own Question/Solution Pairs} -\noindent\sinceversion{3.0}\ExSheets provides he possibility to create new +\noindent\sinceversion{0.3}\ExSheets provides he possibility to create new environments that behave like the \code{question} and \code{solution} environments. This would allow, for example, to define a \code{question*}/\code{solution*} environment pair for bonus questions. The following commands may be used in the @@ -1229,8 +1243,8 @@ to define starred variants that add a star in the margin left to the title: \begin{beispiel} % preamble: % \NewQuSolPair - % {question*}[name=\llap{$\bigstar$\space}Bonus Question] - % {solution*}[name=\llap{$\bigstar$\space}Solution] + % {question*}[name=\protect\llap{$\bigstar$\space}Bonus Question] + % {solution*}[name=\protect\llap{$\bigstar$\space}Solution] \begin{question*} This is a bonus question. \end{question*} @@ -1243,18 +1257,23 @@ standard \code{question} and \code{solution} environments. \subsection{The \code{tasks} Environment}\label{sec:tasks}\secidx{tasks} \subsubsection{How it works} -The \code{tasks} environment is similar to a list like \code{enumerate} but not -the same. The first difference: there is no pagebreak possible inside an item but -only between items. The second difference: the enumeration default is a), b), c) -\ldots The third difference: the input syntax: +\noindent\changedversion{0.4}The \code{tasks} environment is similar to a list +like \code{enumerate} but not the same. The first difference: there is no +pagebreak possible inside an item but only between items. The second difference: +the enumeration default is a), b), c) \ldots The third difference: there is a +split at \emph{every} occurrence of the item separator. For this reason the +default separator is not \cmd*{item} but \cmd{task} so it is unique to this +environment only. The fourth difference: the \code{tasks} environment cannot +be nested. You can, however, use an \code{itemize} environment or something in +it. \begin{beschreibung} - \Umg{tasks}[<options>]{\unskip\ma{<num of columns>} list of tasks, each ended by - a semicolon} + \Umg{tasks}[<options>]{\unskip\ma{<num of columns>} list of tasks introduced + with \cmd{task}} \end{beschreibung} Let's use some sample text in the next few examples: \begin{beispiel}[code only] - \def\s{This is some sample text we will use to create a somewhat longer text - spanning a few lines.} + \def\s{This is some sample text we will use to create a somewhat + longer text spanning a few lines.} \def\sample{\s\ \s\par\s} \end{beispiel} \def\s{This is some sample text we will use to create a somewhat longer text @@ -1263,9 +1282,9 @@ Let's use some sample text in the next few examples: \begin{beispiel}[below] Some text before the list. \begin{tasks} - \sample ; - \sample ; - \sample ; + \task \sample + \task \sample + \task \sample \end{tasks} And also some text after it. \end{beispiel} @@ -1273,15 +1292,15 @@ The environment takes the optional argument \ma{<num of columns>} with which the number of columns used by the environment is specified. \begin{beispiel}[below] \begin{tasks}{2} - \sample ; - \s\ \s ; - \s ; - \sample ; - \s\par\s ; + \task \sample + \task \s\ \s + \task \s + \task \sample + \task \s\par\s \end{tasks} \end{beispiel} -\subsubsection{Available Options}\secidx[Options]{tasks} +\subsubsection{Available Options}\secidx[Options]{tasks}\label{sssec:tasks:options} The environment has some options, namely these: \begin{beschreibung} \Option[tasks]{style}{<instance>}\Default{} @@ -1293,20 +1312,24 @@ The environment has some options, namely these: \cmd{roman} and \code{R}: \cmd{Roman}. \Option[tasks]{label-width}{<dim>}\Default{3ex} Sets the width of the item labels. - \Option[tasks]{before-skip}{<skip>}\Default{.33\cmd{baselineskip}} + \Option[tasks]{before-skip}{<skip>}\Default{0pt} Sets the skip before the list. - \Option[tasks]{after-skip}{<skip>}\Default{.33\cmd{baselineskip}} + \Option[tasks]{after-skip}{<skip>}\Default{0pt} Sets the skip after the list. + \Option[tasks]{resume}{\default{true}|false}\Default{false} + The enumeration will resume from a previous \code{tasks} environment. In order + to use this option properly you shouldn't mix different \code{tasks} environments + that both count their items. \end{beschreibung} Now the same list as above but with three columns and a different label: \begin{beispiel}[below] \begin{tasks}[label=(tsk[r]),label-width=4ex]{3} - \sample ; - \s\ \s ; - \s ; - \sample ; - \s\par\s ; + \task \sample + \task \s\ \s + \task \s + \task \sample + \task \s\par\s \end{tasks} \end{beispiel} @@ -1316,15 +1339,15 @@ Let's use it inside a question: \begin{question}[type=exam]{4} I have these two tasks for you. Shall we begin? \begin{tasks}{2} - The first task: easy! ; - The second task: even more so! ; + \task The first task: easy! + \task The second task: even more so! \end{tasks} \end{question} \begin{solution}[print] Now, let's see\ldots\ ah, yes: \begin{tasks} - This is the first solution. Told you it was easy. ; - This is the second solution. And of course you knew that! ; + \task This is the first solution. Told you it was easy. + \task This is the second solution. And of course you knew that! \end{tasks} \end{solution} \end{beispiel} @@ -1339,38 +1362,87 @@ additional instances for the \code{tasks} are available: \end{description} \begin{beispiel} \begin{tasks}[style=itemize]{2} - that's just how\ldots ; - \ldots we expected ; + \task that's just how\ldots + \task \ldots we expected \end{tasks} \begin{tasks}[style=enumerate]{2} - that's just how\ldots ; - \ldots we expected ; + \task that's just how\ldots + \task \ldots we expected \end{tasks} \begin{tasks}[style=multiplechoice]{2} - that's just how\ldots ; - \ldots we expected ; + \task that's just how\ldots + \task \ldots we expected \end{tasks} \end{beispiel} \subsubsection{Custom Labels}\secidx[Custom Labels]{tasks} -If you want to change a single label inside a list, you can use -\begin{beschreibung} - \Befehl{task}{<label>} -\end{beschreibung} -in one of the tasks. This will temporarily overwrite the default label. +If you want to change a single label inside a list, you can use the optional +argument of \cmd{task}. This will temporarily overwrite the default label. \begin{beispiel} \begin{tasks}[style=itemize] - a standard item ; - another one ; - \task{+}a different one ; - and another one ; + \task a standard item + \task another one + \task[+] a different one + \task and another one \end{tasks} \end{beispiel} + +\subsubsection{New Tasks}\secidx[Own Environments]{tasks} +\noindent\sinceversion{0.3b}It is possible to add custom environments that work +like the \code{tasks} environment. +\begin{beschreibung} + \Befehl{NewTasks}[<options>]{<name>}\oa{<separator}\da{<cols>}\newline + Define environment \ma{<name>} that uses \code{<separator>} to introduce a + new item. Default for \code{<separator>} is \cmd{task}, default for + \code{<cols>} is \code{1}. The \code{<options>} are the ones described in + section~\ref{sssec:tasks:options}. +\end{beschreibung} +The \code{tasks} environment is defined as follows: +\begin{beispiel}[code only] + \NewTasks{tasks} +\end{beispiel} + +The separator does not have to be a control sequence: +\begin{beispiel} + \NewTasks[label=$\rightarrow$]{todo}[>] + \begin{todo} + > First task + > Second Task + \end{todo} +\end{beispiel} + +Let's say you want a \code{choices} environment that has three columns in its +default state. You could do something like this: +\begin{beispiel} + % preamble: + % \NewTasks[style=multiplechoice]{choices}[\choice](3) + % \newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} + \begin{question} + \begin{choices} + \choice First choice + \choice Second choice + \choice[\correct] Third choice + \end{choices} + \end{question} + \begin{solution}[print] + \begin{choices} + \choice First choice + \choice Second choice + \choice[\correct] Third choice + \end{choices} + \end{solution} +\end{beispiel} + +The last example shows you two additional commands: +\begin{beschreibung} + \Befehl{choicebox} \choicebox + \Befehl{checkedchoicebox} \checkedchoicebox +\end{beschreibung} \secidx*{tasks} \subsection{Filling in the Blanks}\secidx{Blanks} \subsubsection{Cloze}\secidx[Cloze]{Blanks} -\noindent\changedversion{3.0}Both in exercise sheets and in exams it is sometimes +\noindent\changedversion{0.4}Both in exercise sheets and in exams it is sometimes desirable to be able to create \blank{blanks} that have to be filled in. Or may be some more lines: \blank[width=5\linewidth]{} @@ -1387,6 +1459,9 @@ The options are these: \begin{beschreibung} \Option[blank]{style}{line|wave|dline|dotted|dashed}\Default{line} The style of the line. + \Option[blank]{scale}{<num>}\Default{1} + Scales the width of the blank by factor \code{<num>} unless the width is + explicitly set. \Option[blank]{width}{<dim>}\Default{} The width of the line. If it is not used the width of the filled in text is used. \Option[blank]{linespread}{<num>}\Default{1} @@ -1412,7 +1487,7 @@ A number of empty lines are easily created by setting the width option: \end{beispiel} \subsubsection{Vertical Space for answers}\secidx[vertical space]{Blanks} -\noindent\sinceversion{3.0}When you're creating an exam you might want to add some +\noindent\sinceversion{0.3}When you're creating an exam you might want to add some vertical space where the students can write down their answers. While you can always use \cmd*{vspace} this is not always handy when the space left on the page is less than you want. In this case it would be nice if a) there would be @@ -1446,7 +1521,7 @@ and for the \code{tasks} environment. What this package doesn't provide is changing the background of questions or framing them. But this is easily possible using the \paket{mdframed} package -and its \cmd*{surroundwithmdframed} copmmand. +and its \cmd*{surroundwithmdframed} command. \subsection{The \code{exsheets-headings} Object}\label{sec:exsheets-headings} \secidx{The `exsheets-headings' Object} @@ -1509,7 +1584,7 @@ the second) using the following syntax: join = coffin1[handle11,handle12]coffin2[handle21,handle22](x-offset,y-offset) \end{beispiel} The syntax for attaching (two become one, the first does \emph{not} extend its -bounding box around the second) the syntax is the same. +bounding box around the second) is the same. More on coffin handles is described in the documentation for the \paket{xcoffins}. Figure~\ref{fig:handles} briefly demonstrates the available handle pairs. @@ -1739,6 +1814,7 @@ available through the option \key{headings}{<instance>}. A `runin-wp-rev' heading. \sample \end{question} +\newpage \subsubsection{The `runin-nr' Instance} \begin{beispiel}[code only] \DeclareInstance{exsheets-heading}{runin-nr}{default} @@ -1956,7 +2032,7 @@ of their usage. 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 } \end{beispiel} @@ -2242,7 +2318,7 @@ can add own formats. \SetupExSheets{headings=block,solutions-totoc} \printsolutions -{\EmbracOff\RaggedRight\printbibliography} +\RaggedRight\printbibliography \setindexpreamble{Section titles are indicated \textbf{bold}, packages \textsf{sans serif}, commands \code{\textbackslash\textcolor{code}{brown}}, options \textcolor 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} |