Added new builtin functions to support LaTeX-like counters for repeating elements.