Difference between revisions of "Command/ startmathalignment"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \start<i>mathalignment</i> ... \stop<i>mathalignment</i>")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<?xml version='1.0'?>
 
<!-- this file was generated on 2020-08-20T09:05 -->
 
 
<cd:commandgroup generated="yes" name="mathalignment" type="environment" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
 
<cd:commandgroup generated="yes" name="mathalignment" type="environment" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>
+
<cd:shortdesc><!-- a short command summary goes here -->
<!-- a short command summary goes here -->
+
The instances of  <tt>\start<i>mathalignment</i> ... \stop<i>mathalignment</i></tt> are used for math alignments.
The instances of  <tt>\start<i>mathalignment</i> ... \stop<i>mathalignment</i></tt> are used for ...
 
 
</cd:shortdesc>
 
</cd:shortdesc>
 
<cd:sequence>
 
<cd:sequence>
Line 23: Line 20:
 
   </cd:command>
 
   </cd:command>
 
</cd:variants>
 
</cd:variants>
<cd:description>
+
<cd:description>Using {{cmd|startmathalignment}} one can align mathematical equations similar to what is known from LaTeX's <code>amsmath</code> package.  It is used inside formulas.  The usage is straightforward:
<!-- the long description of the command goes here -->
+
<texcode>
 +
\startformula
 +
  \startmathalignment[...=...]
 +
    \NC ... \NC ... \NR
 +
  \stopmathalignment
 +
\stopformula
 +
</texcode>
 +
As in tabular materials {{cmd|NC}} is used as column separator and {{cmd|NR}} as row separator.  Whether the formula is numbered can be controlled by prefixing {{cmd|placeformula}} to {{cmd|startformula}}.  This will place a single number vertically centred with respect to the equation.  When all the subformulas should be numbered individually, one specifies <code>number=auto</code>.
 +
 
 +
There is a predefined shorthand for {{cmd|startmathalignment}} which is {{cmd|startalign}} to match the <code>amsmath</code> name.  However, {{cmd|startmathalignment}} should be preferred, as {{cmd|startalign}} already has a different meaning outside math mode.
 +
 
 
</cd:description>
 
