[OS X TeX] Entering specially formatted items in the index

Morten Høgholm morten.hoegholm at gmail.com
Tue Aug 22 18:45:50 EDT 2006

On Wed, 23 Aug 2006 00:31:03 +0200, Alain Schremmer  
<Schremmer.Alain at gmail.com> wrote:

>> Assuming the definition
>>   \newcommand*\DEKA{\ensuremath{\denom{D\mathsmaller{EKA}}}}
>> you should be able to get by with just
>>   \index{DEKA@\DEKA}
> Would there be a way other than entering one definition for each metric  
> prefix?

You could do something like this (entirely untested):

   \expandafter\@ifdefineable\csname #1\endcsname{%
     \DefineMetricPrefix at aux#1\@nil

\def\DefineMetricPrefix at aux#1#2\@nil{%
   \expandafter\DeclareRobustCommand \csname#1#2\endcsname{%
   \expandafter\protected at edef\csname index#1#2\endcsname{%
     \noexpand\index{#1@\expandafter\noexpand\csname #1#2\endcsname}}%

\DefineMetricPrefix{DEKA} then defines
   \DEKA -> \ensuremath{D\mathsmaller{EKA}}
   \indexDEKA -> \index{DEKA@\DEKA}
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list