Cam's Blog

March 13, 2012

Hyperref and indexing in latex

Filed under: Latex — cfranc @ 10:59 pm

I’m writing a short post so that I don’t forget how to make indices and hyperrefs play well in latex.

• First note that modern classes like amsbook already have indexing features, so you don’t need to use the package makeidx with these classes. In fact, you’ll likely error as amsbook will already define certain macros that makeidx tries to define. So if you’re seeing that certain names (in my case it was \see, I believe) are already defined, try getting rid of \usepackage{makeidx}.
• You need to put \makeindex in the preamble and \printindex in the body where you want the index to appear.
• For the index to appear you’ve first got to compile the latex file to write a data .idx file containing the index data. Then go to a console and run makeindex filename where filename is the name of your tex file. This will reformat your .idx file correctly. Finally, recompile your tex document and you should see a nice index.
• If you’re doing this with hyperref package then you could run into errors if you do the above steps before you start using the hyperref package. That is, assume you make the index, then you add \usepackage{hyperref} at the top of your main tex file. Then you’ll error when you compile, because hyperref wants things formatted in a certain way. The solution? Go delete the auxiliary data files needed to generate the index. Make sure you’re using hyperref in your main tex file, recompile, do makeindex filename again, recompile again, and everything should work. If you’re not sure what auxiliary data files to delete, just carpetbomb everything without a .tex extension!

August 26, 2011

New webpage

Filed under: Random — cfranc @ 1:25 pm

In view of my move to UCSC, I’ve got a new academic webpage which you can find here. I spent some time learning PHP while making it, and I’m pretty happy with the result.

Older Posts »