From 4e99115e1b920533add9368af9df9ffe2f02727e Mon Sep 17 00:00:00 2001
From: Jan Wille <jan.wille@stud.hs-hannover.de>
Date: Mon, 28 Mar 2022 17:50:40 +0200
Subject: [PATCH] load the caption package to fix #6

---
 CHANGELOG.md        | 4 ++++
 HsH-classes.dtx     | 6 +++++-
 README.md           | 1 +
 src/HsH-article.cls | 4 +++-
 src/HsH-report.cls  | 4 +++-
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d829684..16fdfd2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.
 
 ### Added
 - defined `\fronmatter`, `\mainmatter` and `\backmatter` for HsH-report class
+- included the caption package to fix #6
+
+### Fixes
+- references now get point to the to of floats, not to the captions position (#6)
 
 
 ## [1.3] - 2022-03-07
diff --git a/HsH-classes.dtx b/HsH-classes.dtx
index 0aaad61..6db78ae 100644
--- a/HsH-classes.dtx
+++ b/HsH-classes.dtx
@@ -115,6 +115,10 @@
 \PassOptionsToPackage{hidelinks}{hyperref}
 \RequirePackage{hyperref}
 %
+% put anchors at the beginning of floats
+\PassOptionsToPackage{hypcap=true}{caption}
+\RequirePackage{caption}
+%
 % generat bookmarkes
 \RequirePackage{bookmark}
 %
@@ -184,7 +188,7 @@
 % center all floats
   \g@addto@macro\@floatboxreset\centering
 % center all captions
-  \setcapwidth[c]{0.8\textwidth}
+  \setcapwidth{0.8\textwidth}
 \fi
 % abbreviations for names:
 \if@german
diff --git a/README.md b/README.md
index fbb0599..3e6f876 100644
--- a/README.md
+++ b/README.md
@@ -124,6 +124,7 @@ used in pretty much every project anyway.
  - `pgffor` allows for the use of for-loops (internal)
  - `graphicx` for importing images
  - `hyperref` for references and links
+ - `caption` to customise captions and make references point to the begining of the floats
  - `bookmark` for bookmarking
  - `amsmath` for a lot of general purpose maths features
  - `csquotes` makes quotations easier
diff --git a/src/HsH-article.cls b/src/HsH-article.cls
index dbb7391..cb98b42 100644
--- a/src/HsH-article.cls
+++ b/src/HsH-article.cls
@@ -87,6 +87,8 @@
 \RequirePackage{scrhack}
 \PassOptionsToPackage{hidelinks}{hyperref}
 \RequirePackage{hyperref}
+\PassOptionsToPackage{hypcap=true}{caption}
+\RequirePackage{caption}
 \RequirePackage{bookmark}
 \PassOptionsToPackage{babel}{csquotes}
 \if@german\PassOptionsToPackage{german=quotes}{csquotes}\fi
@@ -129,7 +131,7 @@
 \renewcommand{\fps@table}{h!t}
 \ifx\KOMAScriptVersion\undefined\else
   \g@addto@macro\@floatboxreset\centering
-  \setcapwidth[c]{0.8\textwidth}
+  \setcapwidth{0.8\textwidth}
 \fi
 \if@german
   \renewcaptionname{ngerman}{\figurename}{Abb.}
diff --git a/src/HsH-report.cls b/src/HsH-report.cls
index d26c094..c990fe3 100644
--- a/src/HsH-report.cls
+++ b/src/HsH-report.cls
@@ -87,6 +87,8 @@
 \RequirePackage{scrhack}
 \PassOptionsToPackage{hidelinks}{hyperref}
 \RequirePackage{hyperref}
+\PassOptionsToPackage{hypcap=true}{caption}
+\RequirePackage{caption}
 \RequirePackage{bookmark}
 \PassOptionsToPackage{babel}{csquotes}
 \if@german\PassOptionsToPackage{german=quotes}{csquotes}\fi
@@ -130,7 +132,7 @@
 \renewcommand{\fps@table}{h!t}
 \ifx\KOMAScriptVersion\undefined\else
   \g@addto@macro\@floatboxreset\centering
-  \setcapwidth[c]{0.8\textwidth}
+  \setcapwidth{0.8\textwidth}
 \fi
 \if@german
   \renewcaptionname{ngerman}{\figurename}{Abb.}
-- 
GitLab