Let's clarify that countdef\mycount=<number>
is a bad idea in LaTeX, then clarify appropriate usage of \newcount\mycount
vs \newcounter{mycount}
in LaTeX.
Background: I only started with TeX last year and before long I got tired of doing everything from scratch. Everyone surely knows what it's like reading The TeXBook. At any one time I had the book at my fingertips with around 10 or so cardboard bookmarks interspersed, jumping from bookmark to bookmark, referring to the index, adding more bookmarks, driving myself towards some solution or other.
I discovered countdef\mycount=<reg number>
on page 119, where Knuth just tells you how to use them without any warning. So, as a naive rookie I used them, my solution worked and I had no reason to look further. Sometime later, working in LaTeX, I dredged this out of my memory and got in to trouble using it. I discovered \newcounter{mycount}
and didn't look back.
Now that I'm looking into matters more deeply I need to raise the issue again. Back during my initial struggle to understand Plain-TeX, if I'd continued to read on to page 121, where Knuth explains the importance of \newcount
, I wouldn't have been asking the first part of my question now. The TeXBook is a vast and complicated book and I think raising this question is a useful awareness raiser of one of the "traps for young players" in delving into Plain-TeX.
Hopefully this explains how I originally fell foul of such a fundamental error and I'm pointing out that others could do the same. Also, as there are many times when using Plain-TeX in creating a LaTeX solution is useful, I'd really like to know the dos and don'ts of \newcount
vs \newcounter{}
in LaTeX.
\newcount\mycount
. Or even better\newcounter{mycount}
which creates a counter with name\c@mycount
. – yo' Nov 7 '13 at 0:09\countdef\mycount=81
is a really bad idea also in Plain TeX. – egreg Nov 7 '13 at 0:12\c@mycount
is the internal count register. – Ruben Nov 7 '13 at 0:14\newcounter{}
already. My question is about illuminating the whys and wherefores. – Geoff Pointer Nov 7 '13 at 0:38