I have defined a \newcommand
function like into this code:
\documentclass{scrartcl}
\usepackage{pbox,calc}
\newcounter{pointsExo}
\setcounter{pointsExo}{4}
\newcounter{pointsSousTotal}
\setcounter{pointsSousTotal}{0}
\newcounter{souspointsExo}
\newcommand{\sousPoints}[1]{
\setcounter{souspointsExo}{#1}
\setcounter{pointsSousTotal}{\value{pointsSousTotal} + #1}
{\scriptsize{(#1~\ifthenelse{#1<2}{point}{points}}/\arabic{pointsExo})}
}
\newcommand{\subexo}[2]{
#1\hfill\sousPoints{#2}% Points
\medskip
}
\begin{document}
\subexo{Anything}{2}
\subexo{Something}{0.5}
\end{document}
I would like to be able to call the command with both real or integer numbers:
\subexo{Anything}{2}
or
\subexo{Something}{0.5}
But I have errors like this with my current code:
! Package calc Error: `.' invalid at this point.
What should I modify into my \newcommand
definition to do this ?
calculator
packageexam
or packageexsheets
. Looks like you are trying to achieve some kind of exam paper.\sousPoints
command is defined as having only one argument, and you use it with two:\sousPoints{Anything}{2}
.