[NTG-context] Units and XML

Hans Hagen pragma at wxs.nl
Fri Apr 7 09:36:34 CEST 2006


Johannes Graumann wrote:
> Hello,
>
> Has anyone come up with a sense making way of coding units in XML and
> mapping them onto ConTeXt's 'units' module ... makes a knot in my brain ...
>   
there is a manual on the website ... physml

the old module:

\usemodule[physml]

the new one (newmml):

\usemodule[newmmu]

as in:

\usemodule[newmmu]

\starttext

Quick and dirty in||line units:

\startbuffer
<phys>
  <cn> 10 </cn>
  <cu> <Newton/> <Square/> <Meter/> <Per/> <Sec/> </cu>
</phys>
\stopbuffer

\typebuffer \processXMLbuffer

A more \MATHML||like unit application:

\startbuffer
<phys> <apply> <unit/>
  <cn> 10 </cn>
  <csymbol> <Square/> <Meter/> <Per/> <Sec/> </csymbol>
</apply> </phys>
\stopbuffer

\typebuffer \processXMLbuffer

A bit more compact:

\startbuffer
<phys> <apply> <unit/>
  <cn> 10 </cn>
  <cu> <Square/> <Meter/> <Per/> <Sec/> </cu>
</apply> </phys>
\stopbuffer

\typebuffer \processXMLbuffer

A bit more complicated:

\startbuffer
<phys> <apply> <unit/>
  <apply> <divide/> <ci> a </ci> <cn> 10 </cn> </apply>
  <cu> <Square/> <Meter/> <Per/> <Sec/> </cu>
</apply> </phys>
\stopbuffer

\typebuffer \processXMLbuffer

An alternative (equivalent) for \type {</cu>}:

\startbuffer
<phys> <apply> <unit/>
  <cn> 10 </cn> <cunseq> <Square/> <Meter/> <Per/> <Sec/> </cunseq>
</apply> </phys>
\stopbuffer

\typebuffer \processXMLbuffer

\stoptext

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list