ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* m-unit and extra information for a unit.
@ 2003-04-23 22:12 Maarten Sneep
  2003-04-24  7:33 ` Hans Hagen
  2003-04-24  7:34 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Maarten Sneep @ 2003-04-23 22:12 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: m-unit and extra information for a unit.
  2003-04-23 22:12 m-unit and extra information for a unit Maarten Sneep
@ 2003-04-24  7:33 ` Hans Hagen
  2003-04-24  7:34 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2003-04-24  7:33 UTC (permalink / raw)


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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: m-unit and extra information for a unit.
  2003-04-23 22:12 m-unit and extra information for a unit Maarten Sneep
  2003-04-24  7:33 ` Hans Hagen
@ 2003-04-24  7:34 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2003-04-24  7:34 UTC (permalink / raw)


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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-24  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-23 22:12 m-unit and extra information for a unit Maarten Sneep
2003-04-24  7:33 ` Hans Hagen
2003-04-24  7:34 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).