From 10e6af8f9668eeb36bf326bc9c74ede98434c59c Mon Sep 17 00:00:00 2001
From: Jan Wille <jan.wille@stud.hs-hannover.de>
Date: Sat, 15 Jun 2024 13:54:04 +0200
Subject: [PATCH] fix abstract for article class

the environment was using `chapter` for all classes, but on article it needs to be sections
---
 CHANGELOG.md           |  4 ++++
 src/HsH-article.cls    | 14 ++++++++++----
 src/HsH-classes.dtx    | 19 +++++++++++++++----
 src/HsH-classes.pdf    |  4 ++--
 src/HsH-report.cls     | 14 ++++++++++----
 src/HsH-standalone.cls | 11 -----------
 6 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e237fff..dd933c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,10 @@ All notable changes to this project will be documented in this file.
   Here is a regex to fix existing code: `(?<=\\ifsingleauthor)(\{.*?\})\\else(\{.*?\})\\fi(\\space)?`
   which you can replace with `$1$2`.
 
+### Fixed
+
+- `abstract` not working for `hsh-article`
+
 ### Added
 
 - Using the `\and` command inside `\author` or `\matrikelnr` now works as expected (#21)
diff --git a/src/HsH-article.cls b/src/HsH-article.cls
index ebecc34..feca314 100644
--- a/src/HsH-article.cls
+++ b/src/HsH-article.cls
@@ -123,7 +123,9 @@
   \headheight=\HsH@opt@headheight%
 }
 \newif\if@HsH@option@abstract@show@keywords
-\def\HsH@abstract@chap{\addchap*}
+\def\HsH@abstract@heading{%
+  \addsec*%
+}
 \DefineFamilyKey{HsH}{abstract}{%
   \begingroup
   \FamilySetNumerical{HsH}{abstract}{@tempa}{%
@@ -142,10 +144,14 @@
       \@HsH@option@abstract@show@keywordsfalse
     \or% 2
       \endgroup
-      \def\HsH@abstract@chap{\addchap}
+      \def\HsH@abstract@heading{%
+        \addsec%
+      }
     \or% 3
       \endgroup
-      \def\HsH@abstract@chap{\addchap*}
+      \def\HsH@abstract@heading{%
+        \addsec*%
+      }
     \else% should never be
       \endgroup
     \fi
@@ -410,7 +416,7 @@
 \renewenvironment{abstract}{
   \quotation
   \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@chap{\abstractname}
+  \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 d2abd13..c79c9ec 100644
--- a/src/HsH-classes.dtx
+++ b/src/HsH-classes.dtx
@@ -669,7 +669,10 @@ http://www.latex-project.org/lppl.txt
 %     We first define the needed macros:
 %    \begin{macrocode}
 \newif\if@HsH@option@abstract@show@keywords
-\def\HsH@abstract@chap{\addchap*}
+\def\HsH@abstract@heading{%
+%<article>  \addsec*%
+%<report>  \addchap*%
+}
 %    \end{macrocode}
 %     Now the actuall option can be defiend to handle all the cases.
 %    \begin{macrocode}
@@ -691,10 +694,16 @@ http://www.latex-project.org/lppl.txt
       \@HsH@option@abstract@show@keywordsfalse
     \or% 2
       \endgroup
-      \def\HsH@abstract@chap{\addchap}
+      \def\HsH@abstract@heading{%
+%<article>        \addsec%
+%<report>        \addchap%
+      }
     \or% 3
       \endgroup
-      \def\HsH@abstract@chap{\addchap*}
+      \def\HsH@abstract@heading{%
+%<article>        \addsec*%
+%<report>        \addchap*%
+      }
     \else% should never be
       \endgroup
     \fi
@@ -1447,10 +1456,11 @@ http://www.latex-project.org/lppl.txt
 %     \paragraph{Abstract}
 %     We define some custom behavior for the abstract.
 %    \begin{macrocode}
+%<*!standalone>
 \renewenvironment{abstract}{
   \quotation
   \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@chap{\abstractname}
+  \HsH@abstract@heading{\abstractname}
 }{%
   \ifx\@keywords\@empty\else\if@HsH@option@abstract@show@keywords
     \par\bigskip
@@ -1458,6 +1468,7 @@ http://www.latex-project.org/lppl.txt
   \fi\fi\par
   \endquotation
 }
+%</!standalone>
 %    \end{macrocode}
 %
 %     \paragraph{Misc}
diff --git a/src/HsH-classes.pdf b/src/HsH-classes.pdf
index 2b97c7d..ba48d16 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:ab7947ef728c9fd89c76a603fc30eb8a1166bd88a46472ab29f6d6e65cd46793
-size 314708
+oid sha256:7849fd44b916d0c09a9a8001f12f4453db42e21b833ba9a6addc2ec55b6c6dd5
+size 314950
diff --git a/src/HsH-report.cls b/src/HsH-report.cls
index 49664ac..3c74cd9 100644
--- a/src/HsH-report.cls
+++ b/src/HsH-report.cls
@@ -123,7 +123,9 @@
   \headheight=\HsH@opt@headheight%
 }
 \newif\if@HsH@option@abstract@show@keywords
-\def\HsH@abstract@chap{\addchap*}
+\def\HsH@abstract@heading{%
+  \addchap*%
+}
 \DefineFamilyKey{HsH}{abstract}{%
   \begingroup
   \FamilySetNumerical{HsH}{abstract}{@tempa}{%
@@ -142,10 +144,14 @@
       \@HsH@option@abstract@show@keywordsfalse
     \or% 2
       \endgroup
-      \def\HsH@abstract@chap{\addchap}
+      \def\HsH@abstract@heading{%
+        \addchap%
+      }
     \or% 3
       \endgroup
-      \def\HsH@abstract@chap{\addchap*}
+      \def\HsH@abstract@heading{%
+        \addchap*%
+      }
     \else% should never be
       \endgroup
     \fi
@@ -423,7 +429,7 @@
 \renewenvironment{abstract}{
   \quotation
   \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@chap{\abstractname}
+  \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 b2a0019..29b2630 100644
--- a/src/HsH-standalone.cls
+++ b/src/HsH-standalone.cls
@@ -221,17 +221,6 @@
 \renewcommand{\labelitemii}{\raisebox{.3ex}{\scalebox{0.7}{$\circ$}}}
 \renewcommand{\labelitemiii}{\raisebox{.1ex}{-}}
 \renewcommand{\labelitemiv}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}}
-\renewenvironment{abstract}{
-  \quotation
-  \setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}\selectfont
-  \HsH@abstract@chap{\abstractname}
-}{%
-  \ifx\@keywords\@empty\else\if@HsH@option@abstract@show@keywords
-    \par\bigskip
-    \noindent\textbf{\keywordsname}\hskip 2em\@keywords
-  \fi\fi\par
-  \endquotation
-}
 \upsubscripts
 \raggedbottom
 \let\layercontentsmeasure\relax
-- 
GitLab