aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Fuhlbrück2022-01-12 18:17:14 +0100
committerFrank Fuhlbrück2022-01-12 18:17:14 +0100
commit55041ec46666f0f40366c4c4b4ff68e7bf97eead (patch)
tree46e12c0975cd5072749fc66ddfc1d0fffacd8fa6
parent61c4c1776a667a4952e8f9817d545c55e50b8009 (diff)
downloadexercisesheets-55041ec46666f0f40366c4c4b4ff68e7bf97eead.tar.gz
exercisesheets-55041ec46666f0f40366c4c4b4ff68e7bf97eead.tar.bz2
exercisesheets-55041ec46666f0f40366c4c4b4ff68e7bf97eead.zip
v 0.10 - make some special behavior optional
-rw-r--r--README4
l---------examples/exercisesheets-beamer.sty1
l---------examples/exercisesheets.sty1
-rw-r--r--examples/exshexample.tex78
-rw-r--r--exercisesheets-beamer.sty89
-rw-r--r--exercisesheets.sty73
-rw-r--r--exercisesheets.tex33
7 files changed, 224 insertions, 55 deletions
diff --git a/README b/README
index 7d20557..b050f36 100644
--- a/README
+++ b/README
@@ -6,10 +6,10 @@ finally combined into this package.
Copyright (c) 2008-2022 Sebastian Kuhnert, Frank Fuhlbrück
Licence: LPPL 1.3c or later
-Current Maintainer: Sebastian Kuhnert
+Current Maintainer: Frank Fuhlbrück
Files belonging to this package:
exercisesheets.sty The package itself
exercisesheets.tex Documentation source
-exercisesheets.el Emacs integration
+exercisesheets.el Emacs integration (outdated)
README This file
diff --git a/examples/exercisesheets-beamer.sty b/examples/exercisesheets-beamer.sty
new file mode 120000
index 0000000..9e58b05
--- /dev/null
+++ b/examples/exercisesheets-beamer.sty
@@ -0,0 +1 @@
+../exercisesheets-beamer.sty \ No newline at end of file
diff --git a/examples/exercisesheets.sty b/examples/exercisesheets.sty
new file mode 120000
index 0000000..ce51e96
--- /dev/null
+++ b/examples/exercisesheets.sty
@@ -0,0 +1 @@
+../exercisesheets.sty \ No newline at end of file
diff --git a/examples/exshexample.tex b/examples/exshexample.tex
new file mode 100644
index 0000000..762b386
--- /dev/null
+++ b/examples/exshexample.tex
@@ -0,0 +1,78 @@
+\long\def\ifbeamer#1#2{#2}
+\ifbeamer{\documentclass{beamer}}{\documentclass{article}}
+
+%patchenumerate is the deafault
+\usepackage[patchenumerate=true]%
+ {exercisesheets\ifbeamer{-beamer}{}}
+\usepackage{varioref}
+\usepackage{hyperref}
+
+\begin{document}
+
+%Usually the person responsible for the entire course:
+\author{Exampleauthor}
+\date{Example term/semester}
+\title{Introduction to Exercise Sheets Creation}
+\subject{Introduction to Exercise Sheets Creation}
+%Only used for beamer at the moment:
+\exshset{exauthor={Author of exercises}}
+
+\ifbeamer{}{
+ \exshset{
+ %default is \clearpage
+ sheet start page action={\pagebreak[3]\hrule},
+ sheet end page action={\vspace{4mm}\hrule\vspace{2cm}},
+ }
+}
+
+\begin{sheet}[note={Learn how to create nice exercise sheets.},
+ date={Novanuar 42, -2022},title={First Sheet}]
+
+ \begin{exercise}[points={many, many},firstline={Read the manual.}]
+ \end{exercise}
+
+ \begin{exercise}[points={sum},firstline={After you read the manual:}]
+ Play around with this example. You might want to read further manuals like:
+ \begin{enumerate}
+ %pointsfloatright should be usually set globally
+ \item\points[pointsfloatright]{2}pgf (for pgfkeys)
+ \item enumitem and similar \points[abbrev,bonus]{1}
+ \begin{enumerate}
+ \item paralist
+ \item
+ \begin{enumerate}
+ \item varioref
+ \end{enumerate}
+ \end{enumerate}
+ \item all the others \points[inplace]{3} (why not?)
+ \label{subex:man2}
+ \end{enumerate}
+ \end{exercise}
+\end{sheet}
+
+\begin{sheet}[date={Novanuar 35, -2022}]
+ \begin{exercise}[points={many, many},
+ firstline={Read the manual.}]
+ \end{exercise}
+\end{sheet}
+
+\begin{sheet}[date={Novanuar 28, -2022},title={Third Sheet},
+ number within sheet]
+ \begin{exercise}[points={many, many},
+ firstline={Read the manual.}]
+ \end{exercise}
+\end{sheet}
+
+\begin{sheet}[date={Novanuar 21, -2022}]
+ \begin{exercise}[points={many, many},
+ firstline={Read the manual.}]
+ Observe how a sheet with title restarts the exercise numbering.
+ \end{exercise}
+
+ Loading varioref enables you to refer to sub-exercises, like
+ this: Did you do \ref{subex:man2}?
+\end{sheet}
+
+
+\end{document}
+
diff --git a/exercisesheets-beamer.sty b/exercisesheets-beamer.sty
index d1dafab..e901c34 100644
--- a/exercisesheets-beamer.sty
+++ b/exercisesheets-beamer.sty
@@ -1,5 +1,5 @@
%% exercisesheets-beamer.sty
-%% Copyright 2008-2020 Sebastian Kuhnert, Frank Fuhlbrück
+%% Copyright 2008-2022 Sebastian Kuhnert, Frank Fuhlbrück
%
% This work may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
@@ -10,7 +10,7 @@
%
% This work has the LPPL maintenance status `maintained'.
%
-% The Current Maintainer of this work is Sebastian Kuhnert.
+% The Current Maintainer of this work is Frank Fuhlbrück.
%
% This work consists of the files listed in README.
@@ -18,8 +18,8 @@
%\NeedsTeXFormat{LaTeX2e}[1994/12/01]
% don't forget to update the version and date in exercisesheets.tex
-\def\exsh@version{0.9-Beamer}
-\def\exsh@date{2021/12/07}
+\def\exsh@version{0.10-Beamer}
+\def\exsh@date{2022/01/12}
\ProvidesPackage{exercisesheets-beamer}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets]
\message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>}
@@ -27,7 +27,7 @@
% TODO: fix "above hint skip"
-\RequirePackage{etoolbox}[2008/06/28]
+\RequirePackage{etoolbox}%[2008/06/28]
\RequirePackage{scrlfile}
\RequirePackage{environ}
@@ -45,10 +45,12 @@
% configuration keys
+\newif\ifexsh@patchenumerate\exsh@patchenumeratetrue
\newif\ifexsh@solutions
\newif\ifexsh@oralsolutions
\newif\ifexsh@nonoralsolutions
\newif\ifexsh@samplesolutions
+\newif\ifexsh@exnumsheet
\newif\ifexsh@forcesample %force printing sample sol. of wrong type
\newif\ifexsh@beamerwithheadline
\newif\ifexsh@beamersolution
@@ -76,6 +78,8 @@
}
\pgfkeys{/exsh/.is family,/exsh,
+ patchenumerate/.is if=exsh@patchenumerate,
+ patchenumerate/.default=true,
solutions/.is choice,
solutions/true/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue,
solutions/oral/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionsfalse,
@@ -85,6 +89,8 @@
solutions/sample all/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue\exsh@samplesolutionstrue,
solutions/false/.code=\exsh@solutionsfalse\exsh@oralsolutionsfalse\exsh@nonoralsolutionsfalse,
solutions/.default=true,
+ number within sheet/.is if=exsh@exnumsheet,
+ number within sheet/.default=true,
forcesample/.is if=exsh@forcesample,
forcesample/.default=true,
filenameasexercisename/.is if=exsh@filenameasexercisename,
@@ -166,11 +172,18 @@
}
\pgfkeys{exsh,
+ %general package options
+ patchenumerate/.initial=true,
+ custom skip macro/.initial=\exsh@skipcustomstuff,
+ showtodos/.initial={false},
+ hidetodos/.style={/exsh/showtodos=false},
+ hidetodos/.value forbidden,
% additional sheet info
title/.initial={},
date/.initial={},
note/.initial={},
exauthor/.initial={\exsh@author},
+ number within sheet/.initial={false},
%
% additional exercise info
name/.initial={},
@@ -199,10 +212,6 @@
optional/.value forbidden,
exercisemark/.initial={},
difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden,
- custom skip macro/.initial=\exsh@skipcustomstuff,
- showtodos/.initial={false},
- hidetodos/.style={/exsh/showtodos=false},
- hidetodos/.value forbidden,
%
% translatable strings
strings/sheet/.initial={},
@@ -503,8 +512,11 @@
\def\thepage{\arabic{part}-\arabic{page}}%
}{%
\def\thepage{\arabic{page}}%
- \setcounter{section}{0}%
}%
+ \ifexsh@exnumsheet
+ \edef\exsh@exnumstore{\arabic{section}}
+ \setcounter{section}{0}%
+ \fi
\numdef\exsh@tmp{\value{part}+1}%
\exsh@checkrange{\exsh@tmp}%
\ifexsh@isinrange
@@ -523,6 +535,9 @@
\ifnum\value{page}=1\thispagestyle{empty}\fi
\pgfkeysvalueof{/exsh/sheet end page action}%
\endgroup
+ \ifexsh@exnumsheet
+ \setcounter{section}{\exsh@exnumstore}%
+ \fi
}
\listadd{\exsh@enums}{enumerate}
\listadd{\exsh@enums}{compactenum}
@@ -829,8 +844,18 @@
\setbeamercolor{block body}{bg=bg,fg=fg}
\block{}{\pgfkeysvalueof{/exsh/exercise title font}{#2}}\endblock
\endgroup
- \setbeamertemplate{enumerate items}{\insertenumlabel}
- \renewcommand{\insertenumlabel}{\alph{enumi})}
+ \ifexsh@patchenumerate
+ \setbeamertemplate{enumerate items}{\insertenumlabel}
+ \renewcommand{\insertenumlabel}{
+ \ifnum\@enumdepth=1
+ \alph{enumi})
+ \else\ifnum\@enumdepth=2
+ \arabic{enumii}.
+ \else
+ \roman{enumiii}
+ \fi\fi
+ }
+ \fi
}%
@@ -870,18 +895,36 @@
\AfterPackage*{varioref}{
\labelformat{section}{\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}}
- \labelformat{enumi}{\arabic{section}.\alph{enumi}}
}
-\AfterPackage*{paralist}{
- \setdefaultenum{(a)}{(1)}{i.}{A.}
-}
-\AfterPackage*{enumitem}{
- \setenumerate[1]{label=(\alph*)}
- \setenumerate[2]{label=(\arabic*)}
- \setenumerate[3]{label=\roman*.}
- \setenumerate[4]{label=\Alph.}
-}
-\def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}}
+
+\ifexsh@patchenumerate
+ \AfterPackage*{varioref}{
+ \labelformat{enumi}{\arabic{section}.\alph{enumi}}
+ }
+ \AfterPackage*{paralist}{
+ \setdefaultenum{(a)}{(1)}{i.}{A.}
+ }
+ \AfterPackage*{enumitem}{
+ \setenumerate[1]{label=(\alph*)}
+ \setenumerate[2]{label=(\arabic*)}
+ \setenumerate[3]{label=\roman*.}
+ \setenumerate[4]{label=\Alph.}
+ }
+ \def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}}
+ \AtEndPreamble{%
+ \@ifpackageloaded{paralist}{}{%
+ \@ifpackageloaded{enumitem}{}{%
+ \apptocmd{\enumerate}{
+ \ifnum\@enumdepth=1%
+ \def\labelenumi{(\alph{enumi})}
+ \def\labelenumii{\arabic{enumii}.}
+ \def\labelenumiii{\roman{enumiii}.}
+ \fi
+ }{}{}%
+ }%
+ }%
+ }%
+\fi
% reset equation numbering for each exercise
\@addtoreset{equation}{section}
diff --git a/exercisesheets.sty b/exercisesheets.sty
index 6af4ca1..2d8298d 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -10,7 +10,7 @@
%
% This work has the LPPL maintenance status `maintained'.
%
-% The Current Maintainer of this work is Sebastian Kuhnert.
+% The Current Maintainer of this work is Frank Fuhlbrück.
%
% This work consists of the files listed in README.
@@ -18,8 +18,8 @@
%\NeedsTeXFormat{LaTeX2e}[1994/12/01]
% don't forget to update the version and date in exercisesheets.tex
-\def\exsh@version{0.9}
-\def\exsh@date{2021/12/07}
+\def\exsh@version{0.10}
+\def\exsh@date{2022/01/12}
\ProvidesPackage{exercisesheets}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets]
\message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>}
@@ -27,7 +27,7 @@
% TODO: fix "above hint skip"
-\RequirePackage{etoolbox}[2008/06/28]
+\RequirePackage{etoolbox}%[2008/06/28]
\RequirePackage{scrlfile}
\RequirePackage{pgfkeys}
@@ -44,10 +44,12 @@
% configuration keys
+\newif\ifexsh@patchenumerate\exsh@patchenumeratetrue
\newif\ifexsh@solutions
\newif\ifexsh@oralsolutions
\newif\ifexsh@nonoralsolutions
\newif\ifexsh@samplesolutions
+\newif\ifexsh@exnumsheet
\newif\ifexsh@forcesample %force printing sample sol. of wrong type
\newif\ifexsh@gradingguides
\newif\ifexsh@inplace
@@ -92,6 +94,8 @@
}
\pgfkeys{/exsh/.is family,/exsh,
+ patchenumerate/.is if=exsh@patchenumerate,
+ patchenumerate/.default=true,
solutions/.is choice,
solutions/true/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue,
solutions/oral/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionsfalse,
@@ -101,6 +105,8 @@
solutions/sample all/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue\exsh@samplesolutionstrue,
solutions/false/.code=\exsh@solutionsfalse\exsh@oralsolutionsfalse\exsh@nonoralsolutionsfalse,
solutions/.default=true,
+ number within sheet/.is if=exsh@exnumsheet,
+ number within sheet/.default=true,
forcesample/.is if=exsh@forcesample,
forcesample/.default=true,
gradingguides/.is if=exsh@gradingguides,
@@ -183,11 +189,18 @@
}
\pgfkeys{exsh,
+ %general package options
+ patchenumerate/.initial=true,
+ custom skip macro/.initial=\exsh@skipcustomstuff,
+ showtodos/.initial={false},
+ hidetodos/.style={/exsh/showtodos=false},
+ hidetodos/.value forbidden,
% additional sheet info
title/.initial={},
date/.initial={},
note/.initial={},
exauthor/.initial={\exsh@author},
+ number within sheet/.initial={false},
%
% additional exercise info
name/.initial={},
@@ -212,10 +225,6 @@
optional/.value forbidden,
exercisemark/.initial={},
difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden,
- custom skip macro/.initial=\exsh@skipcustomstuff,
- showtodos/.initial={false},
- hidetodos/.style={/exsh/showtodos=false},
- hidetodos/.value forbidden,
%
% translatable strings
strings/sheet/.initial={},
@@ -516,8 +525,11 @@
\def\thepage{\arabic{part}-\arabic{page}}%
}{%
\def\thepage{\arabic{page}}%
- \setcounter{section}{0}%
}%
+ \ifexsh@exnumsheet
+ \edef\exsh@exnumstore{\arabic{section}}
+ \setcounter{section}{0}%
+ \fi
\numdef\exsh@tmp{\value{part}+1}%
\exsh@checkrange{\exsh@tmp}%
\ifexsh@isinrange
@@ -536,6 +548,9 @@
\ifnum\value{page}=1\thispagestyle{empty}\fi
\pgfkeysvalueof{/exsh/sheet end page action}%
\endgroup
+ \ifexsh@exnumsheet
+ \setcounter{section}{\exsh@exnumstore}%
+ \fi
}
\listadd{\exsh@enums}{enumerate}
\listadd{\exsh@enums}{compactenum}
@@ -879,18 +894,36 @@
\AfterPackage*{varioref}{
\labelformat{section}{\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}}
- \labelformat{enumi}{\arabic{section}.\alph{enumi}}
-}
-\AfterPackage*{paralist}{
- \setdefaultenum{(a)}{(1)}{i.}{A.}
}
-\AfterPackage*{enumitem}{
- \setenumerate[1]{label=(\alph*)}
- \setenumerate[2]{label=(\arabic*)}
- \setenumerate[3]{label=\roman*.}
- \setenumerate[4]{label=\Alph.}
-}
-\def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}}
+
+\ifexsh@patchenumerate
+ \AfterPackage*{varioref}{
+ \labelformat{enumi}{\arabic{section}.\alph{enumi}}
+ }
+ \AfterPackage*{paralist}{
+ \setdefaultenum{(a)}{(1)}{i.}{A.}
+ }
+ \AfterPackage*{enumitem}{
+ \setenumerate[1]{label=(\alph*)}
+ \setenumerate[2]{label=(\arabic*)}
+ \setenumerate[3]{label=\roman*.}
+ \setenumerate[4]{label=\Alph.}
+ }
+ \def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}}
+ \AtEndPreamble{%
+ \@ifpackageloaded{paralist}{}{%
+ \@ifpackageloaded{enumitem}{}{%
+ \apptocmd{\enumerate}{
+ \ifnum\@enumdepth=1%
+ \def\labelenumi{(\alph{enumi})}
+ \def\labelenumii{\arabic{enumii}.}
+ \def\labelenumiii{\roman{enumiii}.}
+ \fi
+ }{}{}%
+ }%
+ }%
+ }%
+\fi
% reset equation numbering for each exercise
\@addtoreset{equation}{section}
diff --git a/exercisesheets.tex b/exercisesheets.tex
index b1d0fff..a8bf2ff 100644
--- a/exercisesheets.tex
+++ b/exercisesheets.tex
@@ -1,5 +1,5 @@
%% exercisesheets.tex
-%% Copyright 2008-2017 Sebastian Kuhnert, Frank Fuhlbrück
+%% Copyright 2008-2022 Sebastian Kuhnert, Frank Fuhlbrück
%
% This work may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
@@ -10,7 +10,7 @@
%
% This work has the LPPL maintenance status `maintained'.
%
-% The Current Maintainer of this work is Sebastian Kuhnert.
+% The Current Maintainer of this work is Frank Fuhlbrück.
%
% This work consists of the files listed in README.
@@ -53,7 +53,7 @@
\usepackage[english,iso]{isodate}
\title{The \exsh Package}
\author{Sebastian Kuhnert\and Frank Fuhlbrück}
-\date{Version 0.9, \printdateTeX{2022/01/07}}
+\date{Version 0.10, \printdateTeX{2022/01/12}}
\begin{document}
\maketitle
@@ -179,12 +179,18 @@ The following options are available:
\item[\option{exercisespath}] Set the (relative) path of the
directory containing exercises to be included via
\verb|\includeexercise|.
+ \item[\option{patchenumerate}\opt{=\param{true/false}}] Sets
+ enumerate item labels for the first four levels, starting with
+ a), b) etc. for the top-level (sub-exercises). Depending on other
+ loaded packages (\verb|enumitem|, \verb|paralist|) the mechanism
+ slightly differs. This option is active by default.
+
\item[\option{showtodos} / \option{hidetodos}]
\verb|\TODO| markers
are hidden by default, this option switches their behavior. This
option is usually set within \verb|\ifsamplesolutions| or
similar.
- \item[\option{beamercompatibility}]
+ \item[\option{beamercompatibility}\opt{=\param{true/false}}]
This options (which only is effective in the non-beamer version)
defines several beamer macros with as trivial
effects as possible, e.g., \verb|\pause| becomes \verb|\relax|
@@ -192,7 +198,9 @@ The following options are available:
this option after loading \verb|enumitem| etc. as the enumerate
and itemize environment are defined to swallow overlay
specifications without effect, this also holds for
- \verb|\item<1->|. The current list of redefinitions is as
+ \verb|\item<1->|. If you load \verb|exercisesheets| before them
+ use \verb|\exshset| afterwards.
+ The current list of redefinitions is as
follows:
\begin{lstlisting}
\let\pause\relax
@@ -275,10 +283,15 @@ The following \param{options} are supported:
Useful to inform students when the sheet is due. If you want a note consisting
of more than one line split at a particular position, use
\verb|\protect\linebreak|.
- \item[\option{title=\param{title}}] Deviate from the usual numbering theme and
- directly set the sheet title. When this option is used, exercise numbers are
- reset and different page numbering conventions are used. This is useful to
- typeset exams.
+ \item[\option{title=\param{title}}]
+ Directly set the sheet title. When this option is used, different
+ page numbering conventions are used. This is useful to
+ typeset exams (combined with the next option).
+ \item[\option{number within sheet\opt{=\param{true/false}}}]
+ Deviate from the usual numbering theme and
+ restart from one for exercises on the sheet. The previous
+ counter value is restored after the sheet, so you can insert
+ a special sheet.
\item[\option{author=\param{author}}] Set the author included in the sheet
head. By default, the value passed to \verb|\author| is used.
\item[\option{exauthor=\param{exauthor}}] Only used by \exsh-beamer,
@@ -410,7 +423,7 @@ TODO markers (s.a.) the warning will be issued nevertheless.
\subsection{Annotating Points for Sub-Exercises}
\begin{lstlisting}
-\begin{exercise}[points=10]
+\begin{exercise}[points=sum]%sum produces 7+6
\begin{enumerate}
\item Part 1 \points{oral}
\item Part 2 \points[optional]{oral}