From d8ab76db54f37af41a1f434335e0288d2653eeaa Mon Sep 17 00:00:00 2001
From: Sebastian Kuhnert
Date: Thu, 29 Apr 2010 12:29:47 +0000
Subject: make lstlinsting environment work at the beginning of a solution

---
 exercisesheets.sty | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index a3b4d6b..a18768b 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -604,9 +604,17 @@
 \def\exsh@startsolution{\@afterindentfalse
   \vskip\pgfkeysvalueof{/exsh/above solution skip}\relax%
   {\parindent \z@
-    \pgfkeysvalueof{/exsh/solution title font}\nobreak
-    \pgfkeysvalueof{/exsh/strings/solution}:\par\nobreak}\nobreak%
-  \@afterheading
+    \pgfkeysvalueof{/exsh/solution title font}%
+    \pgfkeysvalueof{/exsh/strings/solution}:\par}\nobreak%
+  \@nobreaktrue
+  \everypar{%
+    \if@nobreak
+      \@nobreakfalse
+      \clubpenalty \@M
+    \else
+      \clubpenalty \@clubpenalty
+      \everypar{}%
+    \fi}%
 }%
 
 \long\def\exsh@skipsolution#1{%
-- 
cgit v1.2.3

