diff --git a/task.sty b/task.sty index 557b451..20ffbeb 100644 --- a/task.sty +++ b/task.sty @@ -47,12 +47,13 @@ \newlength\@@subtaskcl +\newcount\@@hmin \newcount\@@hmax \newcount\@@hdiff \newcount\@@hconf \newenvironment{@task}[1][]% {% \def\@@h{#1}% \goodbreak\leavevmode\@margin@sig \llap{% - \raisebox{-\baselineskip}[0em][0em]{% + \raisebox{-1.8\baselineskip}[0em][0em]{% \shortstack{% {\sc\taskname}\space\thesubtaskc \\ @@ -60,6 +61,12 @@ \ifx\@@h\empty\else {\small\@task@h#1||\,h}% \fi% + \\ + \vphantom{M}% + \ifx\@@h\empty\else + \@task@setregs#1||% + {\scriptsize \the\@@hconf\% Confidence}% + \fi% }% \hspace{\the\taskspace}% % adjust width of the subtask text so that the task number lines up @@ -73,3 +80,15 @@ \def\@task@h#1-#2||{#1--#2} +\def\@task@setregs#1-#2||{% + \@@hmin#1\relax + \@@hmax#2\relax + % perform calculation (be sure to multiply by 100 before dividing, otherwise + % we lose everything through integer truncation); the calculation is: + % 100 - ((|N-M|/M)*100) + \@@hdiff#2\relax \advance\@@hdiff-#1\relax + \@@hconf\@@hdiff + \multiply\@@hconf by 100\relax + \divide\@@hconf by-\@@hmax + \advance\@@hconf by 100\relax +}