First some preliminary statements:

  • this is a rant about how I had to get thmtools working, it's not about the package itself (which is great)
  • I hate Ubuntu's TeX Live, it's outdated as hell and there's no way to update it
  • I should've been studying my algebraic geometry exam, but I got so angry about what was going wrong I decided to get it working regardless of how long it would take (which was almost three senseless and long hours of swearing and messing around)
  • this post discusses how to do it using Ubuntu's sucky TeX Live, I hope you don't suffer from the same problems as I did

I only wanted \listoftheorems-ish functionality. That's all. Seems like a reasonable wish, right? :-)

First I started using ntheorem. But it was impossible to get the theorem styles matching with what I wanted (basically the result from using definition as defined in amsthm. Then I found out about thmtools, which could provide me with the same functionality.

So far so good. I quickly rewrote my \newtheorem's to \declaretheorem, using [style=definition,numberwithin=chapter] as options. Everything looked fine (that is, exactly the same as before, given the amount of time I spent at fixing typographical issues and bad boxes, that was important and unachievable within ntheorem) but \listoftheorems kept displaying all theorems (all 260 of them...), even with [onlynamed] specified!

Then I realized the manual (which is beautiful, all manuals should be like this) is for a 2010 version, while a quick peek in my texmf folder revealed I was working with version 0.1beta from 2008. Ding! Found it. So I manually installed the newest version.

But, Ubuntu's TeX Live was fucked up. It also contains an ancient (2008) version of nameref, part of hyperref. Can you feel it coming? One of the most complex packages is being dragged into the problem. The actual error I got was

! Undefined control sequence.
 \NR@gettitle

Not really the most insightful one. But some fiddling around learnt me that thmtools needs functionality from a newer version of nameref. Now there are two solutions: update hyperref (by hand, as tlmgr --update doesn't work on Ubuntu's TeX Live) and all its dependencies or perform a little hack. I went for the first, but given the laborious nature of updating all dependencies I quickly gave up. Just open $TEXMFf/tex/latex/thmtools/autoref.sty and comment line 98. Everything works now. As I'm not using autoref (I should've been, but changing it now is too much work) this is no problem at all.

And you thought it was all happy sunshine now? Forget it. My theorem styles were wrong. The body font was set to italic. Apparently, in the new version, you have to set the theorem style for each new environment. Just linking it all together with the option [sibling=theorem] wasn't enough, although amsthm and the 0.1beta version inherited the theorem style from the previous definitions. True, that's bad behaviour, but I relied on it. So you have to add style=definition as well to every \declaretheorem. The manual isn't really explicit about this unfortunately.

But, now it works! I'm sorry if this post isn't written in a clear way, but I'm feeling too pumped up now to write anything more coherent or howto-style. Expect an actual howto on this cool package, as I've tweaked the output of \listoftheorems, regardless of the manual stating "There’s currently no interface to change the look of the list. If you’re daring, [...]".

And let me repeat this: thmtools is a nice package. It's just too new and radical (for Ubuntu's TeX Live). But the manual is great, the functionality is great, my own code is much cleaner now. If only Ubuntu's TeX Live was up to date... Next time I install Ubuntu I will manually install TeX Live, no more repository versions for me.