https://wiki.contextgarden.net/api.php?action=feedcontributions&user=Maarten-Jan&feedformat=atomWiki - User contributions [en]2024-03-28T19:50:49ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Layers&diff=7459Layers2007-03-09T15:01:13Z<p>Maarten-Jan: made some corrections and added to Layers and Graphics categories</p>
<hr />
<div>< [[Layout]] | [[Columns]] | [[Overlays]] | [[Logos]] ><br />
<br />
'''Layers''' are ConTeXt's mechanism for absolute positioning of elements and other advanced techniques like switching elements on and off.<br />
<br />
There's still no manual about them.<br />
<br />
=My first Layer=<br />
<br />
Define a layer that takes the whole page<br />
<texcode><br />
\definelayer [mybg] % name of the layer<br />
[x=0mm, y=0mm, % from upper left corner of paper<br />
width=\paperwidth, height=\paperheight] % let the layer cover the full paper<br />
</texcode><br />
<br />
Now you can put something in that layer:<br />
<texcode><br />
\setlayer [mybg] % name of the layer<br />
[hoffset=1cm, voffset=1cm] % placement (from upper left corner of the layer)<br />
{\framed[frame=on, width=3cm, height=2cm]{LAYER}} % the actual contents of the layer<br />
</texcode><br />
<br />
Activate the layer as a background:<br />
<texcode><br />
\setupbackgrounds[page][background=mybg]<br />
</texcode><br />
This command makes the layer appear only once after the background is activated. If you want to repeat the layer on each page, use the option <code>repeat=yes</code> in the <cmd>definelayer</cmd> command.<br />
<br />
==Placement==<br />
<br />
There are several possibilities for defining the placement of layer content:<br />
* x, y : offset from upper left corner of paper<br />
* hoffset, voffset : offset from upper left corner of layer<br />
* corner : reference point, something like <code>{left, top}</code><br />
* location : alignment of the element relative to the corner, something like <code>{right, bottom}</code><br />
* preset : a named location, see below<br />
<br />
There are some "presets" for paper egde placement:<br />
<texcode><br />
% These four are defined by ConTeXt!<br />
\definelayerpreset [lefttop] [corner={left,top}, location={right,bottom}]<br />
\definelayerpreset [righttop] [corner={right,top}, location={left,bottom}]<br />
\definelayerpreset [leftbottom] [corner={left,bottom}, location={right,top}]<br />
\definelayerpreset [rightbottom] [corner={right,bottom}, location={left,top}]<br />
</texcode><br />
Similarly you can define your own presets.<br />
<br />
=Links=<br />
<br />
* Some applications in the [[manual:details.pdf|Details]] manual<br />
* [[Sample documents]]: [[BusinessCard]] and [[Letter style]]<br />
* Source: [[source:page-lyr.tex|page-lyr]]<br />
* Example of [[alternating backgrounds and repeating layers]]<br />
<br />
{{todo|We need a lot of documentation and samples for this complicated subject.}}<br />
<br />
[[Category:Graphics]] [[Category:Layers]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Product_integral&diff=6955Product integral2006-12-20T09:37:04Z<p>Maarten-Jan: various small adjustments</p>
<hr />
<div>= About the product integral =<br />
The product integral is a mathematical operator which fills the gap in the following table:<br />
<center><br />
<context><br />
% force an invisible space to show top of table frame:<br />
$\ $<br />
\starttable[|c|c|]<br />
\HL<br />
\VL $\sum$ \VL $\int$ \VL \AR<br />
\HL<br />
\VL $\prod$ \VL ? \VL \AR<br />
\HL<br />
\stoptable<br />
</context><br />
</center><br />
<br />
and looks like<br />
<center>[[Image:Prodint.jpg]]</center><br />
<br />
This notation was suggested by Gill & Johansen (1990). Although the product integral is relatively unknown to most people, it performs an important role in the theory of survival analysis and Markov processes. In fact, for those people who are familiar with survival analysis, the Kaplan-Meier estimator of the survival function is the product integral of the Nelson-Aalen estimator of the cumulative intensity function. Product integration was introduced by the Italian mathematician [http://en.wikipedia.org/wiki/Vito_Volterra Vito Volterra] in relation to the Volterra integral equations.<br />
<br />
= Installation =<br />
# download the LaTeX package from Richard Gill's website: [http://www.math.uu.nl/people/gill/prodint.tar.gz http://www.math.uu.nl/people/gill/prodint.tar.gz]<br />
# unpack the archive in an appropriate location of your TeX installation and run <code>texhash</code> to update the filename database<br />
# make sure that pdftex, dvips and others can find the font mapfile prodint.map (e.g. by running <code>updmap --enable Map=prodint.map</code> if you have teTeX or TeXlive on Linux)<br />
# place the following code before the body of your document to add the symbol to the set of mathematical symbols:<br />
<texcode><br />
\definefontsynonym [MathGamma] [prodint]<br />
<br />
\definefamilysynonym [default] [xop] [mc]<br />
<br />
\startmathcollection [default]<br />
<br />
\definemathsymbol [prodi] [op] [xop] [80]<br />
\definemathsymbol [Prodi] [op] [xop] [82]<br />
\definemathsymbol [PRODI] [op] [xop] [84]<br />
<br />
\stopmathcollection<br />
<br />
\loadmapfile[prodint]<br />
<br />
<br />
\starttypescript [math] [modern,computer-modern,latin-modern,ams] [size]<br />
\definebodyfont <br />
[17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=prodint]<br />
\stoptypescript<br />
<br />
\definetypeface [modern] [mm] [math] [modern]<br />
[computer-modern][encoding=default]<br />
<br />
\setupbodyfont[reset,modern,serif,10pt]<br />
<br />
\enablemathcollection[prodint]<br />
<br />
\starttext<br />
<br />
Your text here<br />
<br />
\stoptext<br />
</texcode><br />
<br />
= Example =<br />
<br />
The following is the example which comes with the prodint package:<br />
<br />
<context><br />
\definefontsynonym [MathGamma] [prodint]<br />
<br />
\definefamilysynonym [default] [xop] [mc]<br />
<br />
\startmathcollection [default]<br />
<br />
\definemathsymbol [prodi] [op] [xop] [80]<br />
\definemathsymbol [Prodi] [op] [xop] [82]<br />
\definemathsymbol [PRODI] [op] [xop] [84]<br />
<br />
\stopmathcollection<br />
<br />
\loadmapfile[prodint]<br />
<br />
<br />
\starttypescript [math] [modern,computer-modern,latin-modern,ams] [size]<br />
\definebodyfont <br />
[17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=prodint]<br />
\stoptypescript<br />
<br />
\definetypeface [modern] [mm] [math] [modern]<br />
[computer-modern][encoding=default]<br />
<br />
\setupbodyfont[reset,modern,serif,10pt]<br />
<br />
\enablemathcollection[prodint]<br />
<br />
\starttext<br />
This is \type{\prodi} in action: $\prod_i\prodi\alpha_i(du)$. How does it look?<br />
\blank[big]<br />
<br />
Now two equations to test \type{\Prodi}<br />
\startformula <br />
\prod_{i=1}^n\Prodi_0^\tau \left(1-dA_i(u)\right) <br />
\stopformula<br />
<br />
\startformula<br />
\int_0^\infty \prod_{i=1}^n\Prodi_0^t\left(1-\lambda_i(u,z)\,du\right)\; dF(z)<br />
\stopformula<br />
<br />
\blank[big]<br />
and one with \type{\PRODI}<br />
\startformula <br />
\PRODI_0^t \left\{\int_0^u g(z)\,dF(z)\right\}^2 du<br />
\stopformula<br />
<br />
\stoptext<br />
</context><br />
= Notes =<br />
Please consider the following notes:<br />
* the installation instructions above are valid when using the Computer Modern font. If you use any other font as bodyfont, the setup should be changed accordingly.<br />
* this setup defines three commands: <code>\prodi</code> for inline formulae, <code>\Prodi</code> and <code>\PRODI</code> for displaystyle formulae (where the latter is slightly larger); see the example above for demonstration of the usage of these three commands.<br />
<br />
= References and resources =<br />
* Gill, R.D. & Johansen, S. (1990) A survey of product-integration with a view toward application in survival analysis, ''The Annals of Statistics'', Vol. 18, pp.1501-1555.<br />
* Richard Gill's [http://www.math.uu.nl/people/gill website] contains links to various articles on product integration<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Product_integral&diff=6913Product integral2006-12-08T11:10:39Z<p>Maarten-Jan: added note about unresolved font style issue</p>
<hr />
<div>= About the product integral =<br />
The product integral is a mathematical operator which fills the gap in the following table:<br />
<center><br />
<context><br />
\starttable[|c|c|]<br />
\HL<br />
\VL $\sum$ \VL $\int$ \VL \AR<br />
\HL<br />
\VL $\prod$ \VL ? \VL \AR<br />
\HL<br />
\stoptable<br />
</context><br />
</center><br />
<br />
and looks like<br />
<center>[[Image:Prodint.jpg]]</center><br />
<br />
This notation was suggested by Gill & Johansen (1990). Although the product integral is relatively unknown to most people, it performs an important role in the theory of survival analysis and Markov processes. In fact, for those people who are familiar with survival analysis, the Kaplan-Meier estimator of the survival function is the product integral of the Nelson-Aalen estimator of the cumulative intensity function. Product integration was introduced by the Italian mathematician [http://en.wikipedia.org/wiki/Vito_Volterra Vito Volterra] in relation to the Volterra integral equations.<br />
<br />
= Installation =<br />
# download the LaTeX package from Richard Gill's website: [http://www.math.uu.nl/people/gill/prodint.tar.gz http://www.math.uu.nl/people/gill/prodint.tar.gz]<br />
# unpack the archive in an appropriate location of your TeX installation and run <code>texhash</code> to update the filename database<br />
# make sure that pdftex, dvips and others can find the font mapfile prodint.map (e.g. by running <code>updmap --enable Map=prodint.map</code> if you have teTeX or TeXlive on Linux)<br />
# place the following code before the body of your document to add the symbol to the set of mathematical symbols:<br />
<texcode><br />
\definefontsynonym [MathGamma] [prodint]<br />
<br />
\definefamilysynonym [default] [xop] [mc]<br />
<br />
\startmathcollection [default]<br />
<br />
\definemathsymbol [prodi] [op] [xop] [80]<br />
\definemathsymbol [Prodi] [op] [xop] [82]<br />
\definemathsymbol [PRODI] [op] [xop] [84]<br />
<br />
\stopmathcollection<br />
<br />
\loadmapfile[prodint]<br />
<br />
<br />
\starttypescript [math] [modern,computer-modern,latin-modern,ams] [size]<br />
\definebodyfont <br />
[17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=prodint]<br />
\stoptypescript<br />
<br />
\definetypeface [modern] [mm] [math] [modern]<br />
[computer-modern][encoding=default]<br />
<br />
\setupbodyfont[reset,modern,10pt]<br />
<br />
\enablemathcollection[prodint]<br />
<br />
\starttext<br />
$\prodi$, $\Prodi$ and $\PRODI$<br />
\stoptext<br />
</texcode><br />
<br />
= Notes =<br />
Please consider the following notes:<br />
* the product integral symbol only exists in Computer Modern, therefore the code above is only valid when using this font<br />
* this setup defines three commands: <code>\prodi</code> for inline formulae, <code>\Prodi</code> and <code>\PRODI</code> for displaystyle formulae (where the latter is slightly larger); see the sample file prodint.pdf in the archive for example usage<br />
* '''IMPORTANT: the current settings disable font styles like boldface, italic, slanted, etc. This is an unresolved issue!!!'''<br />
<br />
= References and resources =<br />
* Gill, R.D. & Johansen, S. (1990) A survey of product-integration with a view toward application in survival analysis, ''The Annals of Statistics'', Vol. 18, pp.1501-1555.<br />
* Richard Gill's [http://www.math.uu.nl/people/gill website] contains links to various articles on product integration<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Math&diff=6859Math2006-11-29T09:25:41Z<p>Maarten-Jan: /* Numbering Formulae */ Added (basic) referencing to formulae</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
For typesetting of mathematics follows different rules than that of normal text, TeX uses something called "math mode" where some characters get a different meaning to enable a simple syntax for complicated formulas.<br />
<br />
==Simple Math==<br />
<br />
Typesetting mathematics can be divided into two parts, '''inline''' math (mathematical formulas set within ordinary paragraphs as part of the text) and '''display''' math mathematics set on lines by themselves, often with equation numbers). Inline math consists of maths that is typed in a sentence. For example<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</context><br />
<br />
There are two ways of typing inline math. The TeX way is to surround what you want to type within <code>$</code>...<code>$</code>. Thus, the above will be typed as<br />
<texcode><br />
Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results<br />
</texcode><br />
<br />
ConTeXt also provides an alternative way of typing the same result. Instead of dollars, you can write the material for maths inside <cmd>mathematics</cmd> or <cmd>math</cmd> (which is shorter). Thus, an alternate way to type the above is,<br />
<texcode><br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</texcode><br />
<br />
Choose the method that suits your style.<br />
<br />
Display math is enclosed in a <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Numbering Formulae ==<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put <cmd>placeformula</cmd> before <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The <cmd>placeformula</cmd> command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
=== Changing format of numbers ===<br />
You can use <cmd>setupformulas</cmd> to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
=== Referencing formulae ===<br />
Equations can be referred to by simply adding a label to <cmd>placeformula</cmd> and using <cmd>ref</cmd> to create the reference:<br />
<br />
<table width="100%" cols="2" cellpadding="5"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (and again) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
And now we can refer to formula \ref[formulalabel].<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula[formulalabel]<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
% number is added manually because otherwise only '??' appears:<br />
And now we can refer to formula 1.<br />
</context><br />
</td></tr></table><br />
<br />
By default, only the formula number appears as a reference. This can be changed by using <cmd>definereferenceformat</cmd>. For example, to create a command <code>\eqref</code> which shows the formula number in brackets, use<br />
<texcode><br />
\definereferenceformat[eqref][left=(,right=)]<br />
</texcode><br />
See [[References]] for more examples of <cmd>definereferenceformat</cmd>.<br />
<br />
== Not so Simple Maths ==<br />
<br />
ConTeXt's base mathematics support is built on the mathematics support in plain TeX, thus allowing quite complicated formulas. (There are also some additional macros, such as the <cmd>text</cmd> command for text-mode notes within math.) For instance:<br />
<texcode><br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<br />
which produces<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
Context provides a wrapper around tex <cmd>pmatrix</cmd>. The above can be typeset in a contextish way as<br />
<texcode><br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
[http://www.pragma-ade.com/texmath.html Here] you can try it "live" (you must go to [http://www.pragma-ade.com/exalogin login] first).<br />
<br />
[[Equation alignment]] is covered on a separate page.<br />
<br />
==Sub-Formula Numbering==<br />
<br />
As mentioned above, formulas can be numbered using the <cmd>placeformula</cmd> command. This (and the related <cmd>placesubformula</cmd> command have an optional argument which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both <cmd>placeformula</cmd> and <cmd>placesubformula</cmd> produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and <cmd>placeformula</cmd> defines <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's <cmd>eqno</cmd>. Note that the optional tag is inherited from <cmd>placeformula</cmd>.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the <cmd>let</cmd> command to empty <cmd>doplaceformulanumber</cmd>, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines <cmd>displaylines</cmd> and <cmd>eqalignno</cmd> to do this automatically.<br />
<br />
For more control over sub-formula numbering, <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> have an optional argument parallel to that of <cmd>placeformula</cmd>, as demonstrated in this use of plain TeX's <cmd>eqalignno</cmd>, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both <cmd>placefigure</cmd> and <cmd>formulanumber</cmd>, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
If you want named subformula with a reference see the solution proposed by Aditya Mahajan on the mailing-list [http://archive.contextgarden.net/message/20061029.063821.ba521b6c.en.html] (2006-10-29). This feature should be added to the core eventually.<br />
<br />
==List of Formulas==<br />
<br />
You can have a list of the formulas contained in a document by using <cmd>placenamedformula</cmd> instead of <cmd>placeformula</cmd>. Only the formulas written with <cmd>placenamedformula</cmd> are not put in the list, so that you can control precisely the content of the list.<br />
<br />
<cmd>placenamedformula</cmd> takes as first parameter the name of the formula put in the list. The other <cmd>placeformula</cmd> features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, and a own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Math [[Fonts]]==<br />
* [[Bold Math]]<br />
* [http://homepage.mac.com/atl/tex/EulerContext.pdf Euler in ConTeXt (using Euler math font)] by Adam Lindsay<br />
* [[rsfs]] Using Ralph Smith's Formal Script<br />
* [[Product integral]] symbol<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Math&diff=6858Math2006-11-29T08:50:34Z<p>Maarten-Jan: /* Not so Simple Maths */ changed link to "Equation alignment"</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
For typesetting of mathematics follows different rules than that of normal text, TeX uses something called "math mode" where some characters get a different meaning to enable a simple syntax for complicated formulas.<br />
<br />
==Simple Math==<br />
<br />
Typesetting mathematics can be divided into two parts, '''inline''' math (mathematical formulas set within ordinary paragraphs as part of the text) and '''display''' math mathematics set on lines by themselves, often with equation numbers). Inline math consists of maths that is typed in a sentence. For example<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</context><br />
<br />
There are two ways of typing inline math. The TeX way is to surround what you want to type within <code>$</code>...<code>$</code>. Thus, the above will be typed as<br />
<texcode><br />
Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results<br />
</texcode><br />
<br />
ConTeXt also provides an alternative way of typing the same result. Instead of dollars, you can write the material for maths inside <cmd>mathematics</cmd> or <cmd>math</cmd> (which is shorter). Thus, an alternate way to type the above is,<br />
<texcode><br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</texcode><br />
<br />
Choose the method that suits your style.<br />
<br />
Display math is enclosed in a <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Numbering Formulae ==<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put <cmd>placeformula</cmd> before <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The <cmd>placeformula</cmd> command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
=== Changing format of numbers ===<br />
You can use <cmd>setupformulas</cmd> to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Not so Simple Maths ==<br />
<br />
ConTeXt's base mathematics support is built on the mathematics support in plain TeX, thus allowing quite complicated formulas. (There are also some additional macros, such as the <cmd>text</cmd> command for text-mode notes within math.) For instance:<br />
<texcode><br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<br />
which produces<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
Context provides a wrapper around tex <cmd>pmatrix</cmd>. The above can be typeset in a contextish way as<br />
<texcode><br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
[http://www.pragma-ade.com/texmath.html Here] you can try it "live" (you must go to [http://www.pragma-ade.com/exalogin login] first).<br />
<br />
[[Equation alignment]] is covered on a separate page.<br />
<br />
==Sub-Formula Numbering==<br />
<br />
As mentioned above, formulas can be numbered using the <cmd>placeformula</cmd> command. This (and the related <cmd>placesubformula</cmd> command have an optional argument which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both <cmd>placeformula</cmd> and <cmd>placesubformula</cmd> produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and <cmd>placeformula</cmd> defines <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's <cmd>eqno</cmd>. Note that the optional tag is inherited from <cmd>placeformula</cmd>.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the <cmd>let</cmd> command to empty <cmd>doplaceformulanumber</cmd>, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines <cmd>displaylines</cmd> and <cmd>eqalignno</cmd> to do this automatically.<br />
<br />
For more control over sub-formula numbering, <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> have an optional argument parallel to that of <cmd>placeformula</cmd>, as demonstrated in this use of plain TeX's <cmd>eqalignno</cmd>, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both <cmd>placefigure</cmd> and <cmd>formulanumber</cmd>, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
If you want named subformula with a reference see the solution proposed by Aditya Mahajan on the mailing-list [http://archive.contextgarden.net/message/20061029.063821.ba521b6c.en.html] (2006-10-29). This feature should be added to the core eventually.<br />
<br />
==List of Formulas==<br />
<br />
You can have a list of the formulas contained in a document by using <cmd>placenamedformula</cmd> instead of <cmd>placeformula</cmd>. Only the formulas written with <cmd>placenamedformula</cmd> are not put in the list, so that you can control precisely the content of the list.<br />
<br />
<cmd>placenamedformula</cmd> takes as first parameter the name of the formula put in the list. The other <cmd>placeformula</cmd> features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, and a own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Math [[Fonts]]==<br />
* [[Bold Math]]<br />
* [http://homepage.mac.com/atl/tex/EulerContext.pdf Euler in ConTeXt (using Euler math font)] by Adam Lindsay<br />
* [[rsfs]] Using Ralph Smith's Formal Script<br />
* [[Product integral]] symbol<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Equation_alignment&diff=6854Equation alignment2006-11-29T08:48:54Z<p>Maarten-Jan: MathAlignment moved to Equation alignment: better distinction from "Math structures", which has been moved to "Multiline equations"</p>
<hr />
<div>< [[Math]]<br />
<br />
Be sure to also read the recent (2006-08-02) [http://dl.contextgarden.net/myway/mathalign.pdf Using \startalign and friends] written by Aditya Mahajan.<br />
<br />
This set of math examples is taken from the comments in the [[source:core-mat.tex|core-mat.tex]] file, which contains most of the core ConTeXt math macros. The <tt>textwidth</tt> has been set to 8 cm in these examples so that the page isn't too wide (see [[Layout]] and <cmd>setuplayout</cmd> for further information specific to layout).<br />
<br />
----<br />
<br />
Normally a formula is centered, but in case you want to align it left or right, you can set up formulas to behave<br />
that way. Normally a formula will adapt its left indentation to the environment:<br />
<br />
<context><br />
\setuplayout[textwidth=8cm]<br />
This is a bit of text for purpose of example.\epar<br />
\startitemize<br />
\item This is some other example text.\epar<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\item This is yet other example text.\epar<br />
\stopitemize<br />
This is a bit more text for other purpose of example.\epar<br />
</context><br />
<br />
In the next examples we explicitly align formulas to the left (<cmd>raggedleft</cmd>), center and right (<cmd>raggedright</cmd>):<br />
<br />
<context source="yes" text="Or in print:"><br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
With formula numbers the code is:<br />
<br />
<context source="yes" text="And the formulas look like:"><br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
When tracing is turned on (<cmd>tracemathtrue</cmd>) you can visualize the bounding box of the formula,<br />
<br />
<context><br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=middle]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
\setupformulas[align=right]<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:<br />
<br />
<context source="yes" text="This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.]"><br />
\setuplayout[textwidth=8cm]<br />
\setupformulas[align=middle,strut=yes]<br />
\tracemathtrue<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space<br />
<br />
<context source="yes"><br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=middle]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.<br />
<br />
<context source="yes"><br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,leftmargin=3em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
<br />
\setupformulas[align=left,rightmargin=1em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
You can also inherit the margin from the environment.<br />
<br />
<context source="yes"><br />
\setuplayout[textwidth=8cm]<br />
Some example text, again, to show where the right and left margins of the text block are.<br />
\tracemathtrue<br />
\setupformulas[align=right,margin=standard]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
The distance between the formula and the number is only applied when the formula is left or right aligned.<br />
<br />
<context source="yes"><br />
\setuplayout[textwidth=8cm]<br />
\tracemathtrue<br />
\setupformulas[align=left,distance=2em]<br />
\startformula c^2 = a^2 + b^2 \stopformula<br />
\placeformula \startformula c^2 = a^2 + b^2 \stopformula<br />
</context><br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Talk:Equation_alignment&diff=6856Talk:Equation alignment2006-11-29T08:48:54Z<p>Maarten-Jan: Talk:MathAlignment moved to Talk:Equation alignment: better distinction from "Math structures", which has been moved to "Multiline equations"</p>
<hr />
<div>For some reason, <tt>\setupformulas[strut=yes]</tt> seems to prevent <tt>\tracemathtrue</tt> from working. Can anybody else figure out what's up with that? --[[User:Brooks|Brooks]] 07:28, 10 Jul 2005 (CEST)<br />
<br />
Update: it's due to the fact that <tt>\tracemathtrue</tt> doesn't work unless an alignment is specified. Reported as a bug to the mailing list. --[[User:Brooks|Brooks]] 08:27, 10 Jul 2005 (CEST)<br />
<br />
I would like to propose to move or rename the "MathAlignment" page to "Equation alignment". I think this captures exactly what this page is about and avoids the confusion with "Math structures". Also, the CamelCase (or BumpyWord, WikiWord, etc.) title is not customary for a Wikimedia wiki. Any objections? --[[User:Maarten-Jan|Maarten-Jan]] 14:43, 19 November 2006 (CET)<br />
<br />
:I see no problem with the change. However, the confusion with "Math strucures" will remain. --[[User:Adityam|Aditya]]<br />
<br />
:You are right. Maybe "Math structures" should also be renamed... how about "Multiline equations" which is the terminology mostly used with LaTeX? --[[User:Maarten-Jan|Maarten-Jan]] 20:51, 22 November 2006 (CET)<br />
<br />
::Ok, go ahead and make the change --[[User:Adityam|Aditya]] 05:52, 28 November 2006 (CET)</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Talk:MathAlignment&diff=6857Talk:MathAlignment2006-11-29T08:48:54Z<p>Maarten-Jan: Talk:MathAlignment moved to Talk:Equation alignment: better distinction from "Math structures", which has been moved to "Multiline equations"</p>
<hr />
<div>#REDIRECT [[Talk:Equation alignment]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Math&diff=6853Math2006-11-29T08:46:31Z<p>Maarten-Jan: /* Other Methods */ changed link to "Math structures"</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
For typesetting of mathematics follows different rules than that of normal text, TeX uses something called "math mode" where some characters get a different meaning to enable a simple syntax for complicated formulas.<br />
<br />
==Simple Math==<br />
<br />
Typesetting mathematics can be divided into two parts, '''inline''' math (mathematical formulas set within ordinary paragraphs as part of the text) and '''display''' math mathematics set on lines by themselves, often with equation numbers). Inline math consists of maths that is typed in a sentence. For example<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</context><br />
<br />
There are two ways of typing inline math. The TeX way is to surround what you want to type within <code>$</code>...<code>$</code>. Thus, the above will be typed as<br />
<texcode><br />
Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results<br />
</texcode><br />
<br />
ConTeXt also provides an alternative way of typing the same result. Instead of dollars, you can write the material for maths inside <cmd>mathematics</cmd> or <cmd>math</cmd> (which is shorter). Thus, an alternate way to type the above is,<br />
<texcode><br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</texcode><br />
<br />
Choose the method that suits your style.<br />
<br />
Display math is enclosed in a <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Numbering Formulae ==<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put <cmd>placeformula</cmd> before <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The <cmd>placeformula</cmd> command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
=== Changing format of numbers ===<br />
You can use <cmd>setupformulas</cmd> to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Not so Simple Maths ==<br />
<br />
ConTeXt's base mathematics support is built on the mathematics support in plain TeX, thus allowing quite complicated formulas. (There are also some additional macros, such as the <cmd>text</cmd> command for text-mode notes within math.) For instance:<br />
<texcode><br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<br />
which produces<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
Context provides a wrapper around tex <cmd>pmatrix</cmd>. The above can be typeset in a contextish way as<br />
<texcode><br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
[http://www.pragma-ade.com/texmath.html Here] you can try it "live" (you must go to [http://www.pragma-ade.com/exalogin login] first).<br />
<br />
[[MathAlignment]] is covered on a separate page.<br />
<br />
==Sub-Formula Numbering==<br />
<br />
As mentioned above, formulas can be numbered using the <cmd>placeformula</cmd> command. This (and the related <cmd>placesubformula</cmd> command have an optional argument which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both <cmd>placeformula</cmd> and <cmd>placesubformula</cmd> produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and <cmd>placeformula</cmd> defines <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's <cmd>eqno</cmd>. Note that the optional tag is inherited from <cmd>placeformula</cmd>.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the <cmd>let</cmd> command to empty <cmd>doplaceformulanumber</cmd>, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines <cmd>displaylines</cmd> and <cmd>eqalignno</cmd> to do this automatically.<br />
<br />
For more control over sub-formula numbering, <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> have an optional argument parallel to that of <cmd>placeformula</cmd>, as demonstrated in this use of plain TeX's <cmd>eqalignno</cmd>, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both <cmd>placefigure</cmd> and <cmd>formulanumber</cmd>, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
If you want named subformula with a reference see the solution proposed by Aditya Mahajan on the mailing-list [http://archive.contextgarden.net/message/20061029.063821.ba521b6c.en.html] (2006-10-29). This feature should be added to the core eventually.<br />
<br />
==List of Formulas==<br />
<br />
You can have a list of the formulas contained in a document by using <cmd>placenamedformula</cmd> instead of <cmd>placeformula</cmd>. Only the formulas written with <cmd>placenamedformula</cmd> are not put in the list, so that you can control precisely the content of the list.<br />
<br />
<cmd>placenamedformula</cmd> takes as first parameter the name of the formula put in the list. The other <cmd>placeformula</cmd> features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, and a own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Math [[Fonts]]==<br />
* [[Bold Math]]<br />
* [http://homepage.mac.com/atl/tex/EulerContext.pdf Euler in ConTeXt (using Euler math font)] by Adam Lindsay<br />
* [[rsfs]] Using Ralph Smith's Formal Script<br />
* [[Product integral]] symbol<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Rsfs&diff=6852Rsfs2006-11-29T08:43:57Z<p>Maarten-Jan: changed linked to "Math structures</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Multiline equations]]><br />
<br />
== Using Ralph Smith Formal Font ==<br />
<br />
Ralph Smith's Formal Font [http://www.ctan.org/tex-archive/fonts/rsfs/] provides a bit more cursive caligarphic symbols. They can be used inside ConTeX by <br />
<br />
<context source="yes"><br />
\def\mathrsfs#1{\text{\definedfont[RalfSmithFormalScript]#1\/}}<br />
\mathrsfs{ABCDEFGHIJKLMNOPQRSTUVWXYZ} <br />
</context><br />
<br />
'''Note:''' Since this is an italic script, one needs italic correction <code>\/</code> in the definition.<br />
<br />
<br />
Another method to use the font is<br />
<texcode><br />
\font\tenscr=rsfs10 at 12pt %bodyfontsize<br />
\font\sevenscr=rsfs7 at 9pt %scriptfontsize<br />
\font\fivescr=rsfs5 at 7pt %scriptscriptfontsize<br />
\skewchar\tenscr='177 \skewchar\sevenscr='177 \skewchar\fivescr='177<br />
\newfam\scrfam \textfont\scrfam=\tenscr \scriptfont\scrfam=\sevenscr<br />
\scriptscriptfont\scrfam=\fivescr<br />
\def\scr{\fam\scrfam}<br />
</texcode><br />
<br />
With these defintions one can use <cmd>scr</cmd> just like <cmd>cal</cmd>. This method has the advantage that it uses different fonts (rsfs10, rsfs7, rsfs5) in body script and scriptscipt.<br />
<br />
<br />
<br />
[[Category:Math]]<br />
[[Category:Fonts]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Multiline_equations&diff=6848Multiline equations2006-11-29T08:43:07Z<p>Maarten-Jan: Math structures moved to Multiline equations: old title was confusing</p>
<hr />
<div>< [[Main Page]] | [[Math]] | [[Math with newmat]] | [[MathML]] ><br />
<br />
== Basic Alignment ==<br />
<br />
<br />
Two modes of input <br />
<br />
* Latex style<br />
<texcode><br />
\startformula \startalign<br />
v &= u + at \\<br />
h &= ut + \frac12 gt^2 \\<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
Note the \\ in the last line, above.<br />
<br />
This appears as follows:<br />
<br />
<context><br />
\startformula \startalign<br />
v &= u + at \\<br />
h &= ut + \frac12 gt^2 \\<br />
\stopalign \stopformula<br />
</context><br />
<br />
* Context Style<br />
<br />
<texcode><br />
\startformula \startalign<br />
\NC v \NC = u + at \NR<br />
\NC h \NC= ut + \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<context><br />
\startformula \startalign<br />
\NC v \NC = u + at \NR<br />
\NC h \NC = ut + \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
(The examples here will focus on the context style, having two styles can be confusing --[[User:Adityam| Aditya ]] )<br />
<br />
== Changing the number of columns ==<br />
<br />
The above equations were aligned at <code>=</code>. Suppose you also want the <code>+</code> to align. Well, this is simple in context, simply specify the number of columns with <code>\startalign</code><br />
<br />
<br />
<texcode><br />
\startformula \startalign[n=3]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<context><br />
\startformula \startalign[n=3]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
== Alignment of each column ==<br />
If you want more control over the formatting, and want the middle column to be center aligned, you can do that by <br />
<texcode><br />
\startformula \startalign[n=3,align={right,middle,left}]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<context><br />
\startformula \startalign[n=3,align={right,middle,left}]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
This mechanism allows fancier alignments like<br />
<br />
<texcode><br />
\startformula \startalign[n=4,align={left,right,middle,left}]<br />
\NC \text{We have} \quad \NC v \NC = u \NC+ at \NR<br />
\NC \text{and} \NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<br />
<context><br />
\startformula \startalign[n=4,align={left,right,middle,left}]<br />
\NC \text{We have} \quad \NC v \NC = u \NC+ at \NR<br />
\NC \text{and} \NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
== Working with equation numbering ==<br />
<br />
aligned equations can be numbered by placing a tag after <cmd>NR</cmd><br />
<br />
<texcode><br />
\placeformula \startformula \startalign<br />
\NC v \NC = u + at \NR[eq:v]<br />
\NC h \NC = ut + \frac12 gt^2 \NR[eq:h]<br />
\stopalign \stopformula<br />
Equation (\in[eq:v]) tells the final velocity after <br />
time $t$ and equation (\in[eq:h]) tells the distance <br />
travelled in time $t$.<br />
</texcode><br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
\placeformula \startformula \startalign<br />
\NC v \NC = u + at \NR[eq:v]<br />
\NC h \NC = ut + \frac12 gt^2 \NR[eq:h]<br />
\stopalign \stopformula <br />
Equation (\in[eq:v]) tells the final velocity after time $t$ and equation (\in[eq:h]) tells the distance travelled in time $t$.<br />
</context><br />
<br />
== Changing the number of columns ==<br />
<br />
== Defining new alignment structures ==<br />
<br />
New alignment can be defined using <cmd>definemathalignment</cmd>. For example, to emulate <code>gather</code> environment of amsmath, we can use<br />
<texcode><br />
\definemathalignment<br />
[gather]<br />
[n=1,align={middle}]<br />
<br />
\startformula \startgather<br />
\NC ax^2 + bx + c = 0 \NR<br />
\NC \text{roots} = \frac{ -b \pm \sqrt{b^2 - 4ac}}{2a} \NR<br />
\stopgather \stopformula<br />
</texcode><br />
<br />
<context><br />
\definemathalignment<br />
[gather]<br />
[n=1,align={middle}]<br />
<br />
\startformula \startgather<br />
\NC ax^2 + bx + c = 0 \NR<br />
\NC \text{roots} = \frac{ -b \pm \sqrt{b^2 - 4ac}}{2a} \NR<br />
\stopgather \stopformula<br />
<br />
</context><br />
<br />
<br />
== Cases ==<br />
<br />
Context provides a <cmd>startmathcases</cmd> <cmd>stopmathcases</cmd> pair to make it easy get cases. <br />
<texcode><br />
\startformula<br />
f(x) = \startmathcases<br />
\NC x, \NC if $0 \le x \le \frac12$ \NR<br />
\NC 1-x ,\NC if $\frac12 \le x \le 1$ \NR<br />
\stopmathcases<br />
\stopformula<br />
</texcode><br />
<br />
gives<br />
<br />
<context><br />
\startformula<br />
f(x) = \startmathcases<br />
\NC x, \NC if $0 \le x \le \frac12$ \NR<br />
\NC 1-x ,\NC if $\frac12 \le x \le 1$ \NR<br />
\stopmathcases<br />
\stopformula<br />
</context><br />
<br />
The cases environment consists of two columns, separated by <cmd>NC</cmd>. The second column is by default in text mode. An alternative way of getting the same result is to define the second column as a mathcolumn with <cmd>MC</cmd> like so:<br />
<br />
<texcode><br />
\startformula<br />
f(x) = \startmathcases<br />
\NC x, \MC \text{if } 0 \le x \le \frac12 \NR<br />
\NC 1-x ,\MC \text{if } \frac12 \le x \le 1 \NR<br />
\stopmathcases<br />
\stopformula<br />
</texcode><br />
<br />
Each line must end with a <cmd>NR</cmd>.<br />
<br />
== Numbered Cases ==<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Talk:Multiline_equations&diff=6850Talk:Multiline equations2006-11-29T08:43:07Z<p>Maarten-Jan: Talk:Math structures moved to Talk:Multiline equations: old title was confusing</p>
<hr />
<div>For some reasons the equations here to not compile. May start working after the garden version of context is updated.<br />
<br />
:Just wait a day or two, I'm sure Patrick will update soon. IIRC, you can check the<br />
version by clicking the 'live ConTeXt' link. [[User:Taco|Taco]]<br />
<br />
I am not sure on what should be a good title for this page. Mathalign does not seem right, but math alignment is already taken.<br />
<br />
:Math structures perhaps? [[User:Taco|Taco]]<br />
<br />
Math structures is fine. Is there someway that I can change the name of an existing page [[User:Adityam|Aditya]]<br />
<br />
:I have a special button for that :) [[User:Taco|Taco]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Talk:Math_structures&diff=6851Talk:Math structures2006-11-29T08:43:07Z<p>Maarten-Jan: Talk:Math structures moved to Talk:Multiline equations: old title was confusing</p>
<hr />
<div>#REDIRECT [[Talk:Multiline equations]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=User:Maarten-Jan&diff=6828User:Maarten-Jan2006-11-23T09:32:29Z<p>Maarten-Jan: added some testing for CM Bright font</p>
<hr />
<div>== CMbright test ==<br />
<br />
The following is a test for enabling the Computer Modern Bright font in ConTeXt.<br />
<br />
----<br />
<br />
<context><br />
<br />
\starttypescript [sans] [cmbr] [texnansi]<br />
\definefontsynonym [Cmbr] [cmbr10]<br />
\definefontsynonym [Cmbr-Bold] [cmbrbx10]<br />
\definefontsynonym [Cmbr-Slanted] [cmbrsl10]<br />
\stoptypescript<br />
<br />
\starttypescript [sans] [cmbr] [name]<br />
\definefontsynonym [Sans] [Cmbr]<br />
\definefontsynonym [SansBold] [Cmbr-Bold]<br />
\definefontsynonym [SansItalic] [Cmbr-Slanted] % no italic as far as I can see<br />
\definefontsynonym [SansSlanted] [Cmbr-Slanted]<br />
\stoptypescript<br />
<br />
\starttypescript [serif] [cmbr] [name] % serif is the same as sans<br />
\definefontsynonym [Serif] [Cmbr]<br />
\definefontsynonym [SerifBold] [Cmbr-Bold]<br />
\definefontsynonym [SerifItalic] [Cmbr-Slanted] % no italic as far as I can see<br />
\definefontsynonym [SerifSlanted] [Cmbr-Slanted]<br />
\stoptypescript<br />
<br />
\starttypescript [mono] [cmbr] [texnansi]<br />
\definefontsynonym [Cmbr-Mono] [cmtl10]<br />
\definefontsynonym [Cmbr-MonoSlanted] [cmsltl10]<br />
\stoptypescript<br />
<br />
\starttypescript [mono] [cmbr] [name]<br />
\definefontsynonym [Mono] [Cmbr-Mono]<br />
\definefontsynonym [MonoSlanted] [Cmbr-MonoSlanted]<br />
\stoptypescript<br />
<br />
\starttypescript [math] [cmbr] [default]<br />
\definefontsynonym [Cmbr-Math-Letters] [cmbrmi10]<br />
\definefontsynonym [Cmbr-Math-Symbols] [cmbrsy10]<br />
\definefontsynonym [Cmbr-Math-Alpha] [cmbras10]<br />
\definefontsynonym [Cmbr-Math-Beta] [cmbrbs10]<br />
\stoptypescript<br />
<br />
\starttypescript [math] [cmbr] [name]<br />
\definefontsynonym [MathRoman] [Cmbr]<br />
\definefontsynonym [MathItalic] [Cmbr-Math-Letters]<br />
\definefontsynonym [MathSymbol] [Cmbr-Math-Symbols]<br />
\definefontsynonym [MathAlpha] [Cmbr-Math-Alpha]<br />
\definefontsynonym [MathBeta] [Cmbr-Math-Beta]<br />
\stoptypescript<br />
<br />
\starttypescript [math] [cmbr] [name]<br />
\definefontsynonym [Calligraphic] [MathSymbol]<br />
\stoptypescript<br />
<br />
\starttypescript [boldmath,bfmath] [cmbr] [default]<br />
\definefontsynonym [Cmbr-Math-Letters-Bold] [cmbrbm10]<br />
\stoptypescript<br />
<br />
\starttypescript [Cmbr]<br />
\definetypeface [Cmbr] [ss] [sans] [cmbr] [default] [encoding=texnansi]<br />
\definetypeface [Cmbr] [tt] [mono] [cmbr] [default] [encoding=texnansi]<br />
\definetypeface [Cmbr] [mm] [math] [cmbr] [default] [encoding=default]<br />
\definetypeface [Cmbr] [rm] [serif] [cmbr] [default] [encoding=texnansi]<br />
<br />
% \usemathcollection[cmbr]<br />
\stoptypescript<br />
<br />
\starttext<br />
%\loadmapfile[hfbright.map] % required to embed Type1 fonts<br />
\usetypescript[Cmbr]<br />
<br />
\switchtobodyfont[Cmbr,10pt]<br />
This is Computer Modern Bright.<br />
\blank<br />
<br />
\showbodyfont<br />
<br />
\blank[big]<br />
<br />
{\bf Theorem 1 (Residue Theorem).}<br />
Let $f$ be analytic in the region $G$ except for the isolated singularities $a_1,a_2,\ldots,a_m$. If $\gamma$ is a closed rectifiable curve in $G$ which does not pass through any of the points $a_k$ and if $\gamma\approx 0$ in $G$ then<br />
\startformula<br />
\frac{1}{2\pi i}\int_\gamma f = \sum_{k=1}^m n(\gamma;a_k) \text{Res}(f;a_k).<br />
\stopformula<br />
<br />
{\bf Theorem 2 (Maximum Modulus).}<br />
{\em Let $G$ be a bounded open set in ${\mb C}$ and suppose that $f$ is a continuous function on $G^-$ which is analytic in $G$. Then}<br />
\startformula<br />
\max\{|f(z)|:z\in G^-\}=\max \{|f(z)|:z\in \partial G \}.<br />
\stopformula<br />
%\vspace*{-1em}<br />
<br />
\define\abc{abcdefghijklmnopqrstuvwxyz}<br />
\define\ABC{ABCDEFGHIJKLMNOPQRSTUVWXYZ}<br />
\define\alphabeta{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\varkappa\lambda\mu\nu\xi o\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega}<br />
\define\AlphaBeta{\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega}<br />
<br />
%\ABC \quad $\ABC$<br />
<br />
%\abc \quad $\abc$ \quad $01234567890$<br />
<br />
%$\AlphaBeta$ \quad $\alphabeta$ \quad $\ell\wp\aleph\infty\propto\emptyset\nabla\partial\mho\imath\jmath\hslash\eth$<br />
<br />
${\rm A} \Lambda \Delta \nabla {\rm B C D} \Sigma {\rm E F} \Gamma {\rm G H I J K L M N O} \Theta \Omega \mho {\rm P} \Phi \Pi \Xi {\rm Q R S T U V W X Y} \Upsilon \Psi {\rm Z} $ $ \quad 1234567890 $<br />
<br />
%$\mathit{A \Lambda \Delta B C D E F \Gamma G H I J K L M N O \Theta \Omega P \Phi \Pi \Xi Q R S T U V W X Y \Upsilon \Psi Z }$<br />
<br />
% don't allow overfull boxes<br />
$a\alpha b \beta c \partial d \delta e \epsilon \varepsilon f \zeta \xi g \gamma h \hbar \hslash \iota i \imath j \jmath k \kappa \varkappa l \ell \lambda m n \eta \theta \vartheta o \sigma \varsigma \phi \varphi \wp p \rho \varrho q r s t \tau \pi u \mu \nu v \upsilon w \omega \varpi x \chi y \psi z$ $\infty \propto \emptyset \varnothing {\rm d}\eth \backepsilon$<br />
<br />
%${\cal \ABC} \quad {\mb \ABC}$<br />
<br />
%\boldmath $\alpha + b = 27$<br />
<br />
<br />
\stoptext<br />
<br />
</context><br />
<br />
----<br />
<br />
The example is taken from the [http://www.tug.org/tex-archive/info/Free_Math_Font_Survey/survey.html free font survey].</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Talk:Equation_alignment&diff=6824Talk:Equation alignment2006-11-22T19:51:45Z<p>Maarten-Jan: rename "Math structures" as well?</p>
<hr />
<div>For some reason, <tt>\setupformulas[strut=yes]</tt> seems to prevent <tt>\tracemathtrue</tt> from working. Can anybody else figure out what's up with that? --[[User:Brooks|Brooks]] 07:28, 10 Jul 2005 (CEST)<br />
<br />
Update: it's due to the fact that <tt>\tracemathtrue</tt> doesn't work unless an alignment is specified. Reported as a bug to the mailing list. --[[User:Brooks|Brooks]] 08:27, 10 Jul 2005 (CEST)<br />
<br />
I would like to propose to move or rename the "MathAlignment" page to "Equation alignment". I think this captures exactly what this page is about and avoids the confusion with "Math structures". Also, the CamelCase (or BumpyWord, WikiWord, etc.) title is not customary for a Wikimedia wiki. Any objections? --[[User:Maarten-Jan|Maarten-Jan]] 14:43, 19 November 2006 (CET)<br />
<br />
:I see no problem with the change. However, the confusion with "Math strucures" will remain. --[[User:Adityam|Aditya]]<br />
<br />
:You are right. Maybe "Math structures" should also be renamed... how about "Multiline equations" which is the terminology mostly used with LaTeX? --[[User:Maarten-Jan|Maarten-Jan]] 20:51, 22 November 2006 (CET)</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Talk:Equation_alignment&diff=6800Talk:Equation alignment2006-11-19T13:43:19Z<p>Maarten-Jan: I propose to rename the "MathAlignment" page to "Equation alignment"</p>
<hr />
<div>For some reason, <tt>\setupformulas[strut=yes]</tt> seems to prevent <tt>\tracemathtrue</tt> from working. Can anybody else figure out what's up with that? --[[User:Brooks|Brooks]] 07:28, 10 Jul 2005 (CEST)<br />
<br />
Update: it's due to the fact that <tt>\tracemathtrue</tt> doesn't work unless an alignment is specified. Reported as a bug to the mailing list. --[[User:Brooks|Brooks]] 08:27, 10 Jul 2005 (CEST)<br />
<br />
I would like to propose to move or rename the "MathAlignment" page to "Equation alignment". I think this captures exactly what this page is about and avoids the confusion with "Math structures". Also, the CamelCase (or BumpyWord, WikiWord, etc.) title is not customary for a Wikimedia wiki. Any objections? --[[User:Maarten-Jan|Maarten-Jan]] 14:43, 19 November 2006 (CET)</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Multiline_equations&diff=6778Multiline equations2006-11-13T12:27:08Z<p>Maarten-Jan: extended math cases section and added page to Math category</p>
<hr />
<div>< [[Main Page]] | [[Math]] | [[Math with newmat]] | [[MathML]] ><br />
<br />
== Basic Alignment ==<br />
<br />
<br />
Two modes of input <br />
<br />
* Latex style<br />
<texcode><br />
\startformula \startalign<br />
v &= u + at \\<br />
h &= ut + \frac12 gt^2 \\<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
Note the \\ in the last line, above.<br />
<br />
This appears as follows:<br />
<br />
<context><br />
\startformula \startalign<br />
v &= u + at \\<br />
h &= ut + \frac12 gt^2 \\<br />
\stopalign \stopformula<br />
</context><br />
<br />
* Context Style<br />
<br />
<texcode><br />
\startformula \startalign<br />
\NC v \NC = u + at \NR<br />
\NC h \NC= ut + \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<context><br />
\startformula \startalign<br />
\NC v \NC = u + at \NR<br />
\NC h \NC = ut + \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
(The examples here will focus on the context style, having two styles can be confusing --[[User:Adityam| Aditya ]] )<br />
<br />
== Changing the number of columns ==<br />
<br />
The above equations were aligned at <code>=</code>. Suppose you also want the <code>+</code> to align. Well, this is simple in context, simply specify the number of columns with <code>\startalign</code><br />
<br />
<br />
<texcode><br />
\startformula \startalign[n=3]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<context><br />
\startformula \startalign[n=3]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
== Alignment of each column ==<br />
If you want more control over the formatting, and want the middle column to be center aligned, you can do that by <br />
<texcode><br />
\startformula \startalign[n=3,align={right,middle,left}]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<context><br />
\startformula \startalign[n=3,align={right,middle,left}]<br />
\NC v \NC = u \NC+ at \NR<br />
\NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
This mechanism allows fancier alignments like<br />
<br />
<texcode><br />
\startformula \startalign[n=4,align={left,right,middle,left}]<br />
\NC \text{We have} \quad \NC v \NC = u \NC+ at \NR<br />
\NC \text{and} \NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</texcode><br />
<br />
<br />
<context><br />
\startformula \startalign[n=4,align={left,right,middle,left}]<br />
\NC \text{We have} \quad \NC v \NC = u \NC+ at \NR<br />
\NC \text{and} \NC h \NC= ut \NC+ \frac12 gt^2 \NR<br />
\stopalign \stopformula<br />
</context><br />
<br />
== Working with equation numbering ==<br />
<br />
aligned equations can be numbered by placing a tag after <cmd>NR</cmd><br />
<br />
<texcode><br />
\placeformula \startformula \startalign<br />
\NC v \NC = u + at \NR[eq:v]<br />
\NC h \NC = ut + \frac12 gt^2 \NR[eq:h]<br />
\stopalign \stopformula<br />
Equation (\in[eq:v]) tells the final velocity after <br />
time $t$ and equation (\in[eq:h]) tells the distance <br />
travelled in time $t$.<br />
</texcode><br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
\placeformula \startformula \startalign<br />
\NC v \NC = u + at \NR[eq:v]<br />
\NC h \NC = ut + \frac12 gt^2 \NR[eq:h]<br />
\stopalign \stopformula <br />
Equation (\in[eq:v]) tells the final velocity after time $t$ and equation (\in[eq:h]) tells the distance travelled in time $t$.<br />
</context><br />
<br />
== Changing the number of columns ==<br />
<br />
== Defining new alignment structures ==<br />
<br />
New alignment can be defined using <cmd>definemathalignment</cmd>. For example, to emulate <code>gather</code> environment of amsmath, we can use<br />
<texcode><br />
\definemathalignment<br />
[gather]<br />
[n=1,align={middle}]<br />
<br />
\startformula \startgather<br />
\NC ax^2 + bx + c = 0 \NR<br />
\NC \text{roots} = \frac{ -b \pm \sqrt{b^2 - 4ac}}{2a} \NR<br />
\stopgather \stopformula<br />
</texcode><br />
<br />
<context><br />
\definemathalignment<br />
[gather]<br />
[n=1,align={middle}]<br />
<br />
\startformula \startgather<br />
\NC ax^2 + bx + c = 0 \NR<br />
\NC \text{roots} = \frac{ -b \pm \sqrt{b^2 - 4ac}}{2a} \NR<br />
\stopgather \stopformula<br />
<br />
</context><br />
<br />
<br />
== Cases ==<br />
<br />
Context provides a <cmd>startmathcases</cmd> <cmd>stopmathcases</cmd> pair to make it easy get cases. <br />
<texcode><br />
\startformula<br />
f(x) = \startmathcases<br />
\NC x, \NC if $0 \le x \le \frac12$ \NR<br />
\NC 1-x ,\NC if $\frac12 \le x \le 1$ \NR<br />
\stopmathcases<br />
\stopformula<br />
</texcode><br />
<br />
gives<br />
<br />
<context><br />
\startformula<br />
f(x) = \startmathcases<br />
\NC x, \NC if $0 \le x \le \frac12$ \NR<br />
\NC 1-x ,\NC if $\frac12 \le x \le 1$ \NR<br />
\stopmathcases<br />
\stopformula<br />
</context><br />
<br />
The cases environment consists of two columns, separated by <cmd>NC</cmd>. The second column is by default in text mode. An alternative way of getting the same result is to define the second column as a mathcolumn with <cmd>MC</cmd> like so:<br />
<br />
<texcode><br />
\startformula<br />
f(x) = \startmathcases<br />
\NC x, \MC \text{if } 0 \le x \le \frac12 \NR<br />
\NC 1-x ,\MC \text{if } \frac12 \le x \le 1 \NR<br />
\stopmathcases<br />
\stopformula<br />
</texcode><br />
<br />
Each line must end with a <cmd>NR</cmd>.<br />
<br />
== Numbered Cases ==<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Product_integral&diff=6741Product integral2006-11-06T10:06:23Z<p>Maarten-Jan: removed typo</p>
<hr />
<div>= About the product integral =<br />
The product integral is a mathematical operator which fills the gap in the following table:<br />
<center><br />
<context><br />
\starttable[|c|c|]<br />
\HL<br />
\VL $\sum$ \VL $\int$ \VL \AR<br />
\HL<br />
\VL $\prod$ \VL ? \VL \AR<br />
\HL<br />
\stoptable<br />
</context><br />
</center><br />
<br />
and looks like<br />
<center>[[Image:Prodint.jpg]]</center><br />
<br />
This notation was suggested by Gill & Johansen (1990). Although the product integral is relatively unknown to most people, it performs an important role in the theory of survival analysis and Markov processes. In fact, for those people who are familiar with survival analysis, the Kaplan-Meier estimator of the survival function is the product integral of the Nelson-Aalen estimator of the cumulative intensity function. Product integration was introduced by the Italian mathematician [http://en.wikipedia.org/wiki/Vito_Volterra Vito Volterra] in relation to the Volterra integral equations.<br />
<br />
= Installation =<br />
# download the LaTeX package from Richard Gill's website: [http://www.math.uu.nl/people/gill/prodint.tar.gz http://www.math.uu.nl/people/gill/prodint.tar.gz]<br />
# unpack the archive in an appropriate location of your TeX installation and run <code>texhash</code> to update the filename database<br />
# make sure that pdftex, dvips and others can find the font mapfile prodint.map (e.g. by running <code>updmap --enable Map=prodint.map</code> if you have teTeX or TeXlive on Linux)<br />
# place the following code before the body of your document to add the symbol to the set of mathematical symbols:<br />
<texcode><br />
\definefontsynonym [MathGamma] [prodint]<br />
<br />
\definefamilysynonym [default] [xop] [mc]<br />
<br />
\startmathcollection [default]<br />
<br />
\definemathsymbol [prodi] [op] [xop] [80]<br />
\definemathsymbol [Prodi] [op] [xop] [82]<br />
\definemathsymbol [PRODI] [op] [xop] [84]<br />
<br />
\stopmathcollection<br />
<br />
\loadmapfile[prodint]<br />
<br />
<br />
\starttypescript [math] [modern,computer-modern,latin-modern,ams] [size]<br />
\definebodyfont <br />
[17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=prodint]<br />
\stoptypescript<br />
<br />
\definetypeface [modern] [mm] [math] [modern]<br />
[computer-modern][encoding=default]<br />
<br />
\setupbodyfont[reset,modern,10pt]<br />
<br />
\enablemathcollection[prodint]<br />
<br />
\starttext<br />
$\prodi$, $\Prodi$ and $\PRODI$<br />
\stoptext<br />
</texcode><br />
<br />
= Notes =<br />
Please consider the following notes:<br />
* the product integral symbol only exists in Computer Modern, therefore the code above is only valid when using this font<br />
* this setup defines three commands: <code>\prodi</code> for inline formulae, <code>\Prodi</code> and <code>\PRODI</code> for displaystyle formulae (where the latter is slightly larger); see the sample file prodint.pdf in the archive for example usage<br />
<br />
= References and resources =<br />
* Gill, R.D. & Johansen, S. (1990) A survey of product-integration with a view toward application in survival analysis, ''The Annals of Statistics'', Vol. 18, pp.1501-1555.<br />
* Richard Gill's [http://www.math.uu.nl/people/gill website] contains links to various articles on product integration<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Math&diff=6740Math2006-11-06T10:04:28Z<p>Maarten-Jan: /* Math Fonts */ added link to Product integral page</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
For typesetting of mathematics follows different rules than that of normal text, TeX uses something called "math mode" where some characters get a different meaning to enable a simple syntax for complicated formulas.<br />
<br />
==Simple Math==<br />
<br />
Typesetting mathematics can be divided into two parts, '''inline''' math (mathematical formulas set within ordinary paragraphs as part of the text) and '''display''' math mathematics set on lines by themselves, often with equation numbers). Inline math consists of maths that is typed in a sentence. For example<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</context><br />
<br />
There are two ways of typing inline math. The TeX way is to surround what you want to type within <code>$</code>...<code>$</code>. Thus, the above will be typed as<br />
<texcode><br />
Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results<br />
</texcode><br />
<br />
ConTeXt also provides an alternative way of typing the same result. Instead of dollars, you can write the material for maths inside <cmd>mathematics</cmd> or <cmd>math</cmd> (which is shorter). Thus, an alternate way to type the above is,<br />
<texcode><br />
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results<br />
</texcode><br />
<br />
Choose the method that suits your style.<br />
<br />
Display math is enclosed in a <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair. Thus <br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Numbering Formulae ==<br />
<br />
ConTeXt provides an easy way to number the display maths equations. Simply, put <cmd>placeformula</cmd> before <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair and you will get numbered equations. Thus,<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</texcode><br />
</td><td><br />
This, when typeset, produces the following:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
The <cmd>placeformula</cmd> command is optional, and produces the equation number; leaving it off produces an unnumbered equation.<br />
<br />
=== Changing format of numbers ===<br />
You can use <cmd>setupformulas</cmd> to change the format of numbers. For example to get bold numbers inside square brackets use<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
</texcode><br />
</td><br />
<br />
<td>which gives<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[left={[},right={]},numberstyle=bold]<br />
The famous result (once more) is given by<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2.<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
To get alphabets instead of numbers, use<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
\setupformulas[conversion=Character]<br />
</texcode><br />
</td><br />
<td>which gives<br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
\setupformulas[conversion=Character]<br />
\placeformula<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
== Not so Simple Maths ==<br />
<br />
ConTeXt's base mathematics support is built on the mathematics support in plain TeX, thus allowing quite complicated formulas. (There are also some additional macros, such as the <cmd>text</cmd> command for text-mode notes within math.) For instance:<br />
<texcode><br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<br />
which produces<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr<br />
a_{21}&a_{22}&\ldots&a_{2n}\cr<br />
\vdots&\vdots&\ddots&\vdots\cr<br />
a_{n1}&a_{n2}&\ldots&a_{nn}\cr}<br />
\pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n}<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
Context provides a wrapper around tex <cmd>pmatrix</cmd>. The above can be typeset in a contextish way as<br />
<texcode><br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</texcode><br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
A more complicated equation:<br />
\definemathmatrix[pmatrix][left={\left(\,},right={\,\right)}]<br />
\placeformula<br />
\startformula<br />
{{\theta_{\text{\CONTEXT}}}^2 \over x+2}<br />
= \startpmatrix<br />
\NC a_{11} \NC a_{12} \NC \ldots \NC a_{1n} \NR<br />
\NC a_{21} \NC a_{22} \NC \ldots \NC a_{2n} \NR<br />
\NC \vdots \NC \vdots \NC \ddots \NC \vdots \NR<br />
\NC a_{n1} \NC a_{n2} \NC \ldots \NC a_{nn} \NR<br />
\stoppmatrix<br />
\startpmatrix b_1 \NR b_2 \NR \vdots \NR b_n \NR \stoppmatrix<br />
+ \sum_{j=1}^\infty z^j<br />
\left( \sum_{\scriptstyle n = 1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)<br />
\stopformula<br />
</context><br />
<br />
[http://www.pragma-ade.com/texmath.html Here] you can try it "live" (you must go to [http://www.pragma-ade.com/exalogin login] first).<br />
<br />
[[MathAlignment]] is covered on a separate page.<br />
<br />
==Sub-Formula Numbering==<br />
<br />
As mentioned above, formulas can be numbered using the <cmd>placeformula</cmd> command. This (and the related <cmd>placesubformula</cmd> command have an optional argument which can be used to produce sub-formula numbering. For example:<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Examples:<br />
\placeformula{a}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
<br />
\placesubformula{b}<br />
\startformula<br />
c^2 = a^2 + b^2<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
What's going on here is simpler than it might appear at first glance. Both <cmd>placeformula</cmd> and <cmd>placesubformula</cmd> produce equation numbers with the optional tag added at the end; the sole difference is that the former increments the equation number first, while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number but presumably have different tags).<br />
<br />
This is sufficient for cases where the standard ConTeXt equation numbers suffice, and where only one equation number is needed per formula. However, there are many cases where this is insufficient, and <cmd>placeformula</cmd> defines <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> commands, which provide hooks to allow the use of ConTeXt-managed formula numbers with plain TeX equation numbering. These, when used within a formula, simply return the formula number in properly formatted form, as can be seen in this simple example with plain TeX's <cmd>eqno</cmd>. Note that the optional tag is inherited from <cmd>placeformula</cmd>.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples:<br />
\placeformula{c}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \eqno{\formulanumber}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
In order for this to work properly, we need to turn off ConTeXt's automatic formula number placement; thus the <cmd>let</cmd> command to empty <cmd>doplaceformulanumber</cmd>, which must be placed <em>after</em> the start of the formula. In many practical examples, however, this is not necessary; ConTeXt redefines <cmd>displaylines</cmd> and <cmd>eqalignno</cmd> to do this automatically.<br />
<br />
For more control over sub-formula numbering, <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> have an optional argument parallel to that of <cmd>placeformula</cmd>, as demonstrated in this use of plain TeX's <cmd>eqalignno</cmd>, which places multiple equation numbers within one formula.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
Yet more examples:<br />
\placeformula<br />
\startformula<br />
\eqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
Note that both <cmd>formulanumber</cmd> and <cmd>subformulanumber</cmd> can be used within the same formula, and the formula number is incremented as expected. Also, if an optional argument is specified in both <cmd>placefigure</cmd> and <cmd>formulanumber</cmd>, the latter takes precedence.<br />
<br />
<table width="100%" cols="2"><tr valign="top"><td width="50%"><br />
<texcode><br />
More examples for left-located equation number:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</texcode><br />
</td><td><br />
<context><br />
\setuplayout[scale=0.8,width=8cm]<br />
More examples for left-located equation no.:<br />
\setupformulas[location=left]<br />
\placeformula{d}<br />
\startformula<br />
\let\doplaceformulanumber\empty<br />
c^2 = a^2 + b^2 \leqno{\formulanumber}<br />
\stopformula<br />
and<br />
\placeformula<br />
\startformula<br />
\leqalignno{c^2 &= a^2 + b^2 &\formulanumber{a} \cr<br />
a^2 + b^2 &= c^2 &\subformulanumber{b} \cr<br />
d^2 &= e^2 &\formulanumber\cr}<br />
\stopformula<br />
</context><br />
</td></tr></table><br />
<br />
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang<br />
<br />
If you want named subformula with a reference see the solution proposed by Aditya Mahajan on the mailing-list [http://archive.contextgarden.net/message/20061029.063821.ba521b6c.en.html] (2006-10-29). This feature should be added to the core eventually.<br />
<br />
==List of Formulas==<br />
<br />
You can have a list of the formulas contained in a document by using <cmd>placenamedformula</cmd> instead of <cmd>placeformula</cmd>. Only the formulas written with <cmd>placenamedformula</cmd> are not put in the list, so that you can control precisely the content of the list.<br />
<br />
<cmd>placenamedformula</cmd> takes as first parameter the name of the formula put in the list. The other <cmd>placeformula</cmd> features are still available. The list can be formatted like any other list.<br />
<br />
Example:<br />
<texcode><br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</texcode><br />
<br />
Gives:<br />
<br />
<context><br />
\setuplayout[scale=0.8,width=13cm]<br />
\subsubject{List of Formulas}<br />
\placelist[formula][criterium=text,alternative=c]<br />
<br />
\subsubject{Formulas}<br />
\placenamedformula[one]{First listed Formula}<br />
\startformula a = 1 \stopformula \endgraf<br />
<br />
\placeformula<br />
\startformula a = 2 \stopformula \endgraf<br />
<br />
\placenamedformula{Second listed Formula}{b}<br />
\startformula a = 3 \stopformula \endgraf<br />
</context><br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Math_structures]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, and a own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Math [[Fonts]]==<br />
* [[Bold Math]]<br />
* [http://homepage.mac.com/atl/tex/EulerContext.pdf Euler in ConTeXt (using Euler math font)] by Adam Lindsay<br />
* [[rsfs]] Using Ralph Smith's Formal Script<br />
* [[Product integral]] symbol<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=Product_integral&diff=6739Product integral2006-11-06T10:00:13Z<p>Maarten-Jan: new page to describe installation and usage of product integral symbol</p>
<hr />
<div>= About the product integral =<br />
The product integral is a mathematical operator which fills the gap in the following table:<br />
<center><br />
<context><br />
\starttable[|c|c|]<br />
\HL<br />
\VL $\sum$ \VL $\int$ \VL \AR<br />
\HL<br />
\VL $\prod$ \VL ? \VL \AR<br />
\HL<br />
\stoptable<br />
</context><br />
</center><br />
<br />
and looks like<br />
<center>[[Image:Prodint.jpg]]</center><br />
<br />
This notation was suggested by Gill & Johansen (1990). Although the product integral is relatively unknown to most people, it performs an important role in the theory of survival analysis and Markov processes. In fact, for those people who are familiar with survival analysis, the Kaplan-Meier estimator of the survival function is the product integral of the Nelson-Aalen estimator of the cumulative intensity function. Product integration was introduced by the Italian mathematician [http://en.wikipedia.org/wiki/Vito_Volterra Vito Volterra] in relation to the Volterra integral equations.<br />
<br />
= Installation =<br />
# download the LaTeX package from Richard Gill's website: [http://www.math.uu.nl/people/gill/prodint.tar.gz http://www.math.uu.nl/people/gill/prodint.tar.gz]<br />
# unpack the archive in an appropriate location of your TeX installation and run <code>texhash</code> to update the filename database<br />
# make sure that pdftex, dvips and others can find the font mapfile prodint.map (e.g. by running <code>updmap --enable Map=prodint.map</code> if you have teTeX or TeXlive on Linux)<br />
# place the following code before the body of your document to add the symbol to the set of mathematical symbols:<br />
<texcode><br />
\definefontsynonym [MathGamma] [prodint]<br />
<br />
\definefamilysynonym [default] [xop] [mc]<br />
<br />
\startmathcollection [default]<br />
<br />
\definemathsymbol [prodi] [op] [xop] [80]<br />
\definemathsymbol [Prodi] [op] [xop] [82]<br />
\definemathsymbol [PRODI] [op] [xop] [84]<br />
<br />
\stopmathcollection<br />
<br />
\loadmapfile[prodint]<br />
<br />
<br />
\starttypescript [math] [modern,computer-modern,latin-modern,ams] [size]<br />
\definebodyfont <br />
[17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=prodint]<br />
\stoptypescript<br />
<br />
\definetypeface [modern] [mm] [math] [modern]<br />
[computer-modern][encoding=default]<br />
<br />
\setupbodyfont[reset,modern,10pt]<br />
<br />
\enablemathcollection[prodint]<br />
<br />
\starttext<br />
$\prodi$, $\Prodi$ and $\PRODI$<br />
\stoptext<br />
</texcode><br />
<br />
= Notes =<br />
Please consider the following notes:<br />
* the product integral symbol only exists in Computer Modern, therefore the code above is only valid when using this font<br />
* this setup defines three commands: <code>\prodi</code> for inline formulae, <code>\Prodi</code> and <code>\PRODI</code> for displaystyle formulae (where the latter is slightly larger); see the sample file prodint.pdf in the archive for example usage<br />
<br />
= References and resources =<br />
* Gill, R.D. & Johansen, S. (1990) A survey of product-integration with a view toward application in survival analysis, ''The Annals of Statistics'', Vol. 18, pp.1501-1555.<br />
* Richard Gill's [http://www.math.uu.nl/people/gill website] contains links to various articles articles on product integration<br />
<br />
[[Category:Math]]</div>Maarten-Janhttps://wiki.contextgarden.net/index.php?title=File:Prodint.jpg&diff=6738File:Prodint.jpg2006-11-06T09:09:39Z<p>Maarten-Jan: the mathematical symbol for the product integral</p>
<hr />
<div>the mathematical symbol for the product integral</div>Maarten-Jan