</cd:description>
<cd:examples>
+
<cd:examples><cd:example title="">To imitate certain LaTeX contructs (some might not yet work on the Wiki).  More examples can be found in [https://www.ntg.nl/maps/34/06.pdf A. Mahajan, <i>Display Math in ConTeXt</i>, MAPS <b>34</b>, 22–34 (2006).]
<!--  command example(s)
+
 
<cd:example title="">
+
* <code>align</code>
</cd:example>
+
<context source="yes">
-->
+
\placeformula
</cd:examples>
+
\startformula
<cd:notes>
+
  \startmathalignment[number=auto]
<!--  this is for special remarks that do not fit elsewhere, like discovered bugs in specific context versions
+
    \NC v \NC= u + at, \NR
<cd:note author="..." date="...">
+
    \NC d \NC= ut + \frac{1}{2} at^2. \NR
</cd:note>
+
  \stopmathalignment
-->
+
\stopformula
</cd:notes>
+
</context>
 +
 
 +
* <code>gather</code>
 +
<context source="yes">
 +
\placeformula
 +
\startformula
 +
  \startmathalignment[n=1,number=auto]
 +
    \NC v = u + at, \NR
 +
    \NC d = ut + \frac{1}{2} at^2. \NR
 +
  \stopmathalignment
 +
\stopformula
 +
</context>
 +
 
 +
* <code>alignat</code>
 +
<context source="yes">
 +
\placeformula
 +
\startformula
 +
  \startmathalignment
 +
    [n=7,align={right,left,right,left,right,left,right}]
 +
    \NC x_1 \NC + \NC x_2 \NC + \NC 6x_3 \NC = \NC 170, \NR
 +
    \NC 3x_1 \NC - \NC 110x_2 \NC - \NC x_3 \NC = \NC 4, \NR
 +
    \NC 14x_1 \NC + \NC 13x_2 \NC + \NC 10x_3 \NC = \NC 25. \NR
 +
  \stopmathalignment
 +
\stopformula
 +
</context>
 +
</cd:example></cd:examples>
 +
<cd:notes></cd:notes>
 
<cd:seealso>
 
<cd:seealso>
<!-- one or more of these:
 
<cd:commandref name="xx"></cd:commandref>
 
<cd:wikipage  page="xx"></cd:wikipage>
 
<cd:url        url="https://xx"></cd:url>
 
<cd:manual    pdf="xx"></cd:manual>
 
<cd:source    file="xx"></cd:source>
 
-->
 
 
<cd:commandref name="definemathalignment" originator="system"></cd:commandref>
 
<cd:commandref name="definemathalignment" originator="system"></cd:commandref>
 
<cd:commandref name="setupmathalignment" originator="system"></cd:commandref>
 
<cd:commandref name="setupmathalignment" originator="system"></cd:commandref>
<cd:source file="math-ali.mkiv" originator="system"></cd:source>  
+
<cd:source file="math-ali.mkiv" originator="system"></cd:source>
<cd:wikipage originator="system" page="Category:Mathematics"></cd:wikipage>  
+
<cd:wikipage originator="system" page="Category:Mathematics"></cd:wikipage>
<cd:wikipage originator="system" page="Keywords:Alignment"></cd:wikipage>  
+
<cd:wikipage originator="system" page="Keywords:Alignment"></cd:wikipage>
</cd:seealso>
+
<cd:commandref name="placeformula"></cd:commandref>
 +
<cd:commandref name="startformula"></cd:commandref>
 +
<cd:wikipage page="Category:Mathematics"></cd:wikipage></cd:seealso>
 
</cd:commandgroup>
 
</cd:commandgroup>

Latest revision as of 16:32, 14 April 2024


\startmathalignment ... \stopmathalignment

Summary

The instances of \startmathalignment ... \stopmathalignment are used for math alignments.

Instances

\startalign ... \stopalign
\startmathalignment ... \stopmathalignment

Settings instance

\startMATHALIGNMENT[...=...,...] ... \stopMATHALIGNMENT
...=...,...inherits from \setupmathalignment

Description

Using \startmathalignment one can align mathematical equations similar to what is known from LaTeX's amsmath package. It is used inside formulas. The usage is straightforward:
\startformula
  \startmathalignment[...=...]
    \NC ... \NC ... \NR
  \stopmathalignment
\stopformula

As in tabular materials \NC is used as column separator and \NR as row separator. Whether the formula is numbered can be controlled by prefixing \placeformula to \startformula. This will place a single number vertically centred with respect to the equation. When all the subformulas should be numbered individually, one specifies number=auto.

There is a predefined shorthand for \startmathalignment which is \startalign to match the amsmath name. However, \startmathalignment should be preferred, as \startalign already has a different meaning outside math mode.


Examples

Example 1

To imitate certain LaTeX contructs (some might not yet work on the Wiki). More examples can be found in A. Mahajan, Display Math in ConTeXt, MAPS 34, 22–34 (2006).

  • align
\placeformula
\startformula
  \startmathalignment[number=auto]
    \NC v \NC= u + at, \NR
    \NC d \NC= ut + \frac{1}{2} at^2. \NR
  \stopmathalignment
\stopformula
  • gather
\placeformula
\startformula
  \startmathalignment[n=1,number=auto]
    \NC v = u + at, \NR
    \NC d = ut + \frac{1}{2} at^2. \NR
  \stopmathalignment
\stopformula
  • alignat
\placeformula
\startformula
  \startmathalignment
    [n=7,align={right,left,right,left,right,left,right}]
    \NC x_1 \NC + \NC x_2 \NC + \NC 6x_3 \NC = \NC 170, \NR
    \NC 3x_1 \NC - \NC 110x_2 \NC - \NC x_3 \NC = \NC 4, \NR
    \NC 14x_1 \NC + \NC 13x_2 \NC + \NC 10x_3 \NC = \NC 25. \NR
  \stopmathalignment
\stopformula

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: