Skip to content
Snippets Groups Projects
Commit 3e21dfd1 authored by Jan Wille's avatar Jan Wille
Browse files

proper error handling for `\maketitle`

parent 10e6af8f
Branches
No related tags found
No related merge requests found
No preview for this file type
......@@ -17,7 +17,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesClass{HsH-article}
[2024-06-14 3.03.pre0 HsH-class based on KOMA]
[2024-06-15 3.03.pre1 HsH-class based on KOMA]
\let\HsHClassName\@currname
\def\HsHClassName@ParrentClass{%
scrartcl%
......@@ -463,6 +463,14 @@
\ofoot*{\pagemark}
\pagestyle{HsHheadings}
\automark{section}
\renewcommand\maketitle[1][c]{
\if#1l\@maketitle{#1}\else%
\if#1c\@maketitle{#1}\else%
\if#1r\@maketitle{#1}\else%
\ClassWarning{\HsHClassName}{unkown option for \maketitle}
\thispagestyle{empty}\null\clearpage
\fi\fi\fi
}
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{\global\@tabtoks\expandafter{\the\@tabtoks#1}}
\newcommand\eaddtabtoks[1]{\edef\mytmp{#1}\expandafter\addtabtoks\expandafter{\mytmp}}
......@@ -470,7 +478,7 @@
\newcommand*\printtabtoks{\the\@tabtoks}
\addtokomafont{publishers}{\normalsize}
\g@addto@macro\titlepage{\singlespacing}
\renewcommand\maketitle[1][c]{
\renewcommand*\@maketitle[1]{
\expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax
\else
\def\and{%
......@@ -495,13 +503,6 @@
}
\fi
\begingroup
\let\@param#1
\ifx\@param\@empty
\ClassError{\myClassName}{\maketitle\space with empty option}{
\maketitle[] has been called (with an empty parameter), this doesn't work.
Use \maketitle instead.
}
\fi
\let\titlepage@restore\relax
\renewcommand*\thefootnote{\@fnsymbol\c@footnote}%
\let\@oldmakefnmark\@makefnmark
......@@ -533,8 +534,8 @@
\null
\vskip 2em
\begingroup
\if\@param c\centering\fi
\if\@param r\raggedleft\fi
\if#1c\centering\fi
\if#1r\raggedleft\fi
\ifx\@subject\@empty\else
{\usekomafont{subject}{\@subject\par}}
\vskip 1.5em
......@@ -546,8 +547,8 @@
{\ifx\@matrikelnr\@empty
\if\@author\@empty\else\usekomafont{author}{
\parbox{\dimexpr\linewidth}{
\if\@param c\centering\fi
\if\@param r\raggedleft\fi
\if#1c\centering\fi
\if#1r\raggedleft\fi
\@author
}
}\fi
......@@ -557,9 +558,9 @@
\foreach \x [count=\i,evaluate=\i as \y using {{\@matrikelnr,}[\i-1]}] in \@author {\eaddtabtoks{\x & \y\protect\\}}
\usekomafont{author}{
\def\arraystretch{1.2}
\if\@param l\begin{tabular}{@{}l l}\fi
\if\@param c\begin{tabular}{l l}\fi
\if\@param r\begin{tabular}{r r@{}}\fi
\if#1l\begin{tabular}{@{}l l}\fi
\if#1c\begin{tabular}{l l}\fi
\if#1r\begin{tabular}{r r@{}}\fi
\printtabtoks
\end{tabular}
}%
......@@ -570,9 +571,9 @@
\vskip 1em
\usekomafont{publishers}{
\def\arraystretch{1.2}
\if\@param l\begin{tabular}{@{}l l}\fi
\if\@param c\begin{tabular}{l l}\fi
\if\@param r\begin{tabular}{r r@{}}\fi
\if#1l\begin{tabular}{@{}l l}\fi
\if#1c\begin{tabular}{l l}\fi
\if#1r\begin{tabular}{r r@{}}\fi
\if\@professor\@empty\else\textbf{\professorname:}&\@professor\\\fi
\if\@firstexaminer\@empty\else\textbf{\firstexaminername:}&\@firstexaminer\\\fi
\if\@secondexaminer\@empty\else\textbf{\secondexaminername:}&\@secondexaminer\\\fi
......
......@@ -74,7 +74,7 @@ http://www.latex-project.org/lppl.txt
%<report>\ProvidesClass{HsH-report}
%<standalone>\ProvidesClass{HsH-standalone}
%<*article|report|standalone>
[2024-06-14 3.03.pre0 HsH-class based on KOMA]
[2024-06-15 3.03.pre1 HsH-class based on KOMA]
%</article|report|standalone>
%<*driver> ^^A ---------- documentation driver -----------------------------------------
\documentclass{ltxdoc}
......@@ -1552,10 +1552,27 @@ http://www.latex-project.org/lppl.txt
% \subsubsection{Titlepage}
%
% \begin{macro}{\maketitle}
% The definiton of |\maketitle| is mostly taken from the source-code of the
% \KOMAScript{} parrentclass, but was modified to create the desired style.
% |\maketitle| is a wrapper for |\@maketitle| that just checks the
% parameter and issues an error message if it is incorrect.
% It also handles the diffrent default for article or report.
% \begin{macrocode}
%<*article|report>
%<article>\renewcommand\maketitle[1][c]{
%<report>\renewcommand\maketitle[1][l]{
\if#1l\@maketitle{#1}\else%
\if#1c\@maketitle{#1}\else%
\if#1r\@maketitle{#1}\else%
\ClassWarning{\HsHClassName}{unkown option for \maketitle}
\thispagestyle{empty}\null\clearpage
\fi\fi\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@maketitle}
% The definiton of |\@maketitle| is mostly taken from the source-code of the
% \KOMAScript{} parrentclass, but was modified to create the desired style.
% \begin{macrocode}
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{\global\@tabtoks\expandafter{\the\@tabtoks#1}}
\newcommand\eaddtabtoks[1]{\edef\mytmp{#1}\expandafter\addtabtoks\expandafter{\mytmp}}
......@@ -1564,8 +1581,7 @@ http://www.latex-project.org/lppl.txt
\addtokomafont{publishers}{\normalsize}
\g@addto@macro\titlepage{\singlespacing}
%
%<article>\renewcommand\maketitle[1][c]{
%<report>\renewcommand\maketitle[1][l]{
\renewcommand*\@maketitle[1]{
\expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax
\else
\def\and{%
......@@ -1593,13 +1609,6 @@ http://www.latex-project.org/lppl.txt
%</article>
%<report> \begin{titlepage}
%<article> \begingroup
\let\@param#1
\ifx\@param\@empty
\ClassError{\myClassName}{\maketitle\space with empty option}{
\maketitle[] has been called (with an empty parameter), this doesn't work.
Use \maketitle instead.
}
\fi
%<*report>
\if@titlepageiscoverpage
\edef\titlepage@restore{
......@@ -1684,8 +1693,8 @@ http://www.latex-project.org/lppl.txt
%<article> \vskip 2em
%<report> \vfill
\begingroup
\if\@param c\centering\fi
\if\@param r\raggedleft\fi
\if#1c\centering\fi
\if#1r\raggedleft\fi
\ifx\@subject\@empty\else
{\usekomafont{subject}{\@subject\par}}
%<article> \vskip 1.5em
......@@ -1699,8 +1708,8 @@ http://www.latex-project.org/lppl.txt
{\ifx\@matrikelnr\@empty
\if\@author\@empty\else\usekomafont{author}{
\parbox{\dimexpr\linewidth}{
\if\@param c\centering\fi
\if\@param r\raggedleft\fi
\if#1c\centering\fi
\if#1r\raggedleft\fi
\@author
}
}\fi
......@@ -1710,9 +1719,9 @@ http://www.latex-project.org/lppl.txt
\foreach \x [count=\i,evaluate=\i as \y using {{\@matrikelnr,}[\i-1]}] in \@author {\eaddtabtoks{\x & \y\protect\\}}
\usekomafont{author}{
\def\arraystretch{1.2}
\if\@param l\begin{tabular}{@{}l l}\fi
\if\@param c\begin{tabular}{l l}\fi
\if\@param r\begin{tabular}{r r@{}}\fi
\if#1l\begin{tabular}{@{}l l}\fi
\if#1c\begin{tabular}{l l}\fi
\if#1r\begin{tabular}{r r@{}}\fi
\printtabtoks
\end{tabular}
}%
......@@ -1725,9 +1734,9 @@ http://www.latex-project.org/lppl.txt
%<report> \vskip \z@ \@plus3fill
\usekomafont{publishers}{
\def\arraystretch{1.2}
\if\@param l\begin{tabular}{@{}l l}\fi
\if\@param c\begin{tabular}{l l}\fi
\if\@param r\begin{tabular}{r r@{}}\fi
\if#1l\begin{tabular}{@{}l l}\fi
\if#1c\begin{tabular}{l l}\fi
\if#1r\begin{tabular}{r r@{}}\fi
\if\@professor\@empty\else\textbf{\professorname:}&\@professor\\\fi
\if\@firstexaminer\@empty\else\textbf{\firstexaminername:}&\@firstexaminer\\\fi
\if\@secondexaminer\@empty\else\textbf{\secondexaminername:}&\@secondexaminer\\\fi
......
No preview for this file type
......@@ -17,7 +17,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesClass{HsH-report}
[2024-06-14 3.03.pre0 HsH-class based on KOMA]
[2024-06-15 3.03.pre1 HsH-class based on KOMA]
\let\HsHClassName\@currname
\def\HsHClassName@ParrentClass{%
scrreprt%
......@@ -477,6 +477,14 @@
\pagestyle{HsHheadings}
\automark{chapter}
\renewcommand*{\chapterpagestyle}{HsHheadings}
\renewcommand\maketitle[1][l]{
\if#1l\@maketitle{#1}\else%
\if#1c\@maketitle{#1}\else%
\if#1r\@maketitle{#1}\else%
\ClassWarning{\HsHClassName}{unkown option for \maketitle}
\thispagestyle{empty}\null\clearpage
\fi\fi\fi
}
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{\global\@tabtoks\expandafter{\the\@tabtoks#1}}
\newcommand\eaddtabtoks[1]{\edef\mytmp{#1}\expandafter\addtabtoks\expandafter{\mytmp}}
......@@ -484,7 +492,7 @@
\newcommand*\printtabtoks{\the\@tabtoks}
\addtokomafont{publishers}{\normalsize}
\g@addto@macro\titlepage{\singlespacing}
\renewcommand\maketitle[1][l]{
\renewcommand*\@maketitle[1]{
\expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax
\else
\def\and{%
......@@ -494,13 +502,6 @@
}
\fi
\begin{titlepage}
\let\@param#1
\ifx\@param\@empty
\ClassError{\myClassName}{\maketitle\space with empty option}{
\maketitle[] has been called (with an empty parameter), this doesn't work.
Use \maketitle instead.
}
\fi
\if@titlepageiscoverpage
\edef\titlepage@restore{
\noexpand\endgroup
......@@ -563,8 +564,8 @@
\null
\vfill
\begingroup
\if\@param c\centering\fi
\if\@param r\raggedleft\fi
\if#1c\centering\fi
\if#1r\raggedleft\fi
\ifx\@subject\@empty\else
{\usekomafont{subject}{\@subject\par}}
\vskip 3em
......@@ -576,8 +577,8 @@
{\ifx\@matrikelnr\@empty
\if\@author\@empty\else\usekomafont{author}{
\parbox{\dimexpr\linewidth}{
\if\@param c\centering\fi
\if\@param r\raggedleft\fi
\if#1c\centering\fi
\if#1r\raggedleft\fi
\@author
}
}\fi
......@@ -587,9 +588,9 @@
\foreach \x [count=\i,evaluate=\i as \y using {{\@matrikelnr,}[\i-1]}] in \@author {\eaddtabtoks{\x & \y\protect\\}}
\usekomafont{author}{
\def\arraystretch{1.2}
\if\@param l\begin{tabular}{@{}l l}\fi
\if\@param c\begin{tabular}{l l}\fi
\if\@param r\begin{tabular}{r r@{}}\fi
\if#1l\begin{tabular}{@{}l l}\fi
\if#1c\begin{tabular}{l l}\fi
\if#1r\begin{tabular}{r r@{}}\fi
\printtabtoks
\end{tabular}
}%
......@@ -600,9 +601,9 @@
\vskip \z@ \@plus3fill
\usekomafont{publishers}{
\def\arraystretch{1.2}
\if\@param l\begin{tabular}{@{}l l}\fi
\if\@param c\begin{tabular}{l l}\fi
\if\@param r\begin{tabular}{r r@{}}\fi
\if#1l\begin{tabular}{@{}l l}\fi
\if#1c\begin{tabular}{l l}\fi
\if#1r\begin{tabular}{r r@{}}\fi
\if\@professor\@empty\else\textbf{\professorname:}&\@professor\\\fi
\if\@firstexaminer\@empty\else\textbf{\firstexaminername:}&\@firstexaminer\\\fi
\if\@secondexaminer\@empty\else\textbf{\secondexaminername:}&\@secondexaminer\\\fi
......
......@@ -17,7 +17,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesClass{HsH-standalone}
[2024-06-14 3.03.pre0 HsH-class based on KOMA]
[2024-06-15 3.03.pre1 HsH-class based on KOMA]
\let\HsHClassName\@currname
\def\HsHClassName@ParrentClass{%
standalone%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment