Updating 'geometry' in TexLive + Ubuntu

I wanted to use \newgeometry to alter the layout of a document in the middle of it, but I was getting the dreaded Undefined control sequence error, which showed that the version of the geometry package installed with Ubuntu was too old.

Thanks to this thread at Ubuntu forums I learned how to install LaTeX packages at will, and I finally had a newer geometry package that supported \newgeometry! \o/

I presume it will work with any other (La)TeX package you might want to install, so I'll write down the steps just in case I need them for the future:

First, download the package's zip file (or any other equivalent compressed file release). Uncompress it and locate the .dtx file.

We need to "compile" this file before LaTeX can use it. To do so, cd to the place where the .dtx file is and run:


tex geometry.dtx

This generates a .sty file (geometry.sty) that we'll have to copy to a special place where TeX looks for stuff. This "special place" can actually be a number of places, but the only one that worked for me was /usr/local/share/texmf/tex/latex/geometry/. (I also tried placing it in ~/texmf/tex/latex/geometry/, to no avail--it didn't seem to be recognised, don't know why).

Once it's in the proper place we need to let TeX know that there's new stuff. This is done with


sudo texhash

And we should be able to use the newer geometry package now! Yayyy!

PS Is it just me or people look at you with weird faces too, when they hear you're learning about LaTeX? I bet they actually understand "latex" ;-)