I recently came to know about David Carlisle's package [`xii`](http://ctan.org/pkg/xii). The code and the output look SO different from each other that I am curious to know the meaning of that code. Can anybody explain how that code works?
I recently came to know about David Carlisle's package [`xii`](http://ctan.org/pkg/xii). The code and the output look SO different from each other that I am curious to know the meaning of that code. Can anybody explain how that code works?
That's impressive, indeed! David wrote the code very carefully to need only a single `%` for a line termination. My first attempt at a square of code required almost all lines terminated with `%`
But you've not mentioned the crowning touch -- the fact that the code is neatly packaged into a perfect rectangle. That' what boggles *my* mind
If you understand Latin better than you understand English, there's also xii-lat based on the same approach.
Once I dissected that code (maybe I have the dissected version somewhere). It's not _hard_ to understand, but it takes a bit of patience. There are two main parts that add to the complication: first is the obfuscation with catcode changes (making single letters behave as macros), and then the text compression. The text is written such that roughly only the last verse is written in full, and the last ones are build from that step-by-step.
https://tex.stackexchange.com/questions/105808/how-could-the-macro-xii-tex-be-simplified-into-a-better-readable-form covers this, more or less