LaTeX and Processing.js In The Same Room

I’ve been messing around with LaTeX for some time now, but I was faced with a new challenge yesterday when I had to typeset a book of poetic conversation between two different authors. One poet’s work needed to be set on the left page and the other’s on the right. The solution seemed to be the eledpar package, which is an extension of the eledmac package. Eledmac allows users to create critical editions of a text, and eledpar allows for the creation of parallel texts, either in columns on a single page or on facing pages, just what I needed.

The initial document set-up wasn’t too difficult, and I soon had the text appearing where I wanted it, but then I ran into difficulty with the poetry itself.  For previous books I have been using specific packages to help me set poetry, whereas eledmac provides its own functions for setting poetry that are based on edstanza, some of which seem to conflict with the poetry packages I use.  The result was that I spent a fair bit of frustration time yesterday afternoon.

While I was engaged with that problem, my eldest son was at the other computer on Kahn Academy’s site working on some programming problems of his own.  He is learning to program in processing.js, which both fascinates and frustrates him in equal measure, much as LaTeX fascinates and frustrates me.

“Dad,” he said at one point, “the problem is that you can’t even make one mistake,” which hits on the frustration of programming exactly, even if it isn’t strictly true.  After all, the editor that he uses is pretty good at guessing where his errors are and telling him what he needs to do to fix his code, and ShareLaTeX, the online editor that I use, can compile anything but the most egregious errors.  His point, however, is absolutely accurate.  The frustration of programming, especially for someone like me, who is used to manipulating language with a fair degree of creativity and flexibility, is that one wrong line of code can break the whole thing.

If I miss a period in a short story, it will print just the same.  My reader might not even notice.  If I miss a comma, there could be some discussion about whether it needs to be included at all.  If I cut a sentence or even a paragraph more or less, everything will likely still read properly.  If I miss a single operand in my code, however, it may not compile, and if I’m not sure how to fix my error, it won’t be as easy as putting in a period.  I may need to go hunting through a manual or harass someone who knows better or post a question on Stack Exchange.  It could take me all afternoon, and the answer will probably be something depressingly simple.

My son’s problem was of exactly that kind.  He had forgotten to change his fill colour, so his new shape had blended into the background image and seemed not to have been rendered at all.  It took only a few seconds to fix, and then he said, “The good thing about computers is that you know if it’s right,” and this is true too.  The reward of programming is having it work and knowing that you got it right.

No matter how many times I revise a short story, I’m never quite sure I’ve got it right (in fact, with that sort of writing, I’m convinced that there’s no such thing as getting right), but I always know when the code compiles the way it should, and there is a unique satisfaction in this.  It’s not a satisfaction sufficient to make me program more seriously, but it was sufficient, at least at that moment, for me to share it with my son, a connection that I never expected, and I am starting to see why some people become addicted.

 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: