Implementing a counter in markup text: Difference between revisions

m New category
simultanous calls are backward!
Line 33: Line 33:
   (interpret-markup layout props (make-counter-markup name)))
   (interpret-markup layout props (make-counter-markup name)))


\markup { Initial value of the counter: \counter #"mycounter". Second call: \counter #"mycounter" }
\markup { Initial value of the counter: \counter #"mycounter". }
\markup { Second call: \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { A second counter: \counter #"myothercounter" }
\markup { A second counter: \counter #"myothercounter" }
Line 41: Line 42:
\markup { Set first counter to 15: \setcounter #"mycounter" #15 }
\markup { Set first counter to 15: \setcounter #"mycounter" #15 }
\markup { It is increasing: \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { don't rush it: }
\markup { It is increasing: \counter #"mycounter" }
\markup { Three calls in a row: \counter #"mycounter", \counter #"mycounter" and \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { It is increasing: \counter #"mycounter" }
\markup { Second counter is increasing: \counter #"myothercounter" }
\markup { Second counter is increasing: \counter #"myothercounter" }