Verified Commit c190e23e authored by Adrian C. Hinrichs's avatar Adrian C. Hinrichs
Browse files

Implement options to customise the output-Style for counter


Signed-off-by: Adrian C. Hinrichs's avatarACHinrichs <adrian-corin.hinrichs@gmx.de>
parent bd6bca52
......@@ -41,10 +41,14 @@
\ProvidesClass{HomeworkAssignment}
[2017/04/29 v1.4 HomeworkAssignment]
\RequirePackage{kvoptions}
\DeclareStringOption[alph]{subproblemSty}
\DeclareStringOption[roman]{subsubproblemSty}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax \LoadClass{article}
\SetupKeyvalOptions{
family=hwa,
prefix=hwa@
}
\DeclareStringOption[alph]{subproblemsty}
\DeclareStringOption[roman]{subsubproblemsty}
\ProcessKeyvalOptions*
\relax \LoadClass{article}
\RequirePackage{suffix} \RequirePackage{fancyhdr}
\RequirePackage{ifthen}
......@@ -65,6 +69,48 @@
\renewcommand{\footrulewidth}{0pt} } \pagestyle{followingpage}
\AtBeginDocument{ \thispagestyle{firstpage}
\setlength{\headheight}{25pt} }
\newcommand{\hwa@problemno}{\arabic{problem}}
\newcommand{\hwa@subproblemno}{\alph{subproblem}}
\newcommand{\hwa@subsubproblemno}{\roman{subsubproblem}}
\ifthenelse{\equal{\hwa@problemsty}{arabic}}{
\renewcommand{\hwa@problemno}{\arabic{problem}}
}{
\ifthenelse{\equal{\hwa@problemsty}{roman}}{
\renewcommand{\hwa@problemno}{\roman{problem}}
}{
\ifthenelse{\equal{\hwa@problemsty}{alph}}{
\renewcommand{\hwa@problemno}{\alph{problem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@problemsty for option problemSty}{Possible Values are alph, arabic, or roman. Standard is arabic}
}
}
}
\ifthenelse{\equal{\hwa@subproblemsty}{arabic}}{
\renewcommand{\hwa@subproblemno}{\arabic{subproblem}}
}{
\ifthenelse{\equal{\hwa@subproblemsty}{roman}}{
\renewcommand{\hwa@subproblemno}{\roman{subproblem}}
}{
\ifthenelse{\equal{\hwa@subproblemsty}{alph}}{
\renewcommand{\hwa@subproblemno}{\alph{subproblem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@subproblemsty for option subproblemsty}{Possible Values are alph, arabic, or roman. Standard is alph}
}
}
}
\ifthenelse{\equal{\hwa@subsubproblemsty}{arabic}}{
\renewcommand{\hwa@subsubproblemno}{\arabic{subsubproblem}}
}{
\ifthenelse{\equal{\hwa@subsubproblemsty}{roman}}{
\renewcommand{\hwa@subsubproblemno}{\roman{subsubproblem}}
}{
\ifthenelse{\equal{\hwa@subsubproblemsty}{alph}}{
\renewcommand{\hwa@subsubproblemno}{\alph{subsubproblem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@subsubproblemsty for option subsubproblemsty}{Possible Values are alph, arabic, or roman. Standard is roman}
}
}
}
\newcommand{\hwa@kurs}{Kein Kurs}
\newcommand{\subject}[1]{\renewcommand{\hwa@kurs}{#1}}
\newcommand{\kurs}[1]{\subject{#1}}
......@@ -88,6 +134,7 @@
\newcounter{problem} \setcounter{problem}{0}
\newcounter{subproblem}[problem] \setcounter{subproblem}{0}
\newcounter{subsubproblem}[subproblem] \setcounter{subsubproblem}{0}
\newcommand{\problem}[1]{\@startsection{problem}%Name
{1}%Level
{\z@}%indent
......@@ -136,15 +183,15 @@
}
\newcommand{\newproblem}[1][]{\stepcounter{problem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{problem}{#1}}
\problem{Aufgabe \arabic{problem}} }
\problem{Aufgabe \hwa@problemno} }
\newcommand{\newsubproblem}[1][]{\stepcounter{subproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subproblem}{#1}}
\subproblem{Aufgabe \arabic{problem}.\alph{subproblem}} }
\subproblem{Aufgabe \hwa@problemno{}.\hwa@subproblemno} }
\newcommand{\newsubsubproblem}[1][]{\stepcounter{subsubproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subsubproblem}{#1}}
\subsubproblem{\roman{subsubproblem})} }
\subsubproblem{\hwa@subsubproblemno)} }
\endinput
%%
......
......@@ -136,10 +136,15 @@
% Loads the \texttt{article}, which is the base-class.
% \begin{macrocode}
\RequirePackage{kvoptions}
\DeclareStringOption[alph]{subproblemSty}
\DeclareStringOption[roman]{subsubproblemSty}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax \LoadClass{article}
\SetupKeyvalOptions{
family=hwa,
prefix=hwa@
}
\DeclareStringOption[alph]{subproblemsty}
\DeclareStringOption[roman]{subsubproblemsty}
%\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessKeyvalOptions*
\relax \LoadClass{article}
% \end{macrocode}
%
% Loads required Packages
......@@ -171,6 +176,50 @@
\AtBeginDocument{ \thispagestyle{firstpage}
\setlength{\headheight}{25pt} }
% \end{macrocode}
% \subsection{Internal commands}
% These are used to output the Exercise numbers in the desired style
\newcommand{\hwa@problemno}{\arabic{problem}}
\newcommand{\hwa@subproblemno}{\alph{subproblem}}
\newcommand{\hwa@subsubproblemno}{\roman{subsubproblem}}
\ifthenelse{\equal{\hwa@problemsty}{arabic}}{
\renewcommand{\hwa@problemno}{\arabic{problem}}
}{
\ifthenelse{\equal{\hwa@problemsty}{roman}}{
\renewcommand{\hwa@problemno}{\roman{problem}}
}{
\ifthenelse{\equal{\hwa@problemsty}{alph}}{
\renewcommand{\hwa@problemno}{\alph{problem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@problemsty for option problemSty}{Possible Values are alph, arabic, or roman. Standard is arabic}
}
}
}
\ifthenelse{\equal{\hwa@subproblemsty}{arabic}}{
\renewcommand{\hwa@subproblemno}{\arabic{subproblem}}
}{
\ifthenelse{\equal{\hwa@subproblemsty}{roman}}{
\renewcommand{\hwa@subproblemno}{\roman{subproblem}}
}{
\ifthenelse{\equal{\hwa@subproblemsty}{alph}}{
\renewcommand{\hwa@subproblemno}{\alph{subproblem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@subproblemsty for option subproblemsty}{Possible Values are alph, arabic, or roman. Standard is alph}
}
}
}
\ifthenelse{\equal{\hwa@subsubproblemsty}{arabic}}{
\renewcommand{\hwa@subsubproblemno}{\arabic{subsubproblem}}
}{
\ifthenelse{\equal{\hwa@subsubproblemsty}{roman}}{
\renewcommand{\hwa@subsubproblemno}{\roman{subsubproblem}}
}{
\ifthenelse{\equal{\hwa@subsubproblemsty}{alph}}{
\renewcommand{\hwa@subsubproblemno}{\alph{subsubproblem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@subsubproblemsty for option subsubproblemsty}{Possible Values are alph, arabic, or roman. Standard is roman}
}
}
}
% \subsection{Commands}
% \begin{macro}{\subject}
% Defines |\kurs|. |\subject| equals |\kurs|
......@@ -219,6 +268,7 @@
\newcounter{problem} \setcounter{problem}{0}
\newcounter{subproblem}[problem] \setcounter{subproblem}{0}
\newcounter{subsubproblem}[subproblem] \setcounter{subsubproblem}{0}
% \end{macrocode}
%
% Defines \enquote*{plain} sectioning-commands. See
......@@ -278,15 +328,15 @@
% \begin{macrocode}
\newcommand{\newproblem}[1][]{\stepcounter{problem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{problem}{#1}}
\problem{Aufgabe \arabic{problem}} }
\problem{Aufgabe \hwa@problemno} }
\newcommand{\newsubproblem}[1][]{\stepcounter{subproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subproblem}{#1}}
\subproblem{Aufgabe \arabic{problem}.\alph{subproblem}} }
\subproblem{Aufgabe \hwa@problemno{}.\hwa@subproblemno} }
\newcommand{\newsubsubproblem}[1][]{\stepcounter{subsubproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subsubproblem}{#1}}
\subsubproblem{\roman{subsubproblem})} }
\subsubproblem{\hwa@subsubproblemno)} }
% \end{macrocode}
%
......
......@@ -41,10 +41,14 @@
\ProvidesClass{HomeworkAssignment}
[2017/04/29 v1.4 HomeworkAssignment]
\RequirePackage{kvoptions}
\DeclareStringOption[alph]{subproblemSty}
\DeclareStringOption[roman]{subsubproblemSty}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax \LoadClass{article}
\SetupKeyvalOptions{
family=hwa,
prefix=hwa@
}
\DeclareStringOption[alph]{subproblemsty}
\DeclareStringOption[roman]{subsubproblemsty}
\ProcessKeyvalOptions*
\relax \LoadClass{article}
\RequirePackage{suffix} \RequirePackage{fancyhdr}
\RequirePackage{ifthen}
......@@ -65,6 +69,48 @@
\renewcommand{\footrulewidth}{0pt} } \pagestyle{followingpage}
\AtBeginDocument{ \thispagestyle{firstpage}
\setlength{\headheight}{25pt} }
\newcommand{\hwa@problemno}{\arabic{problem}}
\newcommand{\hwa@subproblemno}{\alph{subproblem}}
\newcommand{\hwa@subsubproblemno}{\roman{subsubproblem}}
\ifthenelse{\equal{\hwa@problemsty}{arabic}}{
\renewcommand{\hwa@problemno}{\arabic{problem}}
}{
\ifthenelse{\equal{\hwa@problemsty}{roman}}{
\renewcommand{\hwa@problemno}{\roman{problem}}
}{
\ifthenelse{\equal{\hwa@problemsty}{alph}}{
\renewcommand{\hwa@problemno}{\alph{problem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@problemsty for option problemSty}{Possible Values are alph, arabic, or roman. Standard is arabic}
}
}
}
\ifthenelse{\equal{\hwa@subproblemsty}{arabic}}{
\renewcommand{\hwa@subproblemno}{\arabic{subproblem}}
}{
\ifthenelse{\equal{\hwa@subproblemsty}{roman}}{
\renewcommand{\hwa@subproblemno}{\roman{subproblem}}
}{
\ifthenelse{\equal{\hwa@subproblemsty}{alph}}{
\renewcommand{\hwa@subproblemno}{\alph{subproblem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@subproblemsty for option subproblemsty}{Possible Values are alph, arabic, or roman. Standard is alph}
}
}
}
\ifthenelse{\equal{\hwa@subsubproblemsty}{arabic}}{
\renewcommand{\hwa@subsubproblemno}{\arabic{subsubproblem}}
}{
\ifthenelse{\equal{\hwa@subsubproblemsty}{roman}}{
\renewcommand{\hwa@subsubproblemno}{\roman{subsubproblem}}
}{
\ifthenelse{\equal{\hwa@subsubproblemsty}{alph}}{
\renewcommand{\hwa@subsubproblemno}{\alph{subsubproblem}}
}{
\ClassError{HomeworkAssignment}{Invalid Value \hwa@subsubproblemsty for option subsubproblemsty}{Possible Values are alph, arabic, or roman. Standard is roman}
}
}
}
\newcommand{\hwa@kurs}{Kein Kurs}
\newcommand{\subject}[1]{\renewcommand{\hwa@kurs}{#1}}
\newcommand{\kurs}[1]{\subject{#1}}
......@@ -88,6 +134,7 @@
\newcounter{problem} \setcounter{problem}{0}
\newcounter{subproblem}[problem] \setcounter{subproblem}{0}
\newcounter{subsubproblem}[subproblem] \setcounter{subsubproblem}{0}
\newcommand{\problem}[1]{\@startsection{problem}%Name
{1}%Level
{\z@}%indent
......@@ -136,15 +183,15 @@
}
\newcommand{\newproblem}[1][]{\stepcounter{problem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{problem}{#1}}
\problem{Aufgabe \arabic{problem}} }
\problem{Aufgabe \hwa@problemno} }
\newcommand{\newsubproblem}[1][]{\stepcounter{subproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subproblem}{#1}}
\subproblem{Aufgabe \arabic{problem}.\alph{subproblem}} }
\subproblem{Aufgabe \hwa@problemno{}.\hwa@subproblemno} }
\newcommand{\newsubsubproblem}[1][]{\stepcounter{subsubproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subsubproblem}{#1}}
\subsubproblem{\roman{subsubproblem})} }
\subsubproblem{\hwa@subsubproblemno)} }
\endinput
%%
......
\documentclass[a4paper,twoside,subproblemSty=numeral]{HomeworkAssignment}
\documentclass[a4paper,twoside,subproblemsty=alph]{HomeworkAssignment}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{%
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment