Archive for March, 2014

Follow the Signs

March 22, 2014

The following picture was taken at the intersection of Cardigan Street and Kilner Lane, Camperdown.

OK, so lets say you want to go to ‘main or ‘te Bay. You ignore the other two signs and continue as directed. Pretty soon you’re dumped at this intersection.

Yes, that is really telling you to turn right onto Parramatta road. But due to the timing of the traffic lights, you’ll likely have three lanes all to yourself, the leftmost of which is a bus lane.

At the first possible opportunity (Gordon St) to turn left, there is another cycling sign. Eager to get off the main road, you take it. Despite the fact that this sign is giving you two new destinations, Glebe and City.

Pretty soon, you’re dumped on Pyrmont Bridge Road, which could really do with both a high quality bike lane and a reduction in the speed limit from 60 to 50. (I don’t know myself how to fix these problems for you).

From here on, the trail goes cold as far as I can tell (as in there being no more signs to tell you where to go). From start to finish, we’ve managed to cover a grand total of just 280 metres.

\def, \newcommand, \span and \align

March 9, 2014

I learnt something about TeX/LaTeX today.

I got the following cryptic error message:
! Missing # inserted in alignment preamble.

l.38 \end{align*}

Now when I went to google “Missing # inserted in alignment preamble”, I immediately got a lovely website which was able to answer my question. But hey, information survives by being copied, so if you’ll kindly allow me to continue, I shall.

Stripped down to a minimal example, here is the problematic code.

\documentclass[11pt, reqno]{amsart}




u &= \arctan x & dv &= 1 \, dx
\\ du &= \frac{1}{1 + x^2} dx & v &= x.


Actually stripping down to a minimal example kind of makes it obvious where the error is – it must be somewhere in the \def\span line.

It turns out that \def and \newcommand act differently. I’d always just assumed that \def and \newcommand were synonymous, and used the former since it involved less typing. And it’s true, most of the time you don’t notice the difference.

The problem in the above code is that \span is already defined to be something important needed to internally execute the \align command. By using \def, we’re redefining what \span means. If we used \newcommand instead, we wouldn’t be able to redefine \span and we’d get an instructive error message.

So the moral of the story is: \newcommand is safer.