I originally wrote the below code for automatically labelling examples (don't know why I wanted that functionality, since it would break if I ever rearranged the examples). I'm not sure why it works, but it does: \theALabel is just a counter \newcommand{\AutoLabel}[1]{\ifthenelse{\equal{#1}{}}{\label{\theALabel}}{\label{\theALabel}\label{#1}}} -Andy