From a1af51a0a5edf0f1aeb189886655bac570a3d466 Mon Sep 17 00:00:00 2001
From: Jan Wille <jan.wille@stud.hs-hannover.de>
Date: Thu, 21 Nov 2024 14:27:48 +0100
Subject: [PATCH] patch abstract enviroment to not produce double clearpages

this happend when using `\include` (which produces the first clearpage)  for the abstract (which clears the page when entering the env)
as the chapter started inside the `\quotation`, both pageclears executed fully and an empty page was shipped to the pdf.
---
 src/HsH-article.cls    | 10 +++++++---
 src/HsH-classes.dtx    | 11 +++++++++--
 src/HsH-classes.pdf    |  4 ++--
 src/HsH-report.cls     | 10 +++++++---
 src/HsH-standalone.cls |  4 ++--
 5 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/HsH-article.cls b/src/HsH-article.cls
index 5148676..646cb56 100644
--- a/src/HsH-article.cls
+++ b/src/HsH-article.cls
@@ -298,8 +298,8 @@
   }{}
 }
 \RequirePackage{scrhack}
-\AddToHook{package/siunitx/before}{\RequirePackage{xcolor}}
-\AddToHook{package/siunitx/after}{
+\AddToHook{package/listings/before}{\RequirePackage{xcolor}}
+\AddToHook{package/listings/after}{
   \lstset{
     commentstyle=\color{gray},
     keywordstyle=\color{FireBrick}\bfseries,
@@ -479,9 +479,13 @@
 \renewcommand{\labelitemiii}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}}
 \renewcommand{\labelitemiv}{\raisebox{.1ex}{-}}
 \renewenvironment{abstract}{
+  \begingroup
+    \edef\raggedsection{\raggedsection%
+      \hskip\leftmargini}
+    \HsH@abstract@heading{\abstractname}
+  \endgroup
   \quotation
   \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@heading{\abstractname}
 }{%
   \ifx\@keywords\@empty\else\if@HsH@option@abstract@show@keywords
     \par\bigskip
diff --git a/src/HsH-classes.dtx b/src/HsH-classes.dtx
index f863bcc..d0b4209 100644
--- a/src/HsH-classes.dtx
+++ b/src/HsH-classes.dtx
@@ -1582,13 +1582,20 @@ http://www.latex-project.org/lppl.txt
 %    \end{macrocode}
 %
 %     \paragraph{Abstract}
-%     We define some custom behavior for the abstract.
+%     We define some custom behavior for the abstract. Its typeset as a quote, so
+%     its a little smaller than the rest of the text. We also indent the heading to
+%     match that.
 %    \begin{macrocode}
 %<*!standalone>
 \renewenvironment{abstract}{
+  \begingroup
+%<article>    \edef\raggedsection{\raggedsection%
+%<report>    \edef\raggedchapter{\raggedchapter%
+      \hskip\leftmargini}
+    \HsH@abstract@heading{\abstractname}
+  \endgroup
   \quotation
   \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@heading{\abstractname}
 }{%
   \ifx\@keywords\@empty\else\if@HsH@option@abstract@show@keywords
     \par\bigskip
diff --git a/src/HsH-classes.pdf b/src/HsH-classes.pdf
index c276977..18ec272 100644
--- a/src/HsH-classes.pdf
+++ b/src/HsH-classes.pdf
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:b05e69d4ca6bf46617ec02aa4f403aee5da410bd8a23774a49945c9815dd2bb9
-size 329851
+oid sha256:b2c8c512067240d6aab00ca43324e05190f14837e44117a94d05e479589080a5
+size 304928
diff --git a/src/HsH-report.cls b/src/HsH-report.cls
index 1481a67..3ce504f 100644
--- a/src/HsH-report.cls
+++ b/src/HsH-report.cls
@@ -298,8 +298,8 @@
   }{}
 }
 \RequirePackage{scrhack}
-\AddToHook{package/siunitx/before}{\RequirePackage{xcolor}}
-\AddToHook{package/siunitx/after}{
+\AddToHook{package/listings/before}{\RequirePackage{xcolor}}
+\AddToHook{package/listings/after}{
   \lstset{
     commentstyle=\color{gray},
     keywordstyle=\color{FireBrick}\bfseries,
@@ -492,9 +492,13 @@
 \renewcommand{\labelitemiii}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}}
 \renewcommand{\labelitemiv}{\raisebox{.1ex}{-}}
 \renewenvironment{abstract}{
+  \begingroup
+    \edef\raggedchapter{\raggedchapter%
+      \hskip\leftmargini}
+    \HsH@abstract@heading{\abstractname}
+  \endgroup
   \quotation
   \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@heading{\abstractname}
 }{%
   \ifx\@keywords\@empty\else\if@HsH@option@abstract@show@keywords
     \par\bigskip
diff --git a/src/HsH-standalone.cls b/src/HsH-standalone.cls
index 8014e6e..b336a04 100644
--- a/src/HsH-standalone.cls
+++ b/src/HsH-standalone.cls
@@ -141,8 +141,8 @@
   }{}
 }
 \RequirePackage{scrhack}
-\AddToHook{package/siunitx/before}{\RequirePackage{xcolor}}
-\AddToHook{package/siunitx/after}{
+\AddToHook{package/listings/before}{\RequirePackage{xcolor}}
+\AddToHook{package/listings/after}{
   \lstset{
     commentstyle=\color{gray},
     keywordstyle=\color{FireBrick}\bfseries,
-- 
GitLab