6
votes
2answers
148 views

Counters and macros?

Not sure how I should post my question but here it is: I've seen that in plain TeX, \newcount is illegal inside a macro \definition. Is there a way to allocate a register inside a macro? Also, if I ...
5
votes
1answer
397 views

\newcounter vs \newcount [duplicate]

What are the differences between \newcounter vs \newcount? So far as my knowledge goes \newcounter is from LaTeX and \newcount is from TeX. Also, I find that \newcounter has an optional automatic ...
23
votes
3answers
691 views

@tempdima, reserved@a, @tempcnta, what else?

I'm aware that some "temporary" LaTeX dimensions etc. exist. I would, however, like to know all of them. I know \reserved@a (macro), \@tempdima (dimension) and \@tempcnta (counter).
13
votes
4answers
478 views

Dividing dimensions to get a count

Is there a way to divide two dimens and get a count? For example, if I have a box that doesn't fit on a single page, and I want to know the number of pages I'd need for the box (i.e., \heightofbox / ...
2
votes
1answer
267 views

How to compare two counters using TeX conditionals in ConTeXt?

I have two counters, \definenumber[words] and \definenumber[items]. I have tried to use TeX conditionals to compare them, e.g.: \ifnum\getnumber[words]=\getnumber[items] This will print some text ...
14
votes
3answers
228 views

How to determine which register a count uses

Suppose there is \newcount\c@mycountera \newcount\c@mycounterb \newcount\c@mycounterc Each \newcount uses \alloc@ and that has \wlog{\string#5=\string#2\the\allocationnumber}. Thus to determine ...
19
votes
1answer
1k views

What are the differences between TeX counts and LaTeX counters?

The title already states the whole question. It has been answered by Joseph Wright at http://www.texdev.net/2009/11/17/tex-counts-and-latex-counters/, but I have not seen the according answer here at ...
5
votes
3answers
450 views

Programmatically setting a counter to a substring

I'm trying to set a counter based on the name of the current job. I've got the number I need by doing something like \substring{\jobname}{5}{5}} using the stringstrings package, and if I just output ...
9
votes
3answers
376 views

Making register declarations local, Undefining a register (count, toks, etc.)

Is it possible to make \newcount, \newtoks, etc. respect grouping, so that, e.g., \newcount\temp\temp=2{\newcount\temp\temp=1}\showthe\temp gives 2 (instead of 0)? Relatedly, is it possible to ...