Hi TeXnicians,
I'd like to have an extension to the units module (I don't mind cooking
something myself, but a pointer where to start would be great).
In my thesis I will encounter some weird units (one is displayed below,
it not the worst, but it comes close). I'd like to produce a list of
units, but just the symbol and the actual unit is not really enough, I
need room for a description. Ideally this description should be given
at the definition of the unit. What I have now is sort-of in between,
code shown below.
Since the unit module is based on synonyms, I probably have to extend
those, but I'm afraid that I really don't understand that code... My
current method should work, but it requires a double definition (unless
someone comes up with an idea how to define (double if I have to) in
one place, and put the resulting list in another location).
Ideas?
Maarten Sneep
%% begin sample code
\usemodule[units]
%% taken from the latex.ltx source
\def\ensuremath{%
\ifmmode
\expandafter\MyFirstOfOne
\else
\expandafter\MyEnsuredMath
\fi}
\long\def\MyEnsuredMath#1{$\relax#1$}
\long\def\MyFirstOfOne#1{#1}
% units
\def\PowerFour {\dimensionpower{4}}
\def\PowerFive {\dimensionpower{5}}
\unit[Molecule]{molecule}{molecule}
\unit[AbsorptionCrossSection]{\ensuremath{\sigma}}%
{\Square \Centi \Meter \Inverse \Molecule}
\unit[CollisionInducedAbsorptionCrossSection]{\ensuremath{\kappa''_{sq}}
}%
{\PowerFive \Centi \Meter \ISquare \Molecule}
\defineparagraphs[unitdescription][n=3,before=,after=,distance=1.4ex]
\setupparagraphs[unitdescription][1][width=.08\textwidth]
\setupparagraphs[unitdescription][2][width=.2\textwidth]
\def\DescribeUnit#1#2{%
\startunitdescription
\csname #1\endcsname
\unitdescription
\unitmeaning{#1}
\unitdescription
#2
\stopunitdescription
}
\starttext
\DescribeUnit{AbsorptionCrossSection}{The equivalent surface area of a
single molecule}
\DescribeUnit{CollisionInducedAbsorptionCrossSection}{The absorption of
the collision complex}
\stoptext