[Tex/LaTex] Subtract a counter from another in plain tex

countersplain-tex

I'm sure this is very easy, but searching the internet I came up with nothing, and reading the TeXbook, I learned so much other stuff that I forgot what I was originally looking for 😉

So, I just want to set the value of a counter to the difference of the values of two other counters in plain TeX, like this:

\newcount\countOne%
\newcount\countTwo%
\newcount\diff%
\diff=\countOne-\countTwo\relax%

Only, this doesn't work, ending up with "missing number, treated as zero"…

Best Answer

\diff=\countOne
\advance\diff-\countTwo