texlive[47380] Master/texmf-dist: exercisebank (8apr18)

commits+karl at tug.org commits+karl at tug.org
Sun Apr 8 22:06:04 CEST 2018


Revision: 47380
          http://tug.org/svn/texlive?view=revision&revision=47380
Author:   karl
Date:     2018-04-08 22:06:03 +0200 (Sun, 08 Apr 2018)
Log Message:
-----------
exercisebank (8apr18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/exercisebank/README.txt
    trunk/Master/texmf-dist/doc/latex/exercisebank/example.zip
    trunk/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf
    trunk/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex
    trunk/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty

Modified: trunk/Master/texmf-dist/doc/latex/exercisebank/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/exercisebank/README.txt	2018-04-08 20:05:48 UTC (rev 47379)
+++ trunk/Master/texmf-dist/doc/latex/exercisebank/README.txt	2018-04-08 20:06:03 UTC (rev 47380)
@@ -3,14 +3,15 @@
 
 Files:
 - exercisebank.sty : The exercise bank
-- exercisebank.pdf : Description of how the package works
+- exercisebank-doc.pdf : Description of how the package works
+- exercisebank-doc.tex : Description of how the package works - documentation
 - example.zip : containing example
   |-- example.tex : example of use texfile
   |-- exampe.pdf  : example of use output
   |-- exercises/ : Directory containing exercises that could be use
-  |---| -- firstexercise.tex: example exercise
-  |---| -- secondexercise.tex: example exercise
-  |---| -- thirdexercise.tex: example exercise
+  |---|--- firstexercise.tex: example exercise
+  |---|--- secondexercise.tex: example exercise
+  |---|--- thirdexercise.tex: example exercise
 
 Author: Storvik Strauman, Andreas
 
@@ -19,7 +20,7 @@
 
 Licence:
 
-The LaTeX package exercisebank - version v0.0.6 (2018/04/03)
+The LaTeX package exercisebank - version v0.1.0 (2018/04/08)
 exercisebank.sty: Exercise bank
 -------------------------------------------------------------------------------------------
 Copyright (c) 2018 by Andreas Storvik Strauman

Modified: trunk/Master/texmf-dist/doc/latex/exercisebank/example.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex	2018-04-08 20:05:48 UTC (rev 47379)
+++ trunk/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex	2018-04-08 20:06:03 UTC (rev 47380)
@@ -1,6 +1,6 @@
-%% exercisebank v0.0.6b47 - 2018/04/03
-%% The LaTeX package exercisebank - version v0.0.6 (2018/04/03) build 47
-%% exercisebank.sty
+%% exercisebank v0.1.0b55 - 2018/04/08
+%% The LaTeX package exercisebank - version v0.1.0 (2018/04/08) build 55
+%% #PACKAGE.sty
 %% -------------------------------------------------------------------------------------------
 %% Copyright (c) 2018 by Andreas Storvik Strauman
 %% -------------------------------------------------------------------------------------------
@@ -13,7 +13,6 @@
 %% version 2008/05/04 or later.
 %% This work has the LPPL maintenance status `author-maintained'.
 %% This work consists of all files listed in README.txt
-
 \documentclass{article}
 \usepackage[all]{tcolorbox}
 \usepackage{needspace}
@@ -25,7 +24,7 @@
   moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso},
   classoffset=1,
   moretexcs={% core
-    makeset,phead,buildset,select,exclude,Trigger,At,translateExBank
+    makeset,phead,buildset,select,exclude,Trigger,At,translateExBank,exercisebanksetup,exerciseFile
   },
   texcsstyle=*\color{Definition}\bfseries,
   classoffset=0,% restore default
@@ -42,10 +41,14 @@
       \path[fill=yellow!50!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=4mm]interior.north west);
       },
     drop fuzzy shadow,#1}
- \title{Exercise bank - Manual\\{\normalsize v0.0.6}}
+ \title{Exercise bank - Manual\\{\normalsize v0.1.0}}
  \makeatother
 \let\dac\docAuxCommand
+\long\def\keyDef#1#2#3#4{\begin{docKey}{#1}{=\meta{#2}}{\meta{default}=#3}#4\end{docKey}}
 \tcbset{documentation listing style=mydocumentation}
+% Magenta HREF style
+\let\oldhref\href
+\gdef\href#1#2{{\color{magenta}\oldhref{#1}{#2}}}
 % Give section some space
 \let\oldsection\section
 \gdef\section{\needspace{0.3\paperheight}\oldsection}
@@ -54,12 +57,13 @@
 
 
 \setlength{\parindent}{0pt}
-\title{{Handin - manual\\ v0.0.6{\\[-0.5em]\footnotesize(build 47)}}}
+\title{{exercisebank - manual\\ v0.1.0{\\[-0.5em]\footnotesize(build 55)}}}
 \author{Andreas Strauman}
 \begin{document}
 \maketitle
  
-If you found any bugs or want new functionality, to contribute, view the commented source, get latest version of this package or get in touch with me, you can do all of that at \url{https://github.com/Strauman/exerciseBank/}
+If you found any bugs or want new functionality, to contribute, view the commented source, get latest version of this package or get in touch with me, you can do all of that at \url{https://github.com/Strauman/exerciseBank/}. If you have questions of functionality, kindly direct them to the community\\ \url{http://tex.stackexchange.com}. The author is active on this site regularly.
+
 \tableofcontents
 \clearpage
 \section{Motivation}
@@ -68,7 +72,8 @@
 \section{Flow/Moderate start}
 I suspect that working with this package will break you current flow. So let's go throught it.
 
-This package assumes you put all of your exercises within the folder named \texttt{exercises} (you can change the default folder using \refCom{setExercisesDir})
+Most likely you would want to put all your exercises in a folder. To set the default folder, use \refCom{exercisebanksetup}.
+In these examples we use \texttt{exercises/}.
 \begin{dispListing*}{title=exercises/myexercise.tex}
 \begin{intro}
   This introduces our problem
@@ -86,6 +91,7 @@
 \begin{dispListing*}{title=main.tex}
   \documentclass{article}
   \usepackage{exercisebank}
+  \exercisebanksetup{exercise directory=exercises}
   \makeset{myExerciseSet}{myexercise}
   \begin{document}
     \buildset{myExerciseSet}
@@ -97,6 +103,7 @@
 \begin{dispListing*}{title=main.tex}
   \documentclass{article}
   \usepackage{exercisebank}
+  \exercisebanksetup{exercise directory=exercises}
   \makeset{myExerciseSet}{\select{myexercise}{2}}
   \begin{document}
     \buildset{myExerciseSet}
@@ -185,7 +192,7 @@
  \section{Reference}
 \subsection{Environments}
 \begin{docEnvironment}{problem}{}
-Inside the exercises folder, you keep your exercises. Inside there you'd use a problem environment to write your partproblems. It might be a little confusing that you're using \dac{begin}\{problem\} instead of \dac{begin}\{partproblem\} when you're writing a partproblem, but it's less typing.
+Inside the \dac{keyRef}\{exercise directory\}, you keep your exercises. Inside the exercise file you'd use a problem environment to write your partproblems. It might be a little confusing that you're using \dac{begin}\{problem\} instead of \dac{begin}\{partproblem\} when you're writing a partproblem, but it's less typing.
 \end{docEnvironment}
 \begin{docEnvironment}{solution}{}
  Things inside here is only visible if \refCom{DisplaySolutions} are given before \dac{begin}\{document\}
@@ -197,6 +204,41 @@
 \begin{docEnvironment}{intro}{}
 Sometimes you'd want to introcude your exercises and tell a little bit about it. Maybe have a figure there also. Those things should go inside this environment. This can be treated as a problem in terms of counting. See \refCom{makeset} for more info.
 \end{docEnvironment}
+\subsection{Configuration and options}
+You can do a lot of configurations on this package, and probably
+ even more to come in later versions!
+\begin{docCommand}{exercisebanksetup}{\marg{[key/values]}}
+ Here is a list of the different keys and their meaning
+\keyDef{part problems}{On/Off}{On}{
+ This is whether or not to do part problems. E.g. 1a), 1b) etc.
+ If this is turned Off, then the part problems will be treated as problems
+}
+\keyDef{tighten paragraphs}{True/False}{True}{
+ Disabling this will prevent
+ the package from attempting to prevent part problems to scatter across pages
+}
+\keyDef{problem header}{macro}{see below}{
+ This sets the problem header. To access the translation of the problem text, use \dac{@tr}\{Problem\}, and
+ the problem counter is accessed with \dac{theproblemcounter}.\\
+ Defaults to\\
+ \brackets{\dac{normalfont}\dac{Large}\dac{bfseries}\dac{@tr}\{Problem\}~\dac{theproblemcounter}}.
+}
+\keyDef{part problem header}{macro}{see below}{
+ This sets the problem header. To access the current problem, use \dac{theproblemcounter}, and then the current
+ part problem \dac{thepartproblemcounter}. To make it a letter, as per default use \dac{alph}\{partproblemcounter\}\\
+ Default is:\\
+ \dac{large}\dac{textbf}\{(\dac{theproblemcounter}\dac{alph}{partproblemcounter\})}
+}
+\keyDef{solution header}{string}{see below}{
+\dac{large}\{\dac{textbf}{\dac{@tr}{Solution\}:}}
+}
+\keyDef{exercise directory}{string}{./}{
+This key is used for setting the default exercise directory.
+}
+\begin{dispListing}
+ \exercisebanksetup{exercise directory=exercises,part problems=Off,solution header={\textbf{SOL:}}}
+\end{dispListing}
+\end{docCommand}
 \subsection{Internationalization}
 \begin{docCommand}{translateExBank}{\marg{Translation key/vals}}
 This is to translate the text inside the package. As of now the available key/values are
@@ -227,9 +269,11 @@
 \begin{docCommand}{ownLineNoSpacesGotIt}{}
 This is to annoy the user enough to get his attention about the requirements of the \refEnv{problem}, \refEnv{solution} and \refEnv{intro} environments.\\
 \end{docCommand}
+\begin{marker}DEPRECATED! use \refCom{exercisebanksetup} with \refKey{exercise directory} instead!\end{marker}
 \begin{docCommand}{setExercisesDir}{\marg{directory}}
+\begin{marker}\dac{setExercisesDir} is deprecated! use \refCom{exercisebanksetup} with \refKey{exercise directory} instead!\end{marker}
 This is the directory, relative to the file you included the package,
-where the package should be looking for exercises. Default is \texttt{exercises}
+where the package should be looking for exercises. Default is the same directory as your main file (the one you build).
 \end{docCommand}
 This package also includes some extra stuff. For example the \dac{At} and \dac{Trigger}
 \begin{docCommand}{At}{\marg{AnyMacro}}
@@ -251,7 +295,7 @@
 \end{docCommand}
 \subsection{Making sets}
 \begin{docCommand}{makeset}{\oarg{intro,nohead}\marg{filable}}
- This command is the one you use to make a set! Later you use \dac{buildset} to build the sets you make. The \meta{filable} argument is either the name of the file relative to the \dac{exerciseDir}-path (default its in the root called exercises), or you could use the \dac{select} or \dac{exclude} to  respectively cherry pick or exclude exercises. (See their docs).\\
+ This command is the one you use to make a set! Later you use \dac{buildset} to build the sets you make. The \meta{filable} argument is either the name of the file relative to the \dac{setExercisesDir}-path (default is nothing, so it's in the root path), or you could use the \dac{select} or \dac{exclude} to  respectively cherry pick or exclude exercises. (See their docs).\\
  \oarg{intro} this counts the intro environment as a part problem, so that you can \dac{select} or \dac{exclude} the intro\\
  \oarg{nohead} prevents the builder from adding a problem header. This is handy if you want to create an exercise that is composed of multiple parts. You can use the \dac{phead} to insert the problem header where you want it
 \begin{dispListing}
@@ -321,5 +365,11 @@
   v0.0.5b46&2018/04/03&\begin{itemize}
     \item Fixed partproblems and solutions to fit on pages using \dac{filbreak}.
   \end{itemize}\\
+  v0.1.0&2018/04/08&\begin{itemize}
+    \item \begin{marker}Backward incompability from v0.0.5:Removed default exercise directory! \end{marker} Use \dac{exercisebanksetup}\brackets{exercise directory=exercises} if you used the package before 2018/04/08!
+    \item Fixed title of documentation to match actual package.
+    \item Fixed weird paragraph styling when displaying solutions
+    \item Added a few package options. More to come!
+  \end{itemize}\\
 \end{tabularx}
  \end{document}

Modified: trunk/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty	2018-04-08 20:05:48 UTC (rev 47379)
+++ trunk/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty	2018-04-08 20:06:03 UTC (rev 47380)
@@ -1,5 +1,5 @@
 % Source (with comments) can be found at https://github.com/Strauman/exerciseBank
-%% The LaTeX package exercisebank - version v0.0.6 (2018/04/03) - build 47
+%% The LaTeX package exercisebank - version v0.1.0 (2018/04/08) - build 55
 %% exercisebank.sty: Exercise bank
 %% -------------------------------------------------------------------------------------------
 %% Copyright (c) 2018 by Andreas Storvik Strauman <andreas dot s dot strauman at uit dot no>
@@ -13,20 +13,49 @@
 %% version 2008/05/04 or later.
 %% This work has the LPPL maintenance status `author-maintained'.
 %% This work consists of all files listed in README
-\ProvidesPackage{exercisebank}[2018/04/03 v0.0.6 Creates a setup that gives freedom in making sets and exercises.]
+\ProvidesPackage{exercisebank}[2018/04/08 v0.1.0 Creates a setup that gives freedom in making sets and exercises.]
+\PackageWarningNoLine{exercisebank-v0.1.0}{This package is in the alpha stage, and if something unexpected happens please, oh pretty please, report it to https://github.com/Strauman/exerciseBank. Thank you!}
 \@ifundefined{ownLineNoSpacesGotIt}{\@latex at warning{Compilation wont work unless \string\end{problem} and \string\end{solution} are on their own lines and without any spaces. This warning can be removed by doing \string\def\string\ownLineNoSpacesGotIt{} before \@backslashchar usepackage{exbank}}
 }{}
-\gdef\setExercisesDir#1{\gdef\exercisesDir{#1}}
-\@ifundefined{exercisesDir}{\gdef\exercisesDir{exercises}
+\gdef\setExercisesDir#1{\@latex at error{\string\setExercisesDir is deprecated. Use \string\exercisebanksetup{exercise directory=#1} instead}{}\stop\bye
+}
+\@ifundefined{exercisesDir}{\gdef\@exercisesDir{.}
 }{}
 \global\let\incl = \input
-\RequirePackage{xstring}
-\RequirePackage{pgffor}
-\RequirePackage{scrextend}
-\RequirePackage{comment}
-\RequirePackage{calc}
-\RequirePackage{pgfpages}
-\RequirePackage{geometry}
+\usepackage{xstring}
+\usepackage{pgffor}
+\usepackage{scrextend}
+\usepackage{comment}
+\usepackage{calc}
+\usepackage{pgfpages}
+\usepackage{geometry}
+\edef\@isTrue{1}
+\edef\@isFalse{0}
+\pgfkeys{/exbanksetup/.is family, /exbanksetup,
+default/.style = {  part problems = On,
+  tighten paragraphs = True,
+  problem header={\normalfont\Large\bfseries\@tr{Problem}~\theproblemcounter},
+  part problem header={\large\textbf{(\theproblemcounter\alph{partproblemcounter})}},
+  solution header={\large{\textbf{\@tr{Solution}:}}},
+  exercise directory=.,
+},
+exercise directory/.estore in = \@exercisesDir, %
+problem header/.store in = \exbank at opt@problemHeader,
+part problem header/.store in = \exbank at opt@partProblemHeader,
+solution header/.store in = \exbank at opt@solutionHeader,
+part problems/.style = {switches/#1/.get = \exbank at opt@partProblems},
+tighten paragraphs/.style = {switches/#1/.get = \exbank at opt@tightenparagraphs},
+switches/.cd,
+  On/.initial = \@isTrue,
+  on/.initial = \@isTrue,
+  T/.initial =  \@isTrue
+  Off/.initial = \@isFalse,
+  off/.initial = \@isFalse,
+  F/.initial = \@isFalse,
+}
+\newcommand\exercisebanksetup[1]{  \pgfkeys{/exbanksetup, #1}%
+}
+\exercisebanksetup{default}
 \pgfkeys{ /exbanki18n/.is family, /exbanki18n,
   default/.style = {Problem = Problem, Solution = Solution},
   Problem/.estore in = \@tr at Problem,
@@ -75,22 +104,21 @@
 \setcounter{problemcounter}{0}
 \newcounter{partproblemcounter}
 \At\VeryBeginProblem{	\stepcounter{problemcounter}
-	\setcounter{partproblemcounter}{1}
+	\setcounter{partproblemcounter}{0}
 	\vspace*{\pMarginAbove}
 	\begin{addmargin}{\pMarginLeft}
-		{\normalfont\Large\bfseries\@tr{Problem}~\theproblemcounter}
+		{\exbank at opt@problemHeader}
 	\end{addmargin}
 	\vspace*{\pMarginBelow}
 }
-\At\EndProblem{	\filbreak
+\At\EndProblem{	\if\exbank at opt@tightenparagraphs\isTrue\filbreak\fi
 }
 \At\VeryBeginPartproblem{%
 	\stepcounter{partproblemcounter}%
-	\def\@pproblemHead{\large\textbf{(\theproblemcounter\alph{partproblemcounter})}}
 	\begin{addmargin}{\ppMargin}
-		\filbreak
+		\if\exbank at opt@tightenparagraphs\isTrue\filbreak\fi
 		\begin{itemize}
-			\item[\@pproblemHead]
+			\item[\exbank at opt@partProblemHeader]
 }
 \At\EndPartproblem{		\end{itemize}
 	\end{addmargin}
@@ -97,11 +125,9 @@
 	\vspace*{\pMarginBelow}%
 }
 \At\BeginSolution{	\vspace*{1em}
-	\def\@solutionHead{\large{\textbf{\@tr{Solution}:}}}
 	\begin{addmargin}{\solMargin}
-		\filbreak
 		\begin{itemize}
-			\item[\@solutionHead]
+			\item[\exbank at opt@solutionHeader]
 }
 \At\EndSolution{		\end{itemize}
 	\end{addmargin}
@@ -135,11 +161,20 @@
 \generalcomment{problem}{  \edef\DisplaySolution{\@DisplaySolutions}
   \Trigger\DecideProblemDisplay
   \begingroup
-     \showhideproblem{      \Trigger\BeginPartproblem
-      \Trigger\VeryBeginPartproblem
+     \showhideproblem{        \if\exbank at opt@partProblems\isTrue
+            \Trigger\BeginPartproblem
+            \Trigger\VeryBeginPartproblem
+        \else
+            \Trigger\BeginProblem
+            \Trigger\VeryBeginProblem
+        \fi
 }
 }{    \if\DisplayProblem\isFalse\else
-      \Trigger\EndPartproblem
+      \if\exbank at opt@partProblems\isTrue
+        \Trigger\EndPartproblem
+      \else
+        \Trigger\EndProblem
+      \fi
     \fi
   \endgroup
 }
@@ -307,7 +342,7 @@
   \@ifundefined{setlist@#2 at nohead}{\gdef\nohead{\isFalse}}{\gdef\nohead{\isTrue}}
   \xdef\setName{#2}
   \@ifundefined{setlist@#2}{    \@latex at error{Couldn't find set #2. Did you remember to do \string\makeset{#2}{}?}
-    \stop
+    \stop\bye
 }{}
   \edef\setlist{\csname setlist@#2\endcsname}
   \if\@spriteMode\isFalse
@@ -336,7 +371,10 @@
     \fi
     \if\nohead\isFalse\Trigger\VeryBeginProblem\fi
     \if\@spriteMode\isTrue\textbf{\exerciseFile.tex\\}\fi
-    \incl{\exercisesDir/\exerciseFile}
+    \IfFileExists{\@exercisesDir/\exerciseFile}{      \incl{\@exercisesDir/\exerciseFile}
+}{      \@latex at error{Could not find \@exercisesDir/\exerciseFile. Maybe it is because the default exercise directory is now changed to the same directory that your main file is in. To set default exercise directory to exercises, do \string\exercisebanksetup{exercise directory=exercises}}{}
+      \stop\bye
+}
     \if\nohead\isFalse\Trigger\EndProblem\fi
     \fi
 }



More information about the tex-live-commits mailing list