Changes

Jump to navigation Jump to search
59 bytes added ,  08:27, 2 July 2022
m
Text replacement - "pragma-ade.com" to "pragma-ade.nl"
< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Multiline equations]] >
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 macros to make the typesetting of supporting definitionsmathematics easier.* The "native" ConTeXt way There are '''two''' kinds of '''math is [[MathML]], an application of [[XML]] modes''' --- rather verbose but mighty'''inline math and display math'''.* And there's a [[Math Mathematical expressions that are written with newmat|new the running text are called inline math; while mathematical expressions that break the flow of the text (such as formulas or equations) are called display math]] module . TeX takes care of proper spacing around expressions and provides macros to typeset most mathematical constructs.Complicated expressions can be built by working in steps---break down the expression into sub-expressions, build the sub-expressions and then combine them to get the distributioncomplicated expression.
==Simple Math==The basics of typesetting math in ConTeXt is explained here.
ConTeXt supports inline === Display 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 is enclosed in "$" signs, while display math is enclosed in a <cmd>startformula</cmd> / <cmd>stopformula</cmd> pair.mode ===Type
<texcode>
Inline math is set as $c^2 = a^2 + b^2$, and display math as\placeformula\startformulac^2 = a^2 + b^2... \stopformula
</texcode>
This, when typeset, produces the followingto get display math mode. === Inline math mode ===There are four equivalent commands to get inline math mode:
<contexttexcode>Inline math is set as $c^2 = a^2 + b^2... $, and display math as % TeX style.\placeformulam{ ... } \startformulac^2 = a^2 + b^2math{ ...} \stopformulamathematics{ ... }</contexttexcode>
The === Note to Plain TeX Users ===ConTeXt is plain TeX compatible. So, if you have any old document written in plain TeX, it will work with ConTeXt. This does not mean that you will get pixel by pixel identical output with ConTeXt. For inline math, everything that you learnt for plain TeX is also true for ConTeXt. However, display math is significantly different. '''Do not use <cmdcode>placeformula$$ .... $$</cmdcode> command is optional''' to write display math formulas in ConTeXt, and produces since you will not get the equation number; leaving it off produces an unnumbered equationcorrect spacing around the formulas.Instead use
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:
<texcode>
A more complicated equation:\placeformula\startformula{{\theta_{\text{ConTeXt}}}^2 \over x+2} = \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr a_{21}&a_{22}&\ldots&a_{2n}\cr \vdots&\vdots&\ddots&\vdots\cr a_{n1}&a_{n2}&\ldots&a_{nn}\cr} \pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n} + \sum_{j=1}^\infty z^j \left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)... \stopformula
</texcode>
which produces<context>A See [[Math/Display]] for more complicated equation:\placeformula\startformula{{\theta_{\text{details on how to use display math in ConTeXt}}}^2 \over x+2} = \pmatrix{a_{11}&a_{12}&\ldots&a_{1n}\cr a_{21}&a_{22}&\ldots&a_{2n}\cr \vdots&\vdots&\ddots&\vdots\cr a_{n1}&a_{n2}&\ldots&a_{nn}\cr} \pmatrix{b_1 \cr b_2 \cr \vdots \cr b_n} + \sum_{j=1}^\infty z^j \left( \sum_{\scriptstyle n=1 \atop \scriptstyle n \ne j}^\infty Z_j^n \right)\stopformula</context>.
=== Note to AMSTeX/LaTeX Users ===ConTeXt offers almost all the features that are present in AMSTeX and LaTeX. However, ConTeXt syntax is different. See this [http://wwwdl.ntgcontextgarden.nl:8061net/myway/texmathcontext-latex-math.pdf HereMy Way] for how to 'translate' from amsmath syntax to ConTeXt syntax. [[LaTeX_Math_in_ConTeXt]] you can try it "live" (PDF interface!)gives some brief ideas on how to get the LaTeX syntax to run in ConTeXt.
[[MathAlignment]] is covered on a separate page.== The details ==
==Formula Numbering=Math symbols ===* [[Math/basic | How to input math]] (binary relations, greek letters, subscripts and superscripts)* Accents* [[Math/stackers | underbrace]], [[Math/stackers | overbrace]]* [[Math/fractions | Fractions, Binomials, genfrac, continued fractions.]]* Delimiters (big, bigg, left, middle, right)* Integrals and Sums* ([[Math/functions|Log like]]) functions* dots* [[Multiline_equations#Cases|Cases]], matrices, bordermatrix* Arrows (see [http://dl.contextgarden.net/myway/matharrows.pdf Math Arrows])* [[Vectors]]* [[Product integral]]
As mentioned above=== Display Math ===* [[Math/Display | Formula, formulas can be numbered using the <cmd>placeformula<formula number]]* [[Multiline equations]] (see [http://cmd> commanddl.contextgarden. This (net/myway/mathalign.pdf Using \mathalign and the related <cmd>placesubformula</cmd> command have an optional argument which can be used to produce sub-friends])* [[Equation alignment]]* [[Matrix in maths]]* [[Math spacing]]* Discussion: [[User_talk:Zenlima | summary of formula numbering. For exampleproblems]] (comment:unverified)
<texcode>
\placeformula{a}
\startformula
c^2 = a^2 + b^2
\stopformula
\placesubformula{b}Others:\startformula* [[math calligraphic]]c^2 = a^2 + b^2* Use [[mathstackers]] in order to define new math commands in which some characters are stacked over another one* [[\stopformula</texcode>startcases]]
<context>\placeformula{a}\startformulac^2 = a^2 + b^2\stopformula=Math Fonts==
\placesubformula{b}\startformulac^2 = a^2 + b^2\stopformula</context>''See [[Math fonts]]'' for the main article about this subject.
What's going == Other Methods ==* There are two different math modules on here is simpler than it might appear at first glance[http://dante.ctan. Both <cmd>placeformula<org/cmd> tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and <cmd>placesubformula</cmd> produce equation numbers [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the optional tag added at the end; the sole difference distribution.* Context now has inbuilt support for [[Multiline equations]]* 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 that the former increments the equation number first[[MathML]], while the latter does not (and thus can be used for the second and subsequent formulas that use the same formula number an application of [[XML]] - rather verbose but presumably have different tags)mighty.
==Science==
* Esp. for physics there’s the [[Units]] module.
* Additions to [[MathML]] are PhysML and ChemML.
* [[Chemistry]]
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).
==Number Formatting==
There's a special command, <{{cmd>|digits</cmd>}}, and a with its own manual about formatting numbers, see [http://www.pragma-ade.comnl/general/magazines/mag-0003.pdf Pasting digits together]
==Math [[Fonts]]Evaluating expressions in ConTeXt==(i.e. ''doing'' math)* See also [[Bold MathExpressions]]* [http://homepage.mac.com/atl/tex/EulerContext.pdf Euler in ConTeXt (using Euler math font)] by Adam Lindsay
==Science==* Esp. for physics there’s the [[units]] module.* Additions to [[MathML]] are PhysML and ChemML.* [[Chemistry]]* There's a module for chemical structure formulaeCategory: [[Chemistry|PPCHTeX]] (works also with LaTeX). It's based on [[Metapost]] and [[MetaFunMath]].

Navigation menu