Fix nonce typo
[exsheet.git] / exsheet2.cls
index c9a5826548a3c01808f8bd4c9f41876d3af155a1..f140a9f65d70f005a918e0c2f202e4b6f2190a01 100644 (file)
@@ -13,6 +13,8 @@
 \DeclareOption{naustrian}{\def \exsheetgerman{}}
 \DeclareOption{showanswers}{\def \exsheetshowanswers{}}
 \DeclareOption{exam}{\def \exsheetexam{}}
+\DeclareOption{nostudentinfo}{\def \exsheetnostudentinfo{}}
+\DeclareOption{nogradeinfo}{\def \exsheetnogradeinfo{}}
 
 
 \PassOptionsToClass{a4paper}{article}
@@ -23,7 +25,6 @@
 
 \@ifundefined{exsheetgerman}{
   \usepackage[american]{babel}
-  \usepackage[american]{isodate}
   \newcommand{\theexercise}{Exercise}
   \newcommand{\thepoint}{Point}
   \newcommand{\thepoints}{Points}
@@ -35,7 +36,6 @@
   \newcommand{\theof}{of}
 }{%
   \usepackage[ngerman]{babel}
-  \usepackage[german]{isodate}
   \newcommand{\theexercise}{Aufgabe}
   \newcommand{\thepoint}{Punkt}
   \newcommand{\thepoints}{Punkte}
@@ -47,6 +47,8 @@
   \newcommand{\theof}{von}
 }
 
+\usepackage[useregional]{datetime2}
+
 \RequirePackage{xifthen,geometry,fancyhdr,enumitem,comment,amssymb}
 
 \newcounter{exsheet2@pointsum}
 \def\@auth{}
 \renewcommand{\author}[1]{\def\@auth{#1}\def\@author{#1}}
 
-\def\@institute{}
+\def\@institute{}
 \newcommand{\institute}[1]{\def\@institute{#1}}
 
-\def\@school{}
+\def\@school{}
 \newcommand{\school}[1]{\def\@school{#1}}
 
-\def\@duration{}
+\def\@duration{}
 \newcommand{\duration}[1]{\def\@duration{#1}}
 
-\def\@instructions{}
+\def\@instructions{}
 \newcommand{\instructions}[1]{\def\@instructions{#1}}
 
+\let\olddate\date
+\DTMsavenow{exsheet2@today}
+\renewcommand{\date}[1]{\olddate{#1}\DTMsavedate{exsheet2@today}{#1}}
+
 
 \geometry{a4paper,textwidth=16cm,textheight=23cm}
 
     \@semester
   }
   \fancyhead[C]{%
-    {\isodate \today}
+    {\DTMsetdatestyle{iso}\DTMusedate{exsheet2@today}}
   }
   \fancyhead[R]{%
     \@auth\\
   }
   \@ifundefined{exsheetexam}{}{%
     \fancyfoot[R]{%
-      \tiny nounce: \arabic{examnonce}
+      \tiny nonce: \arabic{examnonce}
     }
   }
 }
         {\LARGE \bf \@title}
 
         \vspace*{1cm}
-        {\large \bf \@course\ (\@semester)}
+        {
+          \large\bf%
+          \@course
+          \ifthenelse{\equal{\@semester}{}}{}{ (\@semester)}
+        }
 
         \vspace*{1cm}
         \hrule
 
         \vspace*{1em}
 
-        \today\\
+        {\DTMusedate{exsheet2@today}} \\
 
         \vspace*{1em}
         \@curriculum \\
         \@institute \\
         \@school \\
 
-        \vspace*{1cm}
-        \theduration: \@duration
+        \ifthenelse{\equal{\@duration}{}}{}{%
+          \vspace*{1cm}
+          \theduration: \@duration
+        }
       \end{center}
 
       \vspace{4em}
       \@instructions
 
       \vfill
-      \makestudentinfo
 
-      \vspace{3em}
-      \makegradeinfo
+      \ifthenelse{\isundefined{\exsheetnostudentinfo}}{%
+        \makestudentinfo
+      }{}
+
+      \ifthenelse{\isundefined{\exsheetnogradeinfo}}{%
+        \vspace{3em}
+        \makegradeinfo
+      }{}
     \end{titlepage}
   }
 }