From 987336e6340e870414aea3ce425cdc39825abea8 Mon Sep 17 00:00:00 2001
From: Sebastian Kuhnert
Date: Thu, 13 Nov 2008 09:09:04 +0000
Subject: add name= option for exercises

---
 exercisesheets.sty | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index c616277..3cbdce2 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -1,5 +1,5 @@
-\def\fileversion{0.5c}
-\def\filedate{2008/11/03}
+\def\fileversion{0.5d}
+\def\filedate{2008/11/13}
 
 % TODO: allow \and in author and solutionsby
 
@@ -77,6 +77,7 @@
   note/.initial={},
   %
   % additional exercise info
+  name/.initial={},
   firstline/.initial={},
   points/.initial={},
   oral/.style={/exsh/points=oral},oral/.value forbidden,
@@ -440,23 +441,25 @@
       \pgfkeysvalueof{/exsh/points font}}%
     \appto\exsh@points{\egroup}%
   }%
-  \refstepcounter{section}%
   \ifthenelse{\equal{}{\pgfkeysvalueof{/exsh/firstline}}}{%
-    \@startsection{section}{1}{\z@}%
-    {\pgfkeysvalueof{/exsh/above exercise skip}}%
-    {1em}%
-    {\pgfkeysvalueof{/exsh/exercise title font}}%
-    [\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@shortpoints]{\noindent%
-      \pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@points}%
+    \def\exsh@firstline{}%
+  }{%
+    \edef\exsh@firstline{\pgfkeysvalueof{/exsh/firstline}}%
+    \preto\exsh@firstline{\quad\bgroup\normalfont\normalsize}%
+    \appto\exsh@firstline{\egroup}%
+  }%
+  \ifthenelse{\equal{}{\pgfkeysvalueof{/exsh/name}}}{%
+    \def\exsh@exname{}%
   }{%
-    \@startsection{section}{1}{\z@}%
-    {\pgfkeysvalueof{/exsh/above exercise skip}}%
-    {1em}%
-    {\pgfkeysvalueof{/exsh/exercise title font}}%
-    [\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@shortpoints]{\noindent%
-      \pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\quad%
-      {\normalfont\normalsize\pgfkeysvalueof{/exsh/firstline}}\exsh@points}%
+    \edef\exsh@exname{\space(\pgfkeysvalueof{/exsh/name})}%
   }%
+  \refstepcounter{section}%
+  \@startsection{section}{1}{\z@}%
+  {\pgfkeysvalueof{/exsh/above exercise skip}}%
+  {1em}% afterskip corrected below
+  {\pgfkeysvalueof{/exsh/exercise title font}}%
+  [\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@exname\exsh@shortpoints]{\noindent%
+    \pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@exname\exsh@firstline\exsh@points}%
   \unskip\vskip\pgfkeysvalueof{/exsh/below exercise title skip}\relax
   \@afterindentfalse
   \ignorespaces
-- 
cgit v1.2.3

