diff --git a/homework.cls b/homework.cls index a4bd6cc..7a9e401 100644 --- a/homework.cls +++ b/homework.cls @@ -67,7 +67,7 @@ \RequirePackage{xcolor} % Colors \RequirePackage{framed} % Colored Boxes -\RequirePackage[colorlinks,linkcolor=blue!70]{hyperref} % Links and References +\RequirePackage[colorlinks,linkcolor=black]{hyperref} % Links and References \RequirePackage{lmodern} % Better Font %%%%%%% Custom Commands %%%%%% @@ -135,6 +135,7 @@ } + \setcounter{secnumdepth}{0} \newif\if@tasknumbers @@ -148,7 +149,11 @@ \setcounter{task}{#1}% }% \if@tasknumbers% - \section{Aufgabe \arabic{task}: #2}% + \ifstrempty{#2}{% + \section{Aufgabe \arabic{task}}% + }{% + \section{Aufgabe \arabic{task}: #2}% + }% \else% \section{#2}% \fi% @@ -162,7 +167,11 @@ \setcounter{subtask}{#1}% }% \if@tasknumbers% - \subsection{\arabic{task}.\arabic{subtask}. #2}% + \ifstrempty{#2}{% + \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% + }{% + \subsection{\arabic{task}.\arabic{subtask}. #2}% + }% \else% \subsection{#2}% \fi% @@ -176,7 +185,11 @@ \setcounter{subsubtask}{#1}% }% \if@tasknumbers% - \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% + \ifstrempty{#2}{% + \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} + }{% + \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% + }% \else% \subsubsection{#2}% \fi% diff --git a/homework.dtx b/homework.dtx index 878c30c..53e2070 100644 --- a/homework.dtx +++ b/homework.dtx @@ -380,6 +380,8 @@ % \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. @@ -402,7 +404,11 @@ \setcounter{task}{#1}% }% \if@tasknumbers% - \section{Aufgabe \arabic{task}: #2}% + \ifstrempty{#2}{% + \section{Aufgabe \arabic{task}}% + }{% + \section{Aufgabe \arabic{task}: #2}% + }% \else% \section{#2}% \fi% @@ -422,7 +428,11 @@ \setcounter{subtask}{#1}% }% \if@tasknumbers% - \subsection{\arabic{task}.\arabic{subtask}. #2}% + \ifstrempty{#2}{% + \subsection{Teilaufgabe \arabic{task}.\arabic{subtask}}% + }{% + \subsection{\arabic{task}.\arabic{subtask}. #2}% + }% \else% \subsection{#2}% \fi% @@ -443,7 +453,11 @@ \setcounter{subsubtask}{#1}% }% \if@tasknumbers% - \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% + \ifstrempty{#2}{% + \subsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}} + }{% + \subsubsection{\arabic{task}.\arabic{subtask}.\arabic{subsubtask}. #2}% + }% \else% \subsubsection{#2}% \fi% @@ -531,9 +545,9 @@ \else \def\homework@university{\@university} \def\homework@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} @@ -582,8 +596,8 @@ \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.