From 21a0ff7218f5ce3e3bf9b2ce694fd684019829e6 Mon Sep 17 00:00:00 2001
From: Sebastian Kuhnert
Date: Fri, 12 Feb 2010 14:43:59 +0000
Subject: fix whitespace bug if an exercise starts with a label and a list
 environment

---
 exercisesheets.sty | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index d9e9614..2a967c9 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -1,9 +1,9 @@
 %\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-%\RequirePackage{svn-prov}
-\def\exsh@version{0.5i}
-%\ProvidesPackageSVN{$Id$}[\exsh@version\space Typesetting of exercise sheets \revinfo]
-%\GetFileInfoSVN*
-%\message{`Typesetting of exercise sheets' \exsh@version\space <\filedate> (SVN Rev: \filerev)}
+\RequirePackage{svn-prov}
+\def\exsh@version{0.5j}
+\ProvidesPackageSVN{$Id$}[\exsh@version\space Typesetting of exercise sheets \revinfo]
+\GetFileInfoSVN*
+\message{`Typesetting of exercise sheets' \exsh@version\space <\filedate> (SVN Rev: \filerev)}
 
 % TODO: allow \and in author and solutionsby
 % TODO: fix "above hint skip"
@@ -531,10 +531,11 @@
     \pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@exname\exsh@firstline\exsh@points}%
   \unskip\vskip\pgfkeysvalueof{/exsh/below exercise title skip}\relax
   \@afterindentfalse
-  % ensure proper distances above environments that start with a new \par
-  \leavevmode
-  \ignorespaces
+  % Use \leavevmode to ensure proper distances above environments that start
+  % with a new \par. Make sure that a \label does not mess up the layout.
+  \@ifnextchar\label{\exsh@label}{\leavevmode\ignorespaces}%
 }{}
+\newcommand{\exsh@label}[2]{#1{#2}\leavevmode\ignorespaces}
 \providecommand{\exsh@startsection}[2][]{%
   \@startsection{section}{1}{\z@}%
   {\pgfkeysvalueof{/exsh/above exercise skip}}%
-- 
cgit v1.2.3

