improve punkte macro to adapt to exercise numbers not starting from 1

This commit is contained in:
2020-04-30 16:15:52 +02:00
parent 997803e20b
commit 3bd25450fa
3 changed files with 18 additions and 9 deletions
+17 -6
View File
@@ -22,6 +22,7 @@
\RequirePackage{mathtools} \RequirePackage{mathtools}
\RequirePackage{forloop} \RequirePackage{forloop}
\RequirePackage{totcount} \RequirePackage{totcount}
\RequirePackage{calc}
\usetikzlibrary{quotes, angles} \usetikzlibrary{quotes, angles}
@@ -59,6 +60,9 @@
% enable aufgaben counting % enable aufgaben counting
\regtotcounter{aufgabe} \regtotcounter{aufgabe}
% temporary calculation counter
\newcounter{var}
\newcommand{\N}{\mathbb{N}} \newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}} \newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}} \newcommand{\Z}{\mathbb{Z}}
@@ -81,21 +85,28 @@
} }
% punkte tabelle % punkte tabelle
\newcommand{\punkte}{ \newcommand{\punkte}[1][1]{
\@punkten{\totvalue{aufgabe}} \newcounter{k}
\setcounter{k}{#1}
\@punkten{\value{k}}{\totvalue{aufgabe}}
\setcounter{k}{#1-1}
\setcounter{aufgabe}{\value{k}}
\vspace{5mm}
} }
\def\@punkten#1{ \def\@punkten#1#2{
\newcounter{n} \newcounter{n}
\begin{tabular}{|c|*{#1}{m{1cm}|}m{1cm}|@{}m{0cm}@{}} % create a temporary calculation counter
\setcounter{var}{#2-#1+1}
\begin{tabular}{|c|*{\value{var}}{m{1cm}|}m{1cm}|@{}m{0cm}@{}}
\hline \hline
Aufgabe Aufgabe
\forloop{n}{1}{\not{\value{n} > #1}}{ \forloop{n}{#1}{\not{\value{n} > #2}}{
& \centering A\then & \centering A\then
} }
& \centering $\sum$ & \\[5mm] \hline & \centering $\sum$ & \\[5mm] \hline
Punkte Punkte
\forloop{n}{1}{\not{\value{n} > #1}}{ \forloop{n}{#1}{\not{\value{n} > #2}}{
& &
} }
& & \\[5mm] \hline & & \\[5mm] \hline
Binary file not shown.
+1 -3
View File
@@ -5,9 +5,7 @@
\author{Dominik Daniel, Christian Merten} \author{Dominik Daniel, Christian Merten}
\title{Lineare Algebra II: Übungsblatt 1} \title{Lineare Algebra II: Übungsblatt 1}
\punkte \punkte[4]
\setcounter{aufgabe}{3}
\begin{aufgabe} \begin{aufgabe}
\begin{enumerate}[(a)] \begin{enumerate}[(a)]