Difference between revisions of "Math with newmat"

From Wiki
Jump to navigation Jump to search
m (Removed extraneous brackets, cleaned spacing, corrected "permeance" misspelling.)
(More description, example of inline math, some rearrangement of examples, etc.)
Line 1: Line 1:
 
< [[Math]] | [[MathML]] | [[Math with amsl]] | [[Math with nath]] >
 
< [[Math]] | [[MathML]] | [[Math with amsl]] | [[Math with nath]] >
  
Here a short example how to use math with the [http://source.contextgarden.net/m-newmat.tex newmat] module (you can use inline math with $ some math $ ):
+
Here some short examples of how to use math with the [http://source.contextgarden.net/m-newmat.tex newmat] module, which "collects macros that TeX users kind of expect to be available when typesetting math," according to the documentation.  These currently include the <cmd>frac</cmd> family (<cmd>frac</cmd>, <cmd>dfrac</cmd>, <cmd>tfrac</cmd>, <cmd>binom</cmd>, etc.), the <cmd>QED</cmd> symbol, the <cmd>boxed</cmd> command, and the <tt>subarray</tt>, <tt>substack</tt>, and <tt>smallmatrix</tt> environments, along with a few others.  At one time it also included the <cmd>text</cmd> command, though that has now been moved to the core.
  
 
<texcode>
 
<texcode>
 
\usemodule[newmat]
 
\usemodule[newmat]
 +
 +
Inline math: $x = \frac{y}{2z} + x_{\text{center}}$
 +
</texcode>
 +
 +
<context>
 +
\usemodule[newmat]
 +
Inline math: $x = \frac{y}{2z} + x_{\text{center}}$
 +
</context>
 +
 +
<texcode>
 +
Display math:
  
 
\startformula
 
\startformula
Line 12: Line 23:
 
k \frac{\partial \phi}{\partial x}
 
k \frac{\partial \phi}{\partial x}
 
\stopformula
 
\stopformula
 +
</texcode>
 +
 +
<context>
 +
\usemodule[newmat]
 +
Display math:
 +
 +
\startformula
 +
q = \delta \frac{\partial p}{\partial x} =
 +
\delta(\phi) p_{vsat}(\theta) \frac{\partial \phi}{\partial x} =
 +
\left[ \frac{\delta_a}{\mu(\theta)} p_{vsat}(\theta) \right] \frac{\partial \phi}{\partial x} =
 +
k \frac{\partial \phi}{\partial x}
 +
\stopformula
 +
</context>
 +
 +
<texcode>
 +
Legends:
  
 
\startlegend
 
\startlegend
Line 19: Line 46:
 
\leg L \\ length \\ \\
 
\leg L \\ length \\ \\
 
\stoplegend
 
\stoplegend
 
Aligning is also possible:
 
 
\startformula\eqalign{
 
t_{L,early} & = t_{L,late} = t_{L,ray} \cr
 
& = 6\ \mu m \cr
 
}\stopformula
 
 
 
</texcode>
 
</texcode>
 
looks like:
 
  
 
<context>
 
<context>
 
\usemodule[newmat]
 
\usemodule[newmat]
 
+
Legends:
\startformula
 
q = \delta \frac{\partial p}{\partial x} =
 
\delta(\phi) p_{vsat}(\theta) \frac{\partial \phi}{\partial x} =
 
\left[ \frac{\delta_a}{\mu(\theta)} p_{vsat}(\theta) \right] \frac{\partial \phi}{\partial x} =
 
k \frac{\partial \phi}{\partial x}
 
\stopformula
 
  
 
\startlegend
 
\startlegend
Line 47: Line 58:
 
\leg L \\ length \\ \\
 
\leg L \\ length \\ \\
 
\stoplegend
 
\stoplegend
 +
</context>
 +
  
Aligning is also possible:
+
<texcode>
 +
Aligned display math:
  
 
\startformula\eqalign{
 
\startformula\eqalign{
t_{L,early} & = t_{L,late} = t_{L,ray} \cr
+
t_{L,\text{early}} & = t_{L,\text{late}} = t_{L,\text{ray}} \cr
 
& = 6\ \mu m \cr
 
& = 6\ \mu m \cr
 
}\stopformula
 
}\stopformula
 +
</texcode>
  
 +
<context>
 +
Aligned display math:
 +
 +
\usemodule[newmat]
 +
\startformula\eqalign{
 +
t_{L,\text{early}} & = t_{L,\text{late}} = t_{L,\text{ray}} \cr
 +
& = 6\ \mu m \cr
 +
}\stopformula
 
</context>
 
</context>
  
(The sample was sent to the mailing list on 2005-06-28 by Wolfgang Zillig.)
+
(These samples are adapted from an example sent to the mailing list on 2005-06-28 by Wolfgang Zillig.)

Revision as of 03:47, 4 July 2005

< Math | MathML | Math with amsl | Math with nath >

Here some short examples of how to use math with the newmat module, which "collects macros that TeX users kind of expect to be available when typesetting math," according to the documentation. These currently include the \frac family (\frac, \dfrac, \tfrac, \binom, etc.), the \QED symbol, the \boxed command, and the subarray, substack, and smallmatrix environments, along with a few others. At one time it also included the \text command, though that has now been moved to the core.

\usemodule[newmat]

Inline math: $x = \frac{y}{2z} + x_{\text{center}}$

Display math:

\startformula
q = \delta \frac{\partial p}{\partial x} = 
\delta(\phi) p_{vsat}(\theta) \frac{\partial \phi}{\partial x} = 
\left[ \frac{\delta_a}{\mu(\theta)} p_{vsat}(\theta) \right] \frac{\partial \phi}{\partial x} = 
k \frac{\partial \phi}{\partial x}
\stopformula

Legends:

\startlegend
\leg k \\ water vapor permeability \\ \\
\leg K \\ water vapor permeance \\ \\
\leg S \\ surface \\ \\
\leg L \\ length \\ \\
\stoplegend


Aligned display math:

\startformula\eqalign{
t_{L,\text{early}} & = t_{L,\text{late}} = t_{L,\text{ray}} \cr
& = 6\ \mu m \cr
}\stopformula

(These samples are adapted from an example sent to the mailing list on 2005-06-28 by Wolfgang Zillig.)