Rename class to uhhassignment

This commit is contained in:
Kim Wittenburg
2017-04-23 16:01:46 +02:00
parent 6e9d56545d
commit 7efd12e824
3 changed files with 262 additions and 243 deletions

View File

@@ -1,10 +1,10 @@
%% %%
%% This is file `homework.cls', %% This is file `uhhassignment.cls',
%% generated with the docstrip utility. %% generated with the docstrip utility.
%% %%
%% The original source files were: %% The original source files were:
%% %%
%% homework.dtx (with options: `class') %% uhhassignment.dtx (with options: `class')
%% %%
%% Copyright (C) 2017 by Kim Wittenburg %% Copyright (C) 2017 by Kim Wittenburg
%% %%
@@ -19,29 +19,38 @@
%% LaTeX version 2005/12/01 or later. %% LaTeX version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[2005/12/01] \NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{homework}[2017/04/15 v1.1 The Homework Class] \ProvidesClass{uhhassignment}[2017/04/21 v1.0 The UHH-Assignment Class]
\newif\ifhomework@shorttitle \newif\ifuhhassignment@numberedsheets
\DeclareOption{unnumberedsheets}{
\uhhassignment@numberedsheetsfalse
}
\DeclareOption{numberedsheets}{
\uhhassignment@numberedsheetstrue
}
\newif\ifuhhassignment@shorttitle
\DeclareOption{shorttitle}{ \DeclareOption{shorttitle}{
\homework@shorttitletrue \uhhassignment@shorttitletrue
} }
\DeclareOption{longtitle}{ \DeclareOption{longtitle}{
\homework@shorttitlefalse \uhhassignment@shorttitlefalse
} }
\newif\ifhomework@shortheader \newif\ifuhhassignment@shortheader
\DeclareOption{shortheader}{ \DeclareOption{shortheader}{
\homework@shortheadertrue \uhhassignment@shortheadertrue
} }
\DeclareOption{longheader}{ \DeclareOption{longheader}{
\homework@shortheaderfalse \uhhassignment@shortheaderfalse
} }
\ExecuteOptions{longtitle,longheader} \ExecuteOptions{longtitle,longheader,numberedsheets}
\ProcessOptions\relax \ProcessOptions\relax
\LoadClassWithOptions{scrartcl} \LoadClassWithOptions{scrartcl}
@@ -50,7 +59,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi
\RequirePackage[utf8]{inputenc} % UTF-8 Encoding \RequirePackage[utf8]{inputenc} % UTF-8 Encoding
\RequirePackage{cmap} % Special Character \RequirePackage{cmap} % Special Characters
\RequirePackage[T1]{fontenc} % Font Encoding \RequirePackage[T1]{fontenc} % Font Encoding
\RequirePackage[ngerman]{babel} % German Language \RequirePackage[ngerman]{babel} % German Language
\RequirePackage{etoolbox} % Programming \RequirePackage{etoolbox} % Programming
@@ -65,11 +74,22 @@
\RequirePackage[headsepline]{scrlayer-scrpage} % Header and Footer \RequirePackage[headsepline]{scrlayer-scrpage} % Header and Footer
\RequirePackage{lastpage} % Page Numbers \RequirePackage{lastpage} % Page Numbers
\RequirePackage{amsmath} % Maths
\RequirePackage{amssymb} % Maths
\RequirePackage{amsthm} % Beweise
\RequirePackage{enumitem} % Customizable Enumerations
\RequirePackage{xcolor} % Colors \RequirePackage{xcolor} % Colors
\RequirePackage{framed} % Colored Boxes \RequirePackage{framed} % Colored Boxes
\RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References \RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References
\RequirePackage{lmodern} % Better Font \RequirePackage{lmodern} % Better Font
%%%%%%%%%% Constants %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi
\def\uhhassignment@sheetid{Aufgabenblatt}
\def\uhhassignment@groupid{Übungsgruppe}
%%%%%%% Custom Commands %%%%%% %%%%%%% Custom Commands %%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi
@@ -106,10 +126,12 @@
\newcommand{\id}[1]{\\\ttfamily\footnotesize(#1)} \newcommand{\id}[1]{\\\ttfamily\footnotesize(#1)}
\university[Uni Hamburg]{Universität Hamburg} \university[Uni Hamburg]{Universität Hamburg}
\course{} \def\@course{\ClassWarning{uhhassignment}{No \protect\course\space given}}
\let\@shortcourse\@course
\group{} \group{}
\teacher{} \def\@teacher{\ClassWarning{uhhassignment}{No \protect\teacher\space given}}
\sheetno{} \let\@shortteacher\@teacher
\def\@sheetno{\ClassWarning{uhhassignment}{No \protect\sheetno\space given}}
\title{} \title{}
@@ -135,12 +157,8 @@
} }
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
\newif\if@tasknumbers
\@tasknumberstrue
\newcounter{task} \newcounter{task}
\newcommand{\task}[2][]{% \newcommand{\task}[2][]{%
\ifstrempty{#1}{% \ifstrempty{#1}{%
@@ -148,15 +166,11 @@
}{% }{%
\setcounter{task}{#1}% \setcounter{task}{#1}%
}% }%
\if@tasknumbers% \ifstrempty{#2}{%
\ifstrempty{#2}{% \section{Aufgabe \arabic{task}}%
\section{Aufgabe \arabic{task}}% }{%
}{% \section{Aufgabe \arabic{task}: #2}%
\section{Aufgabe \arabic{task}: #2}% }%
}%
\else%
\section{#2}%
\fi%
} }
\newcounter{subtask}[task] \newcounter{subtask}[task]
@@ -166,15 +180,11 @@
}{% }{%
\setcounter{subtask}{#1}% \setcounter{subtask}{#1}%
}% }%
\if@tasknumbers% \ifstrempty{#2}{%
\ifstrempty{#2}{% \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}%
\subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% }{%
}{% \subsection{\arabic{task}.\arabic{subtask}. #2}%
\subsection{\arabic{task}.\arabic{subtask}. #2}% }%
}%
\else%
\subsection{#2}%
\fi%
} }
\newcounter{subsubtask}[subtask] \newcounter{subsubtask}[subtask]
@@ -184,15 +194,11 @@
}{% }{%
\setcounter{subsubtask}{#1}% \setcounter{subsubtask}{#1}%
}% }%
\if@tasknumbers% \ifstrempty{#2}{%
\ifstrempty{#2}{% \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}}
\subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} }{%
}{% \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}%
\subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% }%
}%
\else%
\subsubsection{#2}%
\fi%
} }
%%%%%%%%% Page Setup %%%%%%%%% %%%%%%%%% Page Setup %%%%%%%%%
@@ -203,11 +209,19 @@
\pagestyle{scrheadings} \pagestyle{scrheadings}
\clearpairofpagestyles \clearpairofpagestyles
\ifhomework@shortheader \ifuhhassignment@shortheader
\ihead{\textbf{\@shortcourse}\\Aufgabenblatt \@sheetno} \ifuhhassignment@numberedsheets
\ihead{\textbf{\@shortcourse}\\\uhhassignment@sheetid{} \@sheetno}
\else
\ihead{\textbf{\@shortcourse}}
\fi
\ohead{\textbf{\@shortuniversity}\\\@date} \ohead{\textbf{\@shortuniversity}\\\@date}
\else \else
\ihead{\textbf{\@course}\\Aufgabenblatt \@sheetno} \ifuhhassignment@numberedsheets
\ihead{\textbf{\@course}\\\uhhassignment@sheetid{} \@sheetno}
\else
\ihead{\textbf{\@course}}
\fi
\ohead{\textbf{\@university}\\\@date} \ohead{\textbf{\@university}\\\@date}
\fi \fi
@@ -215,7 +229,7 @@
\cfoot[Seite \pagemark{} von \pageref{LastPage}]{Seite \pagemark{} von \pageref{LastPage}} \cfoot[Seite \pagemark{} von \pageref{LastPage}]{Seite \pagemark{} von \pageref{LastPage}}
\newpagestyle{firstpage}[]{% \newpagestyle{firstpage}[]{%
\ihead{h} \ihead{}
\cfoot{\pagemark{}} \cfoot{\pagemark{}}
} }
@@ -223,11 +237,11 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi
\setlength{\parindent}{0em}
\setlength{\parskip}{5pt} \setlength{\parskip}{5pt}
\setkomafont{section}{\normalfont\bfseries\Large} \setkomafont{section}{\normalfont\bfseries\LARGE}
\setkomafont{subsection}{\normalfont\bfseries\large} \setkomafont{subsection}{\normalfont\bfseries\Large}
\setkomafont{subsubsection}{\normalfont\bfseries\large}
\RedeclareSectionCommands[afterskip=.25\baselineskip]{section} \RedeclareSectionCommands[afterskip=.25\baselineskip]{section}
\RedeclareSectionCommands[ \RedeclareSectionCommands[
beforeskip=0.5\baselineskip, beforeskip=0.5\baselineskip,
@@ -239,40 +253,14 @@
\newif\ifextended \newif\ifextended
\extendedtrue \extendedtrue
\def\homework@university{\@university} \ifuhhassignment@shorttitle
\def\homework@course{\@course} \let\university\@shortuniversity
\ifhomework@shorttitle \let\course\@shortcourse
\def\homework@university{\@shortuniversity}
\def\homework@course{\@shortcourse}
\else \else
\def\homework@university{\@university} \let\university\@university
\def\homework@course{\@course} \let\course\@course
\fi \fi
% \end{macrocode}
% First we define the different layout parts. The title has six \emph{slots}
% each of which can hold a piece of text:
% \begin{description}
% \item[Top Left] On the top left the course name ist printed in a bold
% font.
% \item[Top Right] On the top right the name of the university is printed
% in a bold font.
% \item[Meta Left] Below the course name a piece of information is
% printed. The contents of this slot depend on the
% specified information and can be either the group
% number or the teacher.
% \item[Meta Right] Similar to meta left but below the university name.
% This slot typically holds the teacher or the date.
% \item[Title Left] Above the actual title there is a row of secondary
% titles. On the left of this row the sheet number is
% printed.
% \item[Title Right] Similarly to title left this slot may contain the
% date.
% \end{description}
% Below the header the actual document title and the author(s) are printed.
% If no |\title| is specified the sheet number becomes the title (|\title|
% however remains empfy).
% \begin{macrocode}
\ifdefempty{\@title}{% \ifdefempty{\@title}{%
\ifdefempty{\@group}{% \ifdefempty{\@group}{%
\def\metaleft{\@teacher}% \def\metaleft{\@teacher}%
@@ -280,40 +268,40 @@
\def\titleright{}% \def\titleright{}%
\extendedfalse \extendedfalse
}{% }{%
\def\metaleft{Übungsgruppe \@group}% \def\metaleft{\uhhassignment@sheetid{} \@group}%
\def\metaright{\@teacher}% \def\metaright{\@teacher}%
\def\titleright{\@date}% \def\titleright{\@date}%
}% }%
\def\titleleft{}% \def\titleleft{}%
\def\title{Aufgabenblatt \@sheetno}% \ifuhhassignment@numberedsheets
\def\title{\uhhassignment@sheetid{} \@sheetno}%
\else
% Title remains user-specified
\fi
}{% }{%
\ifdefempty{\@group}{% \ifdefempty{\@group}{%
\def\metaleft{}% \def\metaleft{}%
\def\metaright{\@teacher}% \def\metaright{\@teacher}%
}{% }{%
\def\metaleft{Übungsgruppe \@group}% \def\metaleft{\uhhassignment@groupid{} \@group}%
\def\metaright{\@teacher}% \def\metaright{\@teacher}%
}% }%
\def\titleleft{Aufgabenblatt \@sheetno}% \ifuhhassignment@numberedsheets
\def\titleleft{\uhhassignment@sheetid{} \@sheetno}%
\else
\def\titleleft{}
\fi
\def\titleright{\@date}% \def\titleright{\@date}%
\def\title{\@title}% \def\title{\@title}%
}% }%
% \end{macrocode}
% The following code prints the title with the information specified above.
% Depending on the value of |\ifextended| the title will be longer or
% shorter.
%
% Each field (heading, secondary title, title, author) is put in a separate
% group to avoid interference.
% \begin{macrocode}
\begingroup% Heading Group \begingroup% Heading Group
\usekomafont{pageheadfoot}% \usekomafont{pageheadfoot}%
\usekomafont{pagehead}% \usekomafont{pagehead}%
\setlength{\parskip}{0pt}% \setlength{\parskip}{0pt}%
\textbf{\homework@course} \hfill \textbf{\homework@university}\par% \textbf{\course} \hfill \textbf{\university}\par%
\begin{minipage}[t]{\widthof{\metaleft}}% \begin{minipage}[t]{\widthof{\metaleft}}%
\metaleft% \metaleft%
@@ -329,7 +317,7 @@
\vspace{\baselineskip}% \vspace{\baselineskip}%
\fi% \fi%
\begingroup% Secondary Title Group \begingroup% Secondary Title Groupt
\Large\bfseries\titleleft\hfill\titleright% \Large\bfseries\titleleft\hfill\titleright%
\endgroup% \endgroup%
@@ -352,4 +340,4 @@
\endinput \endinput
%% %%
%% End of file `homework.cls'. %% End of file `uhhassignment.cls'.

View File

@@ -16,16 +16,17 @@
% \iffalse % \iffalse
%<driver>\ProvidesFile{homework.dtx} %<driver>\ProvidesFile{uhhassignment.dtx}
% %
%<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01] %<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<class>\ProvidesClass{homework}[2017/04/15 v1.1 The Homework Class] %<class>\ProvidesClass{uhhassignment}[2017/04/22 v1.0 The UHH-Assignment Class]
%<*driver> %<*driver>
\documentclass{ltxdoc} \documentclass{ltxdoc}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[english]{babel} \usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{enumitem} \usepackage{enumitem}
\usepackage{lmodern} \usepackage{lmodern}
@@ -34,7 +35,7 @@
\CodelineIndex \CodelineIndex
\RecordChanges \RecordChanges
\begin{document} \begin{document}
\DocInput{homework.dtx} \DocInput{uhhassignment.dtx}
\end{document} \end{document}
%</driver> %</driver>
% \fi % \fi
@@ -61,24 +62,22 @@
% \changes{v1.0}{2017/04/12}{Initial version} % \changes{v1.0}{2017/04/12}{Initial version}
% %
% \GetFileInfo{homework.cls}
%
% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } % \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
% \DoNotIndex{\@ne} % \DoNotIndex{\@ne}
% \DoNotIndex{\advance,\begingroup,\catcode,\closein} % \DoNotIndex{\advance,\begingroup,\catcode,\closein}
% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup} % \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
% \title{The \textsf{homework} package\thanks{This document % \title{The \textsf{uhhassignment} document class}
% corresponds to \textsf{homework}~\fileversion,
% dated~\filedate.}}
% \author{Kim Wittenburg \\ \texttt{5wittenb@informatik.uni-hamburg.de}} % \author{Kim Wittenburg \\ \texttt{5wittenb@informatik.uni-hamburg.de}}
% %
% \maketitle % \maketitle
% %
% \begin{abstract} % \begin{abstract}
% The \textsf{homework} document class is a document class designed to be used % The \textsf{uhhassignment} document class is a document class designed to be
% for homework in university (or school). The class predominantly implements a % used for assignments in university (or school). The class predominantly
% custom layout for titles but also featues some helpful new commands. % implements a custom layout for titles but also featues some helpful new
% commands. The class was originally designed to be used at the university of
% Hamburg.
% \end{abstract} % \end{abstract}
% %
% \tableofcontents % \tableofcontents
@@ -87,7 +86,17 @@
% %
% \subsection{Class Options} % \subsection{Class Options}
% %
% Currently the \textsf{homework} class supports two (or rather four) options: % Currently the \textsf{uhhassignment} class supports three (or rather six)
% options:
%
% \DescribeMacro{unnumberedsheets}
% By default the \textsf{uhhassignment} class expects the assignment sheets to
% be numbered and issues a warning if the |\sheetno| is missing. However if you
% do not want to specify a sheet number you can use the
% \texttt{unnumberedsheets} class option to suppress the warning. The package
% option also removes any text indicating the sheet number from the output.
%
% The opposite option \texttt{numberedsheets} is used by default.
% %
% \DescribeMacro{shorttitle} % \DescribeMacro{shorttitle}
% You can pass \texttt{shorttitle} class option to display the short university % You can pass \texttt{shorttitle} class option to display the short university
@@ -101,11 +110,11 @@
% %
% \subsection{The Title} % \subsection{The Title}
% %
% The main feature of the \textsf{homework} class is the custom title layout. % The main feature of the \textsf{uhhassignment} class is the custom title
% The layout implements some new fields like the name of university (or school), % layout. The layout implements some new fields like the name of the university
% the name of the teacher or the number of the exercise sheet. The full list of % (or school), the name of the teacher or the number of the exercise sheet. The
% supported fields is listed below. The actual title layout may be different % full list of supported fields is listed below. The actual title layout may be
% depending on which of the following fields are actually specified. % different depending on which of the following fields are actually specified.
% %
% \begingroup % \begingroup
% \setlist[description]{ % \setlist[description]{
@@ -140,18 +149,18 @@
% %
% \DescribeMacro{\id} % \DescribeMacro{\id}
% Sometimes you have to provide your student ID with your solutions to an % Sometimes you have to provide your student ID with your solutions to an
% exercise sheet. The \textsf{homework} class provides the |\id|\marg{id} % exercise sheet. The \textsf{uhhassignment} class provides the |\id|\marg{id}
% command for this case. This command should be used when specifying the authors % command for this case. This command should be used when specifying the authors
% with the |\author| command. It might look like this: % with the |\author| command. It might look like this:
% |\author{John Doe\id{1234567}}| % |\author{John Doe\id{1234567}}|
% %
% \subsection{Tasks and Subtasks} % \subsection{Tasks and Subtasks}
% %
% The \textsf{homework} class is based on \textsf{srcarctl} from the KOMA % The \textsf{uhhassignment} class is based on \textsf{srcarctl} from the KOMA
% packages so its main sectioning level are sections (not chapters). Sections % packages so its main sectioning level are sections (not chapters). Sections
% and subsections however do not always accurately reflect the semantics of % and subsections however do not always accurately reflect the semantics of
% solutions to an assignment. Instead the \textsf{homework} class provides the % solutions to an assignment. Instead the \textsf{uhhassignment} class provides
% following commands: % the following commands:
% %
% \smallskip % \smallskip
% %
@@ -170,15 +179,15 @@
% %
% \smallskip % \smallskip
% %
% The standard sectioning commands are not modified by the \textsf{homework} % The standard sectioning commands are not modified by the
% class so it is still possible to use them. In fact the |\task| commands do % \textsf{uhhassignment} class so it is still possible to use them. In fact the
% create sections and subsections internally. You should however be careful in % |\task| commands do create sections and subsections internally. You should
% using |\section|s yourself because it may be difficult to distinguish |\task|s % however be careful in using |\section|s yourself because it may be difficult
% from |\section|s. % to distinguish |\task|s from |\section|s.
% %
% \subsection{Todos} % \subsection{Todos}
% %
% The \textsf{homework} class offers rudimentary support for todo notes. % The \textsf{uhhassignment} class offers rudimentary support for todo notes.
% Currently todo support is very limited and may not work in some cases. % Currently todo support is very limited and may not work in some cases.
% %
% \smallskip % \smallskip
@@ -195,40 +204,49 @@
% \end{enumerate} % \end{enumerate}
% %
% \StopEventually{ % \StopEventually{
% \addcontentsline{toc}{section}{Change History}
% \PrintIndex % \PrintIndex
% \PrintChanges % \PrintChanges
% } % }
% %
% \section{Implementation} % \section{Implementation}
% %
% \changes{v1.1}{2017/04/15}{Add Class Options} % In addition to the options provided by \textsf{scrartcl} the
% In addition to the options provided by \textsf{scrartcl} the \textsf{homework} % \textsf{uhhassignment} class supports the following options.
% class supports the following options.
% \begin{macrocode} % \begin{macrocode}
\newif\ifhomework@shorttitle \newif\ifuhhassignment@numberedsheets
\DeclareOption{unnumberedsheets}{
\uhhassignment@numberedsheetsfalse
}
\DeclareOption{numberedsheets}{
\uhhassignment@numberedsheetstrue
}
\newif\ifuhhassignment@shorttitle
\DeclareOption{shorttitle}{ \DeclareOption{shorttitle}{
\homework@shorttitletrue \uhhassignment@shorttitletrue
} }
\DeclareOption{longtitle}{ \DeclareOption{longtitle}{
\homework@shorttitlefalse \uhhassignment@shorttitlefalse
} }
\newif\ifhomework@shortheader \newif\ifuhhassignment@shortheader
\DeclareOption{shortheader}{ \DeclareOption{shortheader}{
\homework@shortheadertrue \uhhassignment@shortheadertrue
} }
\DeclareOption{longheader}{ \DeclareOption{longheader}{
\homework@shortheaderfalse \uhhassignment@shortheaderfalse
} }
\ExecuteOptions{longtitle,longheader} \ExecuteOptions{longtitle,longheader,numberedsheets}
\ProcessOptions\relax \ProcessOptions\relax
% \end{macrocode} % \end{macrocode}
% %
% The \textsf{homework} class is based on \textsf{scrartcl}. % The \textsf{uhhassignment} class is based on \textsf{scrartcl}.
% \begin{macrocode} % \begin{macrocode}
\LoadClassWithOptions{scrartcl} \LoadClassWithOptions{scrartcl}
% \end{macrocode} % \end{macrocode}
@@ -241,7 +259,7 @@
% %
% \begin{macrocode} % \begin{macrocode}
\RequirePackage[utf8]{inputenc} % UTF-8 Encoding \RequirePackage[utf8]{inputenc} % UTF-8 Encoding
\RequirePackage{cmap} % Special Character \RequirePackage{cmap} % Special Characters
\RequirePackage[T1]{fontenc} % Font Encoding \RequirePackage[T1]{fontenc} % Font Encoding
\RequirePackage[ngerman]{babel} % German Language \RequirePackage[ngerman]{babel} % German Language
\RequirePackage{etoolbox} % Programming \RequirePackage{etoolbox} % Programming
@@ -256,12 +274,28 @@
\RequirePackage[headsepline]{scrlayer-scrpage} % Header and Footer \RequirePackage[headsepline]{scrlayer-scrpage} % Header and Footer
\RequirePackage{lastpage} % Page Numbers \RequirePackage{lastpage} % Page Numbers
\RequirePackage{amsmath} % Maths
\RequirePackage{amssymb} % Maths
\RequirePackage{amsthm} % Beweise
\RequirePackage{enumitem} % Customizable Enumerations
\RequirePackage{xcolor} % Colors \RequirePackage{xcolor} % Colors
\RequirePackage{framed} % Colored Boxes \RequirePackage{framed} % Colored Boxes
\RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References \RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References
\RequirePackage{lmodern} % Better Font \RequirePackage{lmodern} % Better Font
% \end{macrocode} % \end{macrocode}
% \iffalse %%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Constants %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi
% The following constants are used throughout the template. They can be
% overridden for customizations.
% \begin{macrocode}
\def\uhhassignment@sheetid{Aufgabenblatt}
\def\uhhassignment@groupid{Übungsgruppe}
% \end{macrocode}
% \iffalse %%%%%%%%%%%%%%%%%%% % \iffalse %%%%%%%%%%%%%%%%%%%
%%%%%%% Custom Commands %%%%%% %%%%%%% Custom Commands %%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi
@@ -337,10 +371,12 @@
% university of Hamburg. % university of Hamburg.
% \begin{macrocode} % \begin{macrocode}
\university[Uni Hamburg]{Universität Hamburg} \university[Uni Hamburg]{Universität Hamburg}
\course{} \def\@course{\ClassWarning{uhhassignment}{No \protect\course\space given}}
\let\@shortcourse\@course
\group{} \group{}
\teacher{} \def\@teacher{\ClassWarning{uhhassignment}{No \protect\teacher\space given}}
\sheetno{} \let\@shortteacher\@teacher
\def\@sheetno{\ClassWarning{uhhassignment}{No \protect\sheetno\space given}}
\title{} \title{}
% \end{macrocode} % \end{macrocode}
@@ -380,16 +416,11 @@
% \subsubsection{Tasks} % \subsubsection{Tasks}
% \changes{v1.1}{2017/04/16}{Support Untitled Tasks} % The task mechanism of the \textsf{uhhassignment} class implements its own
% numbering mechanism. This is neccessary because the task numbers do not
% The task mechanism of the \textsf{homework} class implements its own numbering % necessarily correlate with section numbers.
% mechanism. This is neccessary because the task numbers are not necessarily
% placed at the beginning of the title of a section.
% \begin{macrocode} % \begin{macrocode}
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
\newif\if@tasknumbers
\@tasknumberstrue
% \end{macrocode} % \end{macrocode}
% \begin{macro}{\task} % \begin{macro}{\task}
@@ -403,22 +434,18 @@
}{% }{%
\setcounter{task}{#1}% \setcounter{task}{#1}%
}% }%
\if@tasknumbers% \ifstrempty{#2}{%
\ifstrempty{#2}{% \section{Aufgabe \arabic{task}}%
\section{Aufgabe \arabic{task}}% }{%
}{% \section{Aufgabe \arabic{task}: #2}%
\section{Aufgabe \arabic{task}: #2}% }%
}%
\else%
\section{#2}%
\fi%
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% \begin{macro}{\subtask} % \begin{macro}{\subtask}
% The equivalent of |\subsection| for the \textsf{homework} class. |\subtask| % The equivalent of |\subsection| for the \textsf{uhhassignment} class.
% essentially wraps |\subsection| with a semi-customizable title. % |\subtask| essentially wraps |\subsection| with a semi-customizable title.
% \begin{macrocode} % \begin{macrocode}
\newcounter{subtask}[task] \newcounter{subtask}[task]
\newcommand{\subtask}[2][]{% \newcommand{\subtask}[2][]{%
@@ -427,21 +454,17 @@
}{% }{%
\setcounter{subtask}{#1}% \setcounter{subtask}{#1}%
}% }%
\if@tasknumbers% \ifstrempty{#2}{%
\ifstrempty{#2}{% \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}%
\subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% }{%
}{% \subsection{\arabic{task}.\arabic{subtask}. #2}%
\subsection{\arabic{task}.\arabic{subtask}. #2}% }%
}%
\else%
\subsection{#2}%
\fi%
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% \begin{macro}{\subsubtask} % \begin{macro}{\subsubtask}
% The equivalent of |\subsubsection| for the \textsf{homework} class. % The equivalent of |\subsubsection| for the \textsf{uhhassignment} class.
% |\subsubtask| essentially wraps |\subsection| with a semi-customizable title. % |\subsubtask| essentially wraps |\subsection| with a semi-customizable title.
% It probably is not neccessary to use this very often. % It probably is not neccessary to use this very often.
% \begin{macrocode} % \begin{macrocode}
@@ -452,15 +475,11 @@
}{% }{%
\setcounter{subsubtask}{#1}% \setcounter{subsubtask}{#1}%
}% }%
\if@tasknumbers% \ifstrempty{#2}{%
\ifstrempty{#2}{% \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}}
\subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} }{%
}{% \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}%
\subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% }%
}%
\else%
\subsubsection{#2}%
\fi%
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
@@ -471,21 +490,28 @@
% \subsection{Page Setup} % \subsection{Page Setup}
% The homework class defines its own header and footer using % The \textsf{uhhassignment} class defines its own header and footer using
% \textsf{scrlayer-scrpage}. The default setup shows the course, sheet number, % \textsf{scrlayer-scrpage}. The default setup shows the course, sheet number,
% university and date on every page. % university and date on every page.
% \changes{v1.1}{2017/04/15}{Support Short Headers}
% \begin{macrocode} % \begin{macrocode}
\setlength{\headheight}{50pt} \setlength{\headheight}{50pt}
\pagestyle{scrheadings} \pagestyle{scrheadings}
\clearpairofpagestyles \clearpairofpagestyles
% Header % Header
\ifhomework@shortheader \ifuhhassignment@shortheader
\ihead{\textbf{\@shortcourse}\\Aufgabenblatt \@sheetno} \ifuhhassignment@numberedsheets
\ihead{\textbf{\@shortcourse}\\\uhhassignment@sheetid{} \@sheetno}
\else
\ihead{\textbf{\@shortcourse}}
\fi
\ohead{\textbf{\@shortuniversity}\\\@date} \ohead{\textbf{\@shortuniversity}\\\@date}
\else \else
\ihead{\textbf{\@course}\\Aufgabenblatt \@sheetno} \ifuhhassignment@numberedsheets
\ihead{\textbf{\@course}\\\uhhassignment@sheetid{} \@sheetno}
\else
\ihead{\textbf{\@course}}
\fi
\ohead{\textbf{\@university}\\\@date} \ohead{\textbf{\@university}\\\@date}
\fi \fi
@@ -494,7 +520,7 @@
\cfoot[Seite \pagemark{} von \pageref{LastPage}]{Seite \pagemark{} von \pageref{LastPage}} \cfoot[Seite \pagemark{} von \pageref{LastPage}]{Seite \pagemark{} von \pageref{LastPage}}
\newpagestyle{firstpage}[]{% \newpagestyle{firstpage}[]{%
\ihead{h} \ihead{}
\cfoot{\pagemark{}} \cfoot{\pagemark{}}
} }
% \end{macrocode} % \end{macrocode}
@@ -505,14 +531,15 @@
% \subsection{Layout} % \subsection{Layout}
% The \textsf{homework} class overrides some font settings and adjusts the % The \textsf{uhhassignment} class overrides some font settings and adjusts the
% paragraph spacing to create a more distinct layout. % paragraph spacing to create a more distinct layout.
%
% \begin{macrocode} % \begin{macrocode}
\setlength{\parindent}{0em}
\setlength{\parskip}{5pt} \setlength{\parskip}{5pt}
\setkomafont{section}{\normalfont\bfseries\Large} \setkomafont{section}{\normalfont\bfseries\LARGE}
\setkomafont{subsection}{\normalfont\bfseries\large} \setkomafont{subsection}{\normalfont\bfseries\Large}
\setkomafont{subsubsection}{\normalfont\bfseries\large}
\RedeclareSectionCommands[afterskip=.25\baselineskip]{section} \RedeclareSectionCommands[afterskip=.25\baselineskip]{section}
\RedeclareSectionCommands[ \RedeclareSectionCommands[
beforeskip=0.5\baselineskip, beforeskip=0.5\baselineskip,
@@ -520,16 +547,14 @@
% \end{macrocode} % \end{macrocode}
% \begin{macro}{\maketitle} % \begin{macro}{\maketitle}
% The \textsf{homework} class completely redefines the |\maketitle| macro. This % The \textsf{uhhassignment} class completely redefines the |\maketitle| macro.
% implementation actually defines the layout of the final title depending on % This implementation actually defines the layout of the final title depending
% which information was specified by the user (group number, a title, \dots). % on which information was specified by the user (group number, a title, \dots).
% %
% We differentiate two \emph{states} of the title. If the user does not specify % We differentiate two \emph{states} of the title. If the user does not specify
% a title and does not specify a group the title will be rearranged to not % a title and does not specify a group the title will be rearranged to not
% display too much empty space. This is implemented via the |\ifextended| % display too much empty space. This is implemented via the |\ifextended|
% definition. % definition.
%
% \changes{v1.1}{2017/04/15}{Support Short Titles}
% \begin{macrocode} % \begin{macrocode}
\renewcommand*{\maketitle}{% \renewcommand*{\maketitle}{%
\thispagestyle{plain}% \thispagestyle{plain}%
@@ -537,40 +562,38 @@
\newif\ifextended \newif\ifextended
\extendedtrue \extendedtrue
\def\homework@university{\@university} \ifuhhassignment@shorttitle
\def\homework@course{\@course} \let\university\@shortuniversity
\ifhomework@shorttitle \let\course\@shortcourse
\def\homework@university{\@shortuniversity}
\def\homework@course{\@shortcourse}
\else \else
\def\homework@university{\@university} \let\university\@university
\def\homework@course{\@course} \let\course\@course
\fi% \fi
% \end{macrocode} % \end{macrocode}
% First we define the different layout parts. The title has six \emph{slots} % First we define the different layout parts. The title has six \emph{slots}
% each of which can hold a piece of text: % each of which can hold a piece of text:
% \begin{description} % \begin{description}
% \item[Top Left] On the top left the course name ist printed in a bold % \item[Top Left] On the top left the course name ist printed in a bold
% font. % font.
% \item[Top Right] On the top right the name of the university is printed % \item[Top Right] On the top right the name of the university is printed
% in a bold font. % in a bold font.
% \item[Meta Left] Below the course name a piece of information is % \item[Meta Left] Below the course name a piece of information is
% printed. The contents of this slot depend on the % printed. The contents of this slot depend on the
% specified information and can be either the group % specified information and can be either the group
% number or the teacher. % number or the teacher.
% \item[Meta Right] Similar to meta left but below the university name. % \item[Meta Right] Similar to meta left but below the university name.
% This slot typically holds the teacher or the date. % This slot typically holds the teacher or the date.
% \item[Title Left] Above the actual title there is a row of secondary % \item[Title Left] Above the actual title there is a row of secondary
% titles. On the left of this row the sheet number is % titles. On the left of this row the sheet number is
% printed. % printed.
% \item[Title Right] Similarly to title left this slot may contain the % \item[Title Right] Similarly to title left this slot may contain the
% date. % date.
% \end{description} % \end{description}
% Below the header the actual document title and the author(s) are printed. % Below the header the actual document title and the author(s) are printed.
% If no |\title| is specified the sheet number becomes the title (|\title| % If no |\title| is specified the sheet number becomes the title (|\title|
% however remains empfy). % however remains empfy).
% \begin{macrocode} % \begin{macrocode}
\ifdefempty{\@title}{% \ifdefempty{\@title}{%
\ifdefempty{\@group}{% \ifdefempty{\@group}{%
\def\metaleft{\@teacher}% \def\metaleft{\@teacher}%
@@ -578,40 +601,48 @@
\def\titleright{}% \def\titleright{}%
\extendedfalse \extendedfalse
}{% }{%
\def\metaleft{Übungsgruppe \@group}% \def\metaleft{\uhhassignment@sheetid{} \@group}%
\def\metaright{\@teacher}% \def\metaright{\@teacher}%
\def\titleright{\@date}% \def\titleright{\@date}%
}% }%
\def\titleleft{}% \def\titleleft{}%
\def\title{Aufgabenblatt \@sheetno}% \ifuhhassignment@numberedsheets
\def\title{\uhhassignment@sheetid{} \@sheetno}%
\else
% Title remains user-specified
\fi
}{% }{%
\ifdefempty{\@group}{% \ifdefempty{\@group}{%
\def\metaleft{}% \def\metaleft{}%
\def\metaright{\@teacher}% \def\metaright{\@teacher}%
}{% }{%
\def\metaleft{Übungsgruppe \@group}% \def\metaleft{\uhhassignment@groupid{} \@group}%
\def\metaright{\@teacher}% \def\metaright{\@teacher}%
}% }%
\def\titleleft{Aufgabenblatt \@sheetno}% \ifuhhassignment@numberedsheets
\def\titleleft{\uhhassignment@sheetid{} \@sheetno}%
\else
\def\titleleft{}
\fi
\def\titleright{\@date}% \def\titleright{\@date}%
\def\title{\@title}% \def\title{\@title}%
}% }%
% \end{macrocode} % \end{macrocode}
% The following code prints the title with the information specified above. % The following code prints the title with the information specified above.
% Depending on the value of |\ifextended| the title will be longer or % Depending on the value of |\ifextended| the title will be longer or
% shorter. % shorter.
% %
% Each field (heading, secondary title, title, author) is put in a separate % Each field (heading, secondary title, title, author) is put in a separate
% group to avoid interference. % group to avoid interference.
% \begin{macrocode} % \begin{macrocode}
\begingroup% Heading Group \begingroup% Heading Group
\usekomafont{pageheadfoot}% \usekomafont{pageheadfoot}%
\usekomafont{pagehead}% \usekomafont{pagehead}%
\setlength{\parskip}{0pt}% \setlength{\parskip}{0pt}%
\textbf{\homework@course} \hfill \textbf{\homework@university}\par% \textbf{\course} \hfill \textbf{\university}\par%
\begin{minipage}[t]{\widthof{\metaleft}}% \begin{minipage}[t]{\widthof{\metaleft}}%
\metaleft% \metaleft%
@@ -627,7 +658,7 @@
\vspace{\baselineskip}% \vspace{\baselineskip}%
\fi% \fi%
\begingroup% Secondary Title Group \begingroup% Secondary Title Groupt
\Large\bfseries\titleleft\hfill\titleright% \Large\bfseries\titleleft\hfill\titleright%
\endgroup% \endgroup%

View File

@@ -14,7 +14,7 @@
\input docstrip.tex \input docstrip.tex
\keepsilent \keepsilent
\usedir{tex/latex/homework} \usedir{tex/latex/uhhassignment}
\preamble \preamble
@@ -31,7 +31,7 @@ and version 1.3 or later is part of all distributions of
LaTeX version 2005/12/01 or later. LaTeX version 2005/12/01 or later.
\endpreamble \endpreamble
\generate{\file{homework.cls}{\from{homework.dtx}{class}}} \generate{\file{uhhassignment.cls}{\from{uhhassignment.dtx}{class}}}
\obeyspaces \obeyspaces
\Msg{****************************************************} \Msg{****************************************************}
@@ -39,10 +39,10 @@ LaTeX version 2005/12/01 or later.
\Msg{* To finish the installation you have to move the *} \Msg{* To finish the installation you have to move the *}
\Msg{* following file into a directory searched by TeX: *} \Msg{* following file into a directory searched by TeX: *}
\Msg{* *} \Msg{* *}
\Msg{* homework.cls *} \Msg{* uhhassignment.cls *}
\Msg{* *} \Msg{* *}
\Msg{* To produce the documentation run the file *} \Msg{* To produce the documentation run the file *}
\Msg{* homework.dtx through LaTeX. *} \Msg{* uhhassignment.dtx through LaTeX. *}
\Msg{* *} \Msg{* *}
\Msg{* Happy TeXing! *} \Msg{* Happy TeXing! *}
\Msg{* *} \Msg{* *}