Changes

Jump to navigation Jump to search
1,484 bytes added ,  06:11, 24 January 2006
rewriting this page to make it better suited to someone who does not already know tex
< [[Main Page]] | [[Math with newmat]] | [[MathML]] >
Many people start with TeX because they want to set formulae.Simple math typesetting exists since PlainTeX and these commands work in ConTeXt as in LaTeX.Advanced math was introduced to TeX by AMS (American Mathematical Society); nowadays AMSTeX and LaTeX are united. But how can one use advanced math with ConTeXt?== Introduction ==
* There are two different math modules TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN]top of TeX, [[Math with nath|nath]] and [[Math with amsl|amsl]]it inherits all those features.* It is also possible In addition to use most [[LaTeX Math in these, ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set adds lot of supporting definitions.* The "native" ConTeXt way macros to make the typesetting of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.* And there's a [[Math with newmat|new math]] module in the distributionmathematics easier.
==Simple Math==
ConTeXt supports 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 enclosed typed in "a sentence. For example <context>\setuplayout[scale=0.8,width=13cm]Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trignometric results</context> There are two ways of typing inline math. The TeX was is to surround what you want to type within <code>$" signs</code>...<code>$</code>. Thus, the above will be typed as<texcode>Pythagoras formula, while display stating $a^2 + b^2 = c^2$ was one of the first trignometric results</texcode> ConTeXt also provides an alternative way of typing the same result. Instead of dollars, you can write the material for maths inside <comd>\mathematics</cmd>. Thus, an alternate way to type the above is,<texcode>Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trignometric results</texcode> Choose the method that suits your style. (I do not know if there are pros and cons of $..$ vs \mathematics{}. If someone knows, then please elaborate -- aditya ) Display math is enclosed in a <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair.Thus  <texcode>The famous result (once more) is given by\startformulac^2 = a^2 + b^2.\stopformula</texcode> This, when typeset, produces the following:
<context>
\setuplayout[scale=0.8,width=13cm]
The famous result (once more) is given by
\startformula
c^2 = a^2 + b^2.
\stopformula
</context>
 
== Numbering Formula ==
 
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,
<texcode>
Inline math The famous result (once more) is set as $c^2 = a^2 + b^2$, and display math asgiven by
\placeformula
\startformula
<context>
\setuplayout[scale=0.8,width=13cm]
Inline math The famous result (once more) is set as $c^2 = a^2 + b^2$, and display math asgiven by
\placeformula
\startformula
The <cmd>placeformula</cmd> command is optional, and produces the equation number; leaving it off produces an unnumbered equation.
 
== Not so Simple Maths ==
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:
[[MathAlignment]] is covered on a separate page.
==Sub-Formula Numbering==
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:
-- 23:46, 15 Aug 2005 (CEST) Prinse Wang
 
== Other Methods ==
* 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]].
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.
* And there's a [[Math with newmat|new math]] module in the distribution.
==Number Formatting==

Navigation menu