From 7efd12e824777fa22c19062d03576fe66a66ea93 Mon Sep 17 00:00:00 2001 From: Kim Wittenburg Date: Sun, 23 Apr 2017 16:01:46 +0200 Subject: [PATCH] Rename class to uhhassignment --- homework.cls => uhhassignment.cls | 184 ++++++++---------- homework.dtx => uhhassignment.dtx | 313 ++++++++++++++++-------------- homework.ins => uhhassignment.ins | 8 +- 3 files changed, 262 insertions(+), 243 deletions(-) rename homework.cls => uhhassignment.cls (58%) rename homework.dtx => uhhassignment.dtx (63%) rename homework.ins => uhhassignment.ins (87%) diff --git a/homework.cls b/uhhassignment.cls similarity index 58% rename from homework.cls rename to uhhassignment.cls index 7a9e401..dcd02f9 100644 --- a/homework.cls +++ b/uhhassignment.cls @@ -1,10 +1,10 @@ %% -%% This is file `homework.cls', +%% This is file `uhhassignment.cls', %% generated with the docstrip utility. %% %% The original source files were: %% -%% homework.dtx (with options: `class') +%% uhhassignment.dtx (with options: `class') %% %% Copyright (C) 2017 by Kim Wittenburg %% @@ -19,29 +19,38 @@ %% LaTeX version 2005/12/01 or later. \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}{ - \homework@shorttitletrue + \uhhassignment@shorttitletrue } \DeclareOption{longtitle}{ - \homework@shorttitlefalse + \uhhassignment@shorttitlefalse } -\newif\ifhomework@shortheader +\newif\ifuhhassignment@shortheader \DeclareOption{shortheader}{ - \homework@shortheadertrue + \uhhassignment@shortheadertrue } \DeclareOption{longheader}{ - \homework@shortheaderfalse + \uhhassignment@shortheaderfalse } -\ExecuteOptions{longtitle,longheader} +\ExecuteOptions{longtitle,longheader,numberedsheets} \ProcessOptions\relax \LoadClassWithOptions{scrartcl} @@ -50,7 +59,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi \RequirePackage[utf8]{inputenc} % UTF-8 Encoding -\RequirePackage{cmap} % Special Character +\RequirePackage{cmap} % Special Characters \RequirePackage[T1]{fontenc} % Font Encoding \RequirePackage[ngerman]{babel} % German Language \RequirePackage{etoolbox} % Programming @@ -65,11 +74,22 @@ \RequirePackage[headsepline]{scrlayer-scrpage} % Header and Footer \RequirePackage{lastpage} % Page Numbers +\RequirePackage{amsmath} % Maths +\RequirePackage{amssymb} % Maths +\RequirePackage{amsthm} % Beweise +\RequirePackage{enumitem} % Customizable Enumerations + \RequirePackage{xcolor} % Colors \RequirePackage{framed} % Colored Boxes \RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References \RequirePackage{lmodern} % Better Font +%%%%%%%%%% Constants %%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%\fi + +\def\uhhassignment@sheetid{Aufgabenblatt} +\def\uhhassignment@groupid{Übungsgruppe} + %%%%%%% Custom Commands %%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi @@ -106,10 +126,12 @@ \newcommand{\id}[1]{\\\ttfamily\footnotesize(#1)} \university[Uni Hamburg]{Universität Hamburg} -\course{} +\def\@course{\ClassWarning{uhhassignment}{No \protect\course\space given}} +\let\@shortcourse\@course \group{} -\teacher{} -\sheetno{} +\def\@teacher{\ClassWarning{uhhassignment}{No \protect\teacher\space given}} +\let\@shortteacher\@teacher +\def\@sheetno{\ClassWarning{uhhassignment}{No \protect\sheetno\space given}} \title{} @@ -135,12 +157,8 @@ } - \setcounter{secnumdepth}{0} -\newif\if@tasknumbers -\@tasknumberstrue - \newcounter{task} \newcommand{\task}[2][]{% \ifstrempty{#1}{% @@ -148,15 +166,11 @@ }{% \setcounter{task}{#1}% }% - \if@tasknumbers% - \ifstrempty{#2}{% - \section{Aufgabe \arabic{task}}% - }{% - \section{Aufgabe \arabic{task}: #2}% - }% - \else% - \section{#2}% - \fi% + \ifstrempty{#2}{% + \section{Aufgabe \arabic{task}}% + }{% + \section{Aufgabe \arabic{task}: #2}% + }% } \newcounter{subtask}[task] @@ -166,15 +180,11 @@ }{% \setcounter{subtask}{#1}% }% - \if@tasknumbers% - \ifstrempty{#2}{% - \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% - }{% - \subsection{\arabic{task}.\arabic{subtask}. #2}% - }% - \else% - \subsection{#2}% - \fi% + \ifstrempty{#2}{% + \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% + }{% + \subsection{\arabic{task}.\arabic{subtask}. #2}% + }% } \newcounter{subsubtask}[subtask] @@ -184,15 +194,11 @@ }{% \setcounter{subsubtask}{#1}% }% - \if@tasknumbers% - \ifstrempty{#2}{% - \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} - }{% - \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% - }% - \else% - \subsubsection{#2}% - \fi% + \ifstrempty{#2}{% + \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} + }{% + \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% + }% } %%%%%%%%% Page Setup %%%%%%%%% @@ -203,11 +209,19 @@ \pagestyle{scrheadings} \clearpairofpagestyles -\ifhomework@shortheader - \ihead{\textbf{\@shortcourse}\\Aufgabenblatt \@sheetno} +\ifuhhassignment@shortheader + \ifuhhassignment@numberedsheets + \ihead{\textbf{\@shortcourse}\\\uhhassignment@sheetid{} \@sheetno} + \else + \ihead{\textbf{\@shortcourse}} + \fi \ohead{\textbf{\@shortuniversity}\\\@date} \else - \ihead{\textbf{\@course}\\Aufgabenblatt \@sheetno} + \ifuhhassignment@numberedsheets + \ihead{\textbf{\@course}\\\uhhassignment@sheetid{} \@sheetno} + \else + \ihead{\textbf{\@course}} + \fi \ohead{\textbf{\@university}\\\@date} \fi @@ -215,7 +229,7 @@ \cfoot[Seite \pagemark{} von \pageref{LastPage}]{Seite \pagemark{} von \pageref{LastPage}} \newpagestyle{firstpage}[]{% - \ihead{h} + \ihead{} \cfoot{\pagemark{}} } @@ -223,11 +237,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi -\setlength{\parindent}{0em} \setlength{\parskip}{5pt} -\setkomafont{section}{\normalfont\bfseries\Large} -\setkomafont{subsection}{\normalfont\bfseries\large} +\setkomafont{section}{\normalfont\bfseries\LARGE} +\setkomafont{subsection}{\normalfont\bfseries\Large} +\setkomafont{subsubsection}{\normalfont\bfseries\large} \RedeclareSectionCommands[afterskip=.25\baselineskip]{section} \RedeclareSectionCommands[ beforeskip=0.5\baselineskip, @@ -239,40 +253,14 @@ \newif\ifextended \extendedtrue - \def\homework@university{\@university} - \def\homework@course{\@course} - \ifhomework@shorttitle - \def\homework@university{\@shortuniversity} - \def\homework@course{\@shortcourse} + \ifuhhassignment@shorttitle + \let\university\@shortuniversity + \let\course\@shortcourse \else - \def\homework@university{\@university} - \def\homework@course{\@course} + \let\university\@university + \let\course\@course \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{\@group}{% \def\metaleft{\@teacher}% @@ -280,40 +268,40 @@ \def\titleright{}% \extendedfalse }{% - \def\metaleft{Übungsgruppe \@group}% + \def\metaleft{\uhhassignment@sheetid{} \@group}% \def\metaright{\@teacher}% \def\titleright{\@date}% }% \def\titleleft{}% - \def\title{Aufgabenblatt \@sheetno}% + \ifuhhassignment@numberedsheets + \def\title{\uhhassignment@sheetid{} \@sheetno}% + \else + % Title remains user-specified + \fi }{% \ifdefempty{\@group}{% \def\metaleft{}% \def\metaright{\@teacher}% }{% - \def\metaleft{Übungsgruppe \@group}% + \def\metaleft{\uhhassignment@groupid{} \@group}% \def\metaright{\@teacher}% }% - \def\titleleft{Aufgabenblatt \@sheetno}% + \ifuhhassignment@numberedsheets + \def\titleleft{\uhhassignment@sheetid{} \@sheetno}% + \else + \def\titleleft{} + \fi \def\titleright{\@date}% \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 \usekomafont{pageheadfoot}% \usekomafont{pagehead}% \setlength{\parskip}{0pt}% - \textbf{\homework@course} \hfill \textbf{\homework@university}\par% + \textbf{\course} \hfill \textbf{\university}\par% \begin{minipage}[t]{\widthof{\metaleft}}% \metaleft% @@ -329,7 +317,7 @@ \vspace{\baselineskip}% \fi% - \begingroup% Secondary Title Group + \begingroup% Secondary Title Groupt \Large\bfseries\titleleft\hfill\titleright% \endgroup% @@ -352,4 +340,4 @@ \endinput %% -%% End of file `homework.cls'. +%% End of file `uhhassignment.cls'. diff --git a/homework.dtx b/uhhassignment.dtx similarity index 63% rename from homework.dtx rename to uhhassignment.dtx index 53e2070..3e7899d 100644 --- a/homework.dtx +++ b/uhhassignment.dtx @@ -16,16 +16,17 @@ % \iffalse -%\ProvidesFile{homework.dtx} +%\ProvidesFile{uhhassignment.dtx} % %\NeedsTeXFormat{LaTeX2e}[2005/12/01] -%\ProvidesClass{homework}[2017/04/15 v1.1 The Homework Class] +%\ProvidesClass{uhhassignment}[2017/04/22 v1.0 The UHH-Assignment Class] %<*driver> \documentclass{ltxdoc} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} +\usepackage{hyperref} \usepackage{enumitem} \usepackage{lmodern} @@ -34,7 +35,7 @@ \CodelineIndex \RecordChanges \begin{document} - \DocInput{homework.dtx} + \DocInput{uhhassignment.dtx} \end{document} % % \fi @@ -61,24 +62,22 @@ % \changes{v1.0}{2017/04/12}{Initial version} % -% \GetFileInfo{homework.cls} -% % \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } % \DoNotIndex{\@ne} % \DoNotIndex{\advance,\begingroup,\catcode,\closein} % \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup} -% \title{The \textsf{homework} package\thanks{This document -% corresponds to \textsf{homework}~\fileversion, -% dated~\filedate.}} +% \title{The \textsf{uhhassignment} document class} % \author{Kim Wittenburg \\ \texttt{5wittenb@informatik.uni-hamburg.de}} % % \maketitle % % \begin{abstract} -% The \textsf{homework} document class is a document class designed to be used -% for homework in university (or school). The class predominantly implements a -% custom layout for titles but also featues some helpful new commands. +% The \textsf{uhhassignment} document class is a document class designed to be +% used for assignments in university (or school). The class predominantly +% 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} % % \tableofcontents @@ -87,7 +86,17 @@ % % \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} % You can pass \texttt{shorttitle} class option to display the short university @@ -101,11 +110,11 @@ % % \subsection{The Title} % -% The main feature of the \textsf{homework} class is the custom title layout. -% The layout implements some new fields like the name of university (or school), -% the name of the teacher or the number of the exercise sheet. The full list of -% supported fields is listed below. The actual title layout may be different -% depending on which of the following fields are actually specified. +% The main feature of the \textsf{uhhassignment} class is the custom title +% layout. The layout implements some new fields like the name of the university +% (or school), the name of the teacher or the number of the exercise sheet. The +% full list of supported fields is listed below. The actual title layout may be +% different depending on which of the following fields are actually specified. % % \begingroup % \setlist[description]{ @@ -140,18 +149,18 @@ % % \DescribeMacro{\id} % 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 % with the |\author| command. It might look like this: % |\author{John Doe\id{1234567}}| % % \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 % and subsections however do not always accurately reflect the semantics of -% solutions to an assignment. Instead the \textsf{homework} class provides the -% following commands: +% solutions to an assignment. Instead the \textsf{uhhassignment} class provides +% the following commands: % % \smallskip % @@ -170,15 +179,15 @@ % % \smallskip % -% The standard sectioning commands are not modified by the \textsf{homework} -% class so it is still possible to use them. In fact the |\task| commands do -% create sections and subsections internally. You should however be careful in -% using |\section|s yourself because it may be difficult to distinguish |\task|s -% from |\section|s. +% The standard sectioning commands are not modified by the +% \textsf{uhhassignment} class so it is still possible to use them. In fact the +% |\task| commands do create sections and subsections internally. You should +% however be careful in using |\section|s yourself because it may be difficult +% to distinguish |\task|s from |\section|s. % % \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. % % \smallskip @@ -195,40 +204,49 @@ % \end{enumerate} % % \StopEventually{ +% \addcontentsline{toc}{section}{Change History} % \PrintIndex % \PrintChanges % } % % \section{Implementation} % -% \changes{v1.1}{2017/04/15}{Add Class Options} -% In addition to the options provided by \textsf{scrartcl} the \textsf{homework} -% class supports the following options. +% In addition to the options provided by \textsf{scrartcl} the +% \textsf{uhhassignment} class supports the following options. % \begin{macrocode} -\newif\ifhomework@shorttitle +\newif\ifuhhassignment@numberedsheets +\DeclareOption{unnumberedsheets}{ + \uhhassignment@numberedsheetsfalse +} + +\DeclareOption{numberedsheets}{ + \uhhassignment@numberedsheetstrue +} + +\newif\ifuhhassignment@shorttitle \DeclareOption{shorttitle}{ - \homework@shorttitletrue + \uhhassignment@shorttitletrue } \DeclareOption{longtitle}{ - \homework@shorttitlefalse + \uhhassignment@shorttitlefalse } -\newif\ifhomework@shortheader +\newif\ifuhhassignment@shortheader \DeclareOption{shortheader}{ - \homework@shortheadertrue + \uhhassignment@shortheadertrue } \DeclareOption{longheader}{ - \homework@shortheaderfalse + \uhhassignment@shortheaderfalse } -\ExecuteOptions{longtitle,longheader} +\ExecuteOptions{longtitle,longheader,numberedsheets} \ProcessOptions\relax % \end{macrocode} % -% The \textsf{homework} class is based on \textsf{scrartcl}. +% The \textsf{uhhassignment} class is based on \textsf{scrartcl}. % \begin{macrocode} \LoadClassWithOptions{scrartcl} % \end{macrocode} @@ -241,7 +259,7 @@ % % \begin{macrocode} \RequirePackage[utf8]{inputenc} % UTF-8 Encoding -\RequirePackage{cmap} % Special Character +\RequirePackage{cmap} % Special Characters \RequirePackage[T1]{fontenc} % Font Encoding \RequirePackage[ngerman]{babel} % German Language \RequirePackage{etoolbox} % Programming @@ -256,12 +274,28 @@ \RequirePackage[headsepline]{scrlayer-scrpage} % Header and Footer \RequirePackage{lastpage} % Page Numbers +\RequirePackage{amsmath} % Maths +\RequirePackage{amssymb} % Maths +\RequirePackage{amsthm} % Beweise +\RequirePackage{enumitem} % Customizable Enumerations + \RequirePackage{xcolor} % Colors \RequirePackage{framed} % Colored Boxes \RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References \RequirePackage{lmodern} % Better Font % \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 %%%%%%%%%%%%%%%%%%% %%%%%%% Custom Commands %%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%\fi @@ -337,10 +371,12 @@ % university of Hamburg. % \begin{macrocode} \university[Uni Hamburg]{Universität Hamburg} -\course{} +\def\@course{\ClassWarning{uhhassignment}{No \protect\course\space given}} +\let\@shortcourse\@course \group{} -\teacher{} -\sheetno{} +\def\@teacher{\ClassWarning{uhhassignment}{No \protect\teacher\space given}} +\let\@shortteacher\@teacher +\def\@sheetno{\ClassWarning{uhhassignment}{No \protect\sheetno\space given}} \title{} % \end{macrocode} @@ -380,16 +416,11 @@ % \subsubsection{Tasks} -% \changes{v1.1}{2017/04/16}{Support Untitled Tasks} - -% The task mechanism of the \textsf{homework} class implements its own numbering -% mechanism. This is neccessary because the task numbers are not necessarily -% placed at the beginning of the title of a section. +% The task mechanism of the \textsf{uhhassignment} class implements its own +% numbering mechanism. This is neccessary because the task numbers do not +% necessarily correlate with section numbers. % \begin{macrocode} \setcounter{secnumdepth}{0} - -\newif\if@tasknumbers -\@tasknumberstrue % \end{macrocode} % \begin{macro}{\task} @@ -403,22 +434,18 @@ }{% \setcounter{task}{#1}% }% - \if@tasknumbers% - \ifstrempty{#2}{% - \section{Aufgabe \arabic{task}}% - }{% - \section{Aufgabe \arabic{task}: #2}% - }% - \else% - \section{#2}% - \fi% + \ifstrempty{#2}{% + \section{Aufgabe \arabic{task}}% + }{% + \section{Aufgabe \arabic{task}: #2}% + }% } % \end{macrocode} % \end{macro} % \begin{macro}{\subtask} -% The equivalent of |\subsection| for the \textsf{homework} class. |\subtask| -% essentially wraps |\subsection| with a semi-customizable title. +% The equivalent of |\subsection| for the \textsf{uhhassignment} class. +% |\subtask| essentially wraps |\subsection| with a semi-customizable title. % \begin{macrocode} \newcounter{subtask}[task] \newcommand{\subtask}[2][]{% @@ -427,21 +454,17 @@ }{% \setcounter{subtask}{#1}% }% - \if@tasknumbers% - \ifstrempty{#2}{% - \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% - }{% - \subsection{\arabic{task}.\arabic{subtask}. #2}% - }% - \else% - \subsection{#2}% - \fi% + \ifstrempty{#2}{% + \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% + }{% + \subsection{\arabic{task}.\arabic{subtask}. #2}% + }% } % \end{macrocode} % \end{macro} % \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. % It probably is not neccessary to use this very often. % \begin{macrocode} @@ -452,15 +475,11 @@ }{% \setcounter{subsubtask}{#1}% }% - \if@tasknumbers% - \ifstrempty{#2}{% - \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} - }{% - \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% - }% - \else% - \subsubsection{#2}% - \fi% + \ifstrempty{#2}{% + \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} + }{% + \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% + }% } % \end{macrocode} % \end{macro} @@ -471,21 +490,28 @@ % \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, % university and date on every page. -% \changes{v1.1}{2017/04/15}{Support Short Headers} % \begin{macrocode} \setlength{\headheight}{50pt} \pagestyle{scrheadings} \clearpairofpagestyles % Header -\ifhomework@shortheader - \ihead{\textbf{\@shortcourse}\\Aufgabenblatt \@sheetno} +\ifuhhassignment@shortheader + \ifuhhassignment@numberedsheets + \ihead{\textbf{\@shortcourse}\\\uhhassignment@sheetid{} \@sheetno} + \else + \ihead{\textbf{\@shortcourse}} + \fi \ohead{\textbf{\@shortuniversity}\\\@date} \else - \ihead{\textbf{\@course}\\Aufgabenblatt \@sheetno} + \ifuhhassignment@numberedsheets + \ihead{\textbf{\@course}\\\uhhassignment@sheetid{} \@sheetno} + \else + \ihead{\textbf{\@course}} + \fi \ohead{\textbf{\@university}\\\@date} \fi @@ -494,7 +520,7 @@ \cfoot[Seite \pagemark{} von \pageref{LastPage}]{Seite \pagemark{} von \pageref{LastPage}} \newpagestyle{firstpage}[]{% - \ihead{h} + \ihead{} \cfoot{\pagemark{}} } % \end{macrocode} @@ -505,14 +531,15 @@ % \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. +% % \begin{macrocode} -\setlength{\parindent}{0em} \setlength{\parskip}{5pt} -\setkomafont{section}{\normalfont\bfseries\Large} -\setkomafont{subsection}{\normalfont\bfseries\large} +\setkomafont{section}{\normalfont\bfseries\LARGE} +\setkomafont{subsection}{\normalfont\bfseries\Large} +\setkomafont{subsubsection}{\normalfont\bfseries\large} \RedeclareSectionCommands[afterskip=.25\baselineskip]{section} \RedeclareSectionCommands[ beforeskip=0.5\baselineskip, @@ -520,16 +547,14 @@ % \end{macrocode} % \begin{macro}{\maketitle} -% The \textsf{homework} class completely redefines the |\maketitle| macro. This -% implementation actually defines the layout of the final title depending on -% which information was specified by the user (group number, a title, \dots). +% The \textsf{uhhassignment} class completely redefines the |\maketitle| macro. +% This implementation actually defines the layout of the final title depending +% 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 % 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| % definition. -% -% \changes{v1.1}{2017/04/15}{Support Short Titles} % \begin{macrocode} \renewcommand*{\maketitle}{% \thispagestyle{plain}% @@ -537,40 +562,38 @@ \newif\ifextended \extendedtrue - \def\homework@university{\@university} - \def\homework@course{\@course} - \ifhomework@shorttitle - \def\homework@university{\@shortuniversity} - \def\homework@course{\@shortcourse} + \ifuhhassignment@shorttitle + \let\university\@shortuniversity + \let\course\@shortcourse \else - \def\homework@university{\@university} - \def\homework@course{\@course} - \fi% - % \end{macrocode} + \let\university\@university + \let\course\@course + \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} +% 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{\@group}{% \def\metaleft{\@teacher}% @@ -578,40 +601,48 @@ \def\titleright{}% \extendedfalse }{% - \def\metaleft{Übungsgruppe \@group}% + \def\metaleft{\uhhassignment@sheetid{} \@group}% \def\metaright{\@teacher}% \def\titleright{\@date}% }% \def\titleleft{}% - \def\title{Aufgabenblatt \@sheetno}% + \ifuhhassignment@numberedsheets + \def\title{\uhhassignment@sheetid{} \@sheetno}% + \else + % Title remains user-specified + \fi }{% \ifdefempty{\@group}{% \def\metaleft{}% \def\metaright{\@teacher}% }{% - \def\metaleft{Übungsgruppe \@group}% + \def\metaleft{\uhhassignment@groupid{} \@group}% \def\metaright{\@teacher}% }% - \def\titleleft{Aufgabenblatt \@sheetno}% + \ifuhhassignment@numberedsheets + \def\titleleft{\uhhassignment@sheetid{} \@sheetno}% + \else + \def\titleleft{} + \fi \def\titleright{\@date}% \def\title{\@title}% }% - % \end{macrocode} +% \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} +% 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 \usekomafont{pageheadfoot}% \usekomafont{pagehead}% \setlength{\parskip}{0pt}% - \textbf{\homework@course} \hfill \textbf{\homework@university}\par% + \textbf{\course} \hfill \textbf{\university}\par% \begin{minipage}[t]{\widthof{\metaleft}}% \metaleft% @@ -627,7 +658,7 @@ \vspace{\baselineskip}% \fi% - \begingroup% Secondary Title Group + \begingroup% Secondary Title Groupt \Large\bfseries\titleleft\hfill\titleright% \endgroup% diff --git a/homework.ins b/uhhassignment.ins similarity index 87% rename from homework.ins rename to uhhassignment.ins index 7c97e66..911c32d 100644 --- a/homework.ins +++ b/uhhassignment.ins @@ -14,7 +14,7 @@ \input docstrip.tex \keepsilent -\usedir{tex/latex/homework} +\usedir{tex/latex/uhhassignment} \preamble @@ -31,7 +31,7 @@ and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. \endpreamble -\generate{\file{homework.cls}{\from{homework.dtx}{class}}} +\generate{\file{uhhassignment.cls}{\from{uhhassignment.dtx}{class}}} \obeyspaces \Msg{****************************************************} @@ -39,10 +39,10 @@ LaTeX version 2005/12/01 or later. \Msg{* To finish the installation you have to move the *} \Msg{* following file into a directory searched by TeX: *} \Msg{* *} -\Msg{* homework.cls *} +\Msg{* uhhassignment.cls *} \Msg{* *} \Msg{* To produce the documentation run the file *} -\Msg{* homework.dtx through LaTeX. *} +\Msg{* uhhassignment.dtx through LaTeX. *} \Msg{* *} \Msg{* Happy TeXing! *} \Msg{* *}