m-unit and extra information for a unit.
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
At 00:12 24/04/2003 +0200, you wrote:
\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 }
\def\DescribeUnit#1#2% {\starttabulate[|w(.08\textwidth)|w(.2\textwidth)|p|] \NC \getvalue{#1} \NC \unitmeaning{#1} \NC #2 \NC \NR \stoptabulate} or: \def\DescribeUnit#1#2% {\NC \getvalue{#1} \NC \unitmeaning{#1} \NC #2 \NC \NR} \starttabulate[|l|l|p|] \DescribeUnit{AbsorptionCrossSection}{The equivalent surface area of a single molecule} \DescribeUnit{CollisionInducedAbsorptionCrossSection}{The absorption of the collision complex} \stoptabulate ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
At 00:12 24/04/2003 +0200, you wrote:
\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}
just use \mathematics for that purpose Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Maarten Sneep