The chngpage package vs the changepage package

It occurs to me that there aren’t many people writing on the web about LaTeX. Mostly, I suspect, for the same reasons you don’t see as many people writing about HTML+CSS these days. It’s just a tool that some people use.

(That’s not to say that there aren’t periodicals and the like for people to write about what’s been going on.)

Anyway; here’s a nugget of information that might be of some use to some people in the near future.

Peter Wilson’s memoir LaTeX class is a major, recent, project that ties in many ideas for how to layout and customise a document in a single class. Some of the ideas in the class are also broken out into separate packages so that people who aren’t using memoir can still take advantage of them.

“chngpage” was one such package. It allowed you to locally change the layout of the text block in various different ways (for example, to place a figure that is centred on the physical page rather than centred in the text block). It also provided the very nice ability to robustly detect whether you’re on an even or odd page at any given position in the document (which is harder than you might expect).

Unfortunately, because chngpage was written before memoir it differed in one important way; to cut a long story short this made it tedious to write code that required the chngpage package because you had to jump through hoops to get it working in memoir as well. (As an example, see my addlines package.)

The problem was that neither memoir nor chngpage could be changed because of backwards compatibility problems. So Peter Wilson wrote a new package “changepage” that provides the same functionality as chngpage but uses the same interface as memoir; the result of this new package is that chngpage should no longer be used.

While it can still be found in the “obsolete” section of CTAN (here), chngpage is no longer included in TeX Live (as of TeX Live 2008). Packages that use it should switch to changepage, which is simply a matter of something like s/\ifcpoddpage/\ifoddpage/ for those who like regular expressions.

That reminds me. I’ve got a package that uses chngpage that I really need to update now…

Update: Fearless Leader (a.k.a. Karl Berry) has convinced me that any backwards compatibility problems caused by removing chngpage outweighs any nice ideological benefit from removing the package entirely. So it still exists in TeX Live! (Which was not my decision, but I agree with it.) The moral of the story, in the end, is the same: in new documents and packages, use the new changepage so that you play nicely with memoir