[OS X TeX] Entering specially formatted items in the index
Alain Schremmer
Schremmer.Alain at gmail.com
Wed Aug 23 02:14:38 CEST 2006
Morten Høgholm wrote:
> 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):
>
> \newcommand*\DefineMetricPrefix[1]{%
> \expandafter\@ifdefineable\csname #1\endcsname{%
> \DefineMetricPrefix at aux#1\@nil
> }
>
> }
> \def\DefineMetricPrefix at aux#1#2\@nil{%
> \expandafter\DeclareRobustCommand \csname#1#2\endcsname{%
> \ensuremath{#1\mathsmaller{#2}}%
> }%
> \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}}
> and
> \indexDEKA -> \index{DEKA@\DEKA}
Well, I guess this is what I get for thinking up these bizarre formats.
I am going to try it in a day or two.
On the other hand, I am seriously considering giving up on the metric
system entirely. :-)
Very grateful regards
--schremmer
------------------------- 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 macostex-archives
mailing list