Introducing the visual counter module

A typical document usually contains many contains many counters: page numbers, section numbers, enumerations, theorems, and so on. Displaying all these numbers gets boring quickly. Do you want to spice up the document a bit? Enter the visual counter module.

The idea is simple. Each counter already keeps track of its current and maximum value. So, we can just pass that information to MetaPost and display the counter in a visually attractive manner. For example, to display page numbers, I use:




The options are pretty self explanatory. counter sets the name of the counter that we want to display (the module figures out its current and maximum (last) value) The alternative selects the type of visual counter that you want to use. The \usevisualcounter macro displays the counter. Currently, I have only implemented two alternatives: countdown and pulseline. (Here is an example showing both of them). I plan to add others in the future. Suggestions are welcome!

At the moment, there is no documentation. I am still playing around with the API and the code is in a state of flux. Nonetheless, you can take a look in the tests directory to see a few examples of how things work. Stay tuned for more posts on this module.

I am also using the new name space code in the module. It is very very elegant. The entire module has just three macros (two of them are just for convenience). Everything else is just a matter of setting the values for different options. A big advantage of the name space code is that the macros to access the value of a particular option are fully expandable. This means that they can be used directly inside Metapost. No need to have an extra \setMPvariables to pass values to Metapost. Yipee!

Note: It appears that github is down at the moment. Hopefully, it will come back up soon.


6 thoughts on “Introducing the visual counter module

    • Indeed. This module grew out of some of the style that we (Thomas and I) created for the simple slides modules.

      In principle one can port these to LaTeX (maybe by using TikZ rather than metapost to do the drawing). But, that would mean completely starting from scratch. LaTeX and ConTeXt handle key-value pairs in completely different ways; the corresponding LaTeX style will be much more verbose.

        • ConTeXt is not an engine but a macro package; like LaTeX it is built on top of TeX. Beamer is a style sheet for LaTeX, and hence does not work with ConTeXt. ConTeXt has its own presentation modules: some examples of the default styles and user modules.

          ConTeXt follows a different syntax than LaTeX (the consistency of ConTeXt’s syntax is one of its strength); so LaTeX source will not work out of the box for ConTeXt.

  1. Pingback: visual counter for Maya numbers « Random Determinism

  2. Pingback: Announcing the visualcounter module « Random Determinism

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s