lazy.counter(counter, value, oldcounter, fn = c("new", "addto", "set", "use",
"value"))fn="addto", it is the value by which
the counter is to be increased. For fn="set", it is the value to
which the counter should be setfn="new".
It must be a previously named counter. If present, the new counter will
be reset whenever oldcounter is incrementedpart, chapter, section, subsection, subsubsection, paragraph, subparagraph, page, equation,
figure, table, footnote, mpfootnote. Any of these may be manipulated by lazyWeave.Referring to and manipulating counters is done using lazy.counter. Different actions are achieved by changing the fn
argument.
fn="new" creates a new counter with name counter.
fn="addto" adds value to the current value of counter.
fn="set" changes the current value of counter to value.
fn="use" designates counter for use in the current environment.
fn="value" returns the value of counter. This value isn't printed, but can be useful for doing arithmetic with
counter values.
The HTML counters in counter are the defaults and will reference global counters
options("html.counter.table")
options("html.counter.table"
options("html.counter.table"
options("html.counter.table"
options("html.counter.table"
options("html.counter.table"
options("html.counter.table"
}
Additional and custom counters may be defined if desired, in which case a new option will be defined as
options("html.custom.[countername]").
Extracting a current value does not increment the counter--this must be done manually (and is done manually when used in lazy.table, lazy.figure,
lazy.footnote, and lazy.section.
lazy.counter("myCounter")
lazy.counter("myCounter", value=3, fn="set")
lazy.counter("myCounter", value=2, fn="addto")
lazy.counter("myCounter", fn="use")
lazy.counter("myCounter", fn="value")
lazy.counter("table", fn="use")Run the code above in your browser using DataLab