# [XeTeX] Setting a label within newcommand?

Andy Lin kiryen at gmail.com
Fri Sep 25 07:05:55 CEST 2009

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