From 2e3297c9f6f67990f208664983edc86ed103df9b Mon Sep 17 00:00:00 2001
From: Jan Wille <jan.wille@stud.hs-hannover.de>
Date: Fri, 14 Jun 2024 12:58:41 +0200
Subject: [PATCH] allow for `\and` to be used

IN typical LaTeX, the `\and` command is used inside `\author` to separate multiple authors, this allows for that.
---
 CHANGELOG.md        |  4 ++++
 src/HsH-Logo.pdf    |  4 ++--
 src/HsH-article.cls |  6 ++++--
 src/HsH-classes.dtx | 30 +++++++++++++++++++++++-------
 src/HsH-classes.pdf |  4 ++--
 src/HsH-report.cls  |  6 ++++--
 test.pdf            |  4 ++--
 test.tex            |  6 +++++-
 8 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0223257..e237fff 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`.
 
+### Added
+
+- Using the `\and` command inside `\author` or `\matrikelnr` now works as expected (#21)
+
 ## [3.2]
 
 ### Fixed
diff --git a/src/HsH-Logo.pdf b/src/HsH-Logo.pdf
index cf3b12a..eb0c23a 100644
--- a/src/HsH-Logo.pdf
+++ b/src/HsH-Logo.pdf
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:76197994ebca0e82c4fb4be663c9df2123c74d05991ca492fbfd44d8c0568a95
-size 25798
+oid sha256:d010945bf17d80d935a688d9c484c2424d6aa99c01fe1ddf74e330f3e13cef8d
+size 25799
diff --git a/src/HsH-article.cls b/src/HsH-article.cls
index a694c7f..218862e 100644
--- a/src/HsH-article.cls
+++ b/src/HsH-article.cls
@@ -312,13 +312,15 @@
     }
   }
 }
-\let\@author\@empty
 \renewcommand{\title}[2][]{
   \gdef\@title{#2}
   \gdef\@shorttitle{#1}
 }
 \def\@shorttitle{\@empty}
-\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}}
+\def\gdef@with@and@as@comma#1#2{{\def\and{,}\xdef#1{#2}}}
+\renewcommand{\author}[1]{\gdef@with@and@as@comma\@author{#1}}
+\let\@author\@empty
+\newcommand{\matrikelnr}[1]{\gdef@with@and@as@comma\@matrikelnr{#1}}
 \def\@matrikelnr{\@empty}
 \newcommand{\professor}[1]{\gdef\@professor{#1}}
 \def\@professor{\@empty}
diff --git a/src/HsH-classes.dtx b/src/HsH-classes.dtx
index 8459c89..07122b8 100644
--- a/src/HsH-classes.dtx
+++ b/src/HsH-classes.dtx
@@ -1160,12 +1160,6 @@ http://www.latex-project.org/lppl.txt
 %     how the user can define the differnt datafields.
 %     \smallskip
 %
-%     First the |\@author| macro is set to |\@empty|, this makes it easyer to handle it
-%     later.
-%    \begin{macrocode}
-\let\@author\@empty
-%    \end{macrocode}
-%
 %     \begin{macro}{\title}
 %       We redefine the |\title| command to take a optional argument. This is stored in
 %       the additional |\@shorttitle| macro.
@@ -1185,11 +1179,33 @@ http://www.latex-project.org/lppl.txt
 %    \end{macrocode}
 %     \end{macro}
 %
+%     \begin{macro}{\gdef@with@and@as@comma}
+%       First we define a helpermacro that will fill a given macro while treating the
+%       |\and| command as a comma. This is needed for |\author| and |\matrikelnr| where
+%       we later treat them as comma-seperated lists when the titlepage gets constructed.
+%    \begin{macrocode}
+\def\gdef@with@and@as@comma#1#2{{\def\and{,}\xdef#1{#2}}}
+%    \end{macrocode}
+%     \end{macro}
+%
+%     \begin{macro}{\author}
+%       We redefine the |\author| command so that it sets |\@author|, but allowing for both
+%       comma and |\and| to be used as a seperator.
+%    \begin{macrocode}
+\renewcommand{\author}[1]{\gdef@with@and@as@comma\@author{#1}}
+%    \end{macrocode}
+%     The |\@author| macro is also set to |\@empty|, this makes it easier to handle it
+%     later.
+%    \begin{macrocode}
+\let\@author\@empty
+%    \end{macrocode}
+%     \end{macro}
+%
 %     \begin{macro}{\matrikelnr,\@matrikelnr}
 %       These macros set and store the matrikel-number (or set of numbers), which will
 %       be printed on the titlepage.
 %    \begin{macrocode}
-\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}}
+\newcommand{\matrikelnr}[1]{\gdef@with@and@as@comma\@matrikelnr{#1}}
 \def\@matrikelnr{\@empty}
 %    \end{macrocode}
 %     \end{macro}
diff --git a/src/HsH-classes.pdf b/src/HsH-classes.pdf
index 02498f0..5cbd66a 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:8bf02dfeda7b514c84f7b75224d71737e69a3d3d11034ca919e37fb2328f8e1c
-size 313902
+oid sha256:bd770da07ea6e76086af2b64a0c586218e56a12b1e0d36d4c603989ad9aee7a2
+size 314585
diff --git a/src/HsH-report.cls b/src/HsH-report.cls
index 82b5dc4..7276de9 100644
--- a/src/HsH-report.cls
+++ b/src/HsH-report.cls
@@ -325,13 +325,15 @@
     }
   }
 }
-\let\@author\@empty
 \renewcommand{\title}[2][]{
   \gdef\@title{#2}
   \gdef\@shorttitle{#1}
 }
 \def\@shorttitle{\@empty}
-\newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}}
+\def\gdef@with@and@as@comma#1#2{{\def\and{,}\xdef#1{#2}}}
+\renewcommand{\author}[1]{\gdef@with@and@as@comma\@author{#1}}
+\let\@author\@empty
+\newcommand{\matrikelnr}[1]{\gdef@with@and@as@comma\@matrikelnr{#1}}
 \def\@matrikelnr{\@empty}
 \newcommand{\professor}[1]{\gdef\@professor{#1}}
 \def\@professor{\@empty}
diff --git a/test.pdf b/test.pdf
index 57c05de..739ca9d 100644
--- a/test.pdf
+++ b/test.pdf
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:9b6b7de03c45c0bbfb574163244db23a16043865028914163b61f57542abb078
-size 239184
+oid sha256:00b82d6601c04ba5bbec6c77209727feacf5e30723f3f90b058f969b21cb8e17
+size 240013
diff --git a/test.tex b/test.tex
index e1e9850..bc77eae 100644
--- a/test.tex
+++ b/test.tex
@@ -6,9 +6,13 @@
 
 %% documents personal data:
 \author{
-	Max Mustermann,
+	Max Mustermann \and
 	Mira Musterfrau
 }
+\matrikelnr{
+	12345678,
+	12345
+}
 \titlehead{titlehead}
 \subject{Subject}
 \title{long and elaborate title that just goes on and on without stopping}
-- 
GitLab