Difference between revisions of "Math/basic"

From Wiki
Jump to navigation Jump to search
(Added some more details ... moved things around)
m (→‎Introduction: Added \m as an inline math command)
 
(12 intermediate revisions by 6 users not shown)
Line 3: Line 3:
 
== Introduction ==
 
== Introduction ==
  
To tell TeX that an expression needs to be typeset using conventions for math, type the expression in <code>$</code>...<code>$</code>. For examples <code>$x$</code> gives <context>$x$</context>, while <code>$2$</code> gives <context>$2$</context>. Notice that the ''x'' is in italic while the ''2'' is upright. This is the usual mathematic convention. You can also write in the math mode using the command <cmd>math</cmd> or <cmd>mathematics</cmd>.
+
To tell TeX that an expression needs to be typeset using conventions for math, type the expression in <code>$</code>...<code>$</code>. For examples <code>$x$</code> gives  
 +
<context>\setuplayout[scale=0.8]$x$</context>, while <code>$2$</code> gives <context>\setuplayout[scale=0.8]$2$</context>. Notice that the ''x'' is in italic while the ''2'' is upright. This is the usual mathematic convention. You can also write in the math mode using the commands {{cmd|m}}, {{cmd|math}} or {{cmd|mathematics}}.
 +
 
 +
Thus, the following four are equivalent. Use the style that you prefer.
 +
 
 +
<texcode>
 +
Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results
 +
</texcode>
 +
 
 +
<texcode>
 +
Pythagoras formula, stating \m{a^2 + b^2 = c^2} was one of the first trigonometric results
 +
</texcode>
 +
 
 +
<texcode>
 +
Pythagoras formula, stating \math{a^2 + b^2 = c^2} was one of the first trigonometric results
 +
</texcode>
 +
 
 +
<texcode>
 +
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results
 +
</texcode>
 +
and gives
 +
<context>
 +
\setuplayout[scale=0.8,width=13cm]
 +
Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results
 +
</context>
  
 
== Binary Operators Relations==
 
== Binary Operators Relations==
Line 11: Line 35:
 
   + - = < >
 
   + - = < >
  
A general expressions can be input in the natural manner. For example <code>$x+y$</code> gives <context>$x+y$</context>. Notice that TeX took care of the spacing around <code>+</code>. Mathematicians use a lot of symbols that are not avialable on the keyboard. TeX (and ConTeXt) provide macros to input them. For example <code>$x \times y$</code> gives <context>$x \times y$
+
A general expressions can be input in the natural manner. For example <code>$x+y$</code> gives <context>\setuplayout[scale=0.8]$x+y$</context>. Notice that TeX took care of the spacing around <code>+</code>. Mathematicians use a lot of symbols that are not avialable on the keyboard. TeX (and ConTeXt) provide macros to input them. For example <code>$x \times y$</code> gives <context>\setuplayout[scale=0.8]$x \times y$
 
</context>. The following is a parial list of frequently used binary operators and  relations.
 
</context>. The following is a parial list of frequently used binary operators and  relations.
  
Line 19: Line 43:
 
! colspan="2" | Set Relations
 
! colspan="2" | Set Relations
 
|-
 
|-
|<cmd>pm</cmd>||<context>$\pm$</context>
+
|{{cmd|pm}}||<context>$\pm$</context>
|<cmd>leq</cmd>||<context>$\leq$</context>
+
|{{cmd|leq}}||<context>$\leq$</context>
|<cmd>subset</cmd>||<context>$\subset$</context>
+
|{{cmd|subset}}||<context>$\subset$</context>
 
|-
 
|-
|<cmd>mp</cmd>||<context>$\mp$</context>
+
|{{cmd|mp}}||<context>$\mp$</context>
|<cmd>ll</cmd>||<context>$\ll$</context>
+
|{{cmd|ll}}||<context>$\ll$</context>
|<cmd>subseteq</cmd>||<context>$\subseteq$</context>
+
|{{cmd|subseteq}}||<context>$\subseteq$</context>
 
|-
 
|-
|<cmd>times</cmd>||<context>$\times$</context>
+
|{{cmd|times}}||<context>$\times$</context>
|<cmd>geq</cmd>||<context>$\geq$</context>
+
|{{cmd|geq}}||<context>$\geq$</context>
|<cmd>supset</cmd>||<context>$\supset$</context>
+
|{{cmd|supset}}||<context>$\supset$</context>
 
|-
 
|-
|<cmd>div</cmd>||<context>$\div$</context>
+
|{{cmd|div}}||<context>$\div$</context>
|<cmd>gg</cmd>||<context>$\gg$</context>
+
|{{cmd|gg}}||<context>$\gg$</context>
|<cmd>supseteq</cmd>||<context>$\supseteq$</context>
+
|{{cmd|supseteq}}||<context>$\supseteq$</context>
 
|-
 
|-
|<cmd>ast</cmd>||<context>$\ast$</context>
+
|{{cmd|ast}}||<context>$\ast$</context>
|<cmd>equiv</cmd>||<context>$\equiv$</context>
+
|{{cmd|equiv}}||<context>$\equiv$</context>
|<cmd>cap</cmd>||<context>$\cap$</context>
+
|{{cmd|cap}}||<context>$\cap$</context>
 
|-
 
|-
|<cmd>star</cmd>||<context>$\star$</context>
+
|{{cmd|star}}||<context>$\star$</context>
|<cmd>sim</cmd>||<context>$\sim$</context>
+
|{{cmd|sim}}||<context>$\sim$</context>
|<cmd>cup</cmd>||<context>$\cup$</context>
+
|{{cmd|cup}}||<context>$\cup$</context>
 
|-
 
|-
|<cmd>bullet</cmd>||<context>$\bullet$</context>
+
|{{cmd|bullet}}||<context>$\bullet$</context>
|<cmd>simeq</cmd>||<context>$\simeq$</context>
+
|{{cmd|simeq}}||<context>$\simeq$</context>
 +
|{{code|\in}}||<context>$\in$</context>
 
|-
 
|-
|<cmd>circ</cmd>||<context>$\circ$</context>
+
|{{cmd|circ}}||<context>$\circ$</context>
|<cmd>approx</cmd>||<context>$\approx$</context>
+
|{{cmd|approx}}||<context>$\approx$</context>
 
|-
 
|-
|<cmd>cdot</cmd>||<context>$\cdot$</context>
+
|{{cmd|cdot}}||<context>$\cdot$</context>
|<cmd>neq</cmd>||<context>$\neq$</context>
+
|{{cmd|neq}}||<context>$\neq$</context>
 
|}
 
|}
 
  
 
== Greek Letters ==
 
== Greek Letters ==
Line 71: Line 95:
 
! colspan="2" | uppercase greek letters
 
! colspan="2" | uppercase greek letters
 
|-
 
|-
|<cmd>alpha</cmd>||<context>$\alpha$</context>
+
|{{cmd|alpha}}||<context>$\alpha$</context>
 
|-
 
|-
|<cmd>beta</cmd>||<context>$\beta$</context>
+
|{{cmd|beta}}||<context>$\beta$</context>
 
|-
 
|-
|<cmd>gamma</cmd>||<context>$\gamma$</context>
+
|{{cmd|gamma}}||<context>$\gamma$</context>
 
|
 
|
 
|
 
|
|<cmd>Gamma</cmd>||<context>$\Gamma$</context>
+
|{{cmd|Gamma}}||<context>$\Gamma$</context>
 
|-
 
|-
|<cmd>delta</cmd>||<context>$\delta$</context>
+
|{{cmd|delta}}||<context>$\delta$</context>
 
|
 
|
 
|
 
|
|<cmd>Delta</cmd>||<context>$\Delta$</context>
+
|{{cmd|Delta}}||<context>$\Delta$</context>
 
|-
 
|-
|<cmd>epsilon</cmd>||<context>$\epsilon$</context>
+
|{{cmd|epsilon}}||<context>$\epsilon$</context>
|<cmd>varepsilon</cmd>||<context>$\varepsilon$</context>
+
|{{cmd|varepsilon}}||<context>$\varepsilon$</context>
 
|-
 
|-
|<cmd>zeta</cmd>||<context>$\zeta$</context>
+
|{{cmd|zeta}}||<context>$\zeta$</context>
 
|-
 
|-
|<cmd>eta</cmd>||<context>$\eta$</context>
+
|{{cmd|eta}}||<context>$\eta$</context>
 
|-
 
|-
|<cmd>theta</cmd>||<context>$\theta$</context>
+
|{{cmd|theta}}||<context>$\theta$</context>
|<cmd>vartheta</cmd>||<context>$\vartheta$</context>
+
|{{cmd|vartheta}}||<context>$\vartheta$</context>
|<cmd>Theta</cmd>||<context>$\Theta$</context>
+
|{{cmd|Theta}}||<context>$\Theta$</context>
 
|-
 
|-
|<cmd>iota</cmd>||<context>$\iota$</context>
+
|{{cmd|iota}}||<context>$\iota$</context>
 
|-
 
|-
|<cmd>kappa</cmd>||<context>$\kappa$</context>
+
|{{cmd|kappa}}||<context>$\kappa$</context>
 
|-
 
|-
|<cmd>lambda</cmd>||<context>$\lambda$</context>
+
|{{cmd|lambda}}||<context>$\lambda$</context>
 
|
 
|
 
|
 
|
|<cmd>Lambda</cmd>||<context>$\Lambda$</context>
+
|{{cmd|Lambda}}||<context>$\Lambda$</context>
 
|-
 
|-
|<cmd>mu</cmd>||<context>$\mu$</context>
+
|{{cmd|mu}}||<context>$\mu$</context>
 
|-
 
|-
|<cmd>nu</cmd>||<context>$\nu$</context>
+
|{{cmd|nu}}||<context>$\nu$</context>
 
|-
 
|-
|<cmd>xi</cmd>||<context>$\xi$</context>
+
|{{cmd|xi}}||<context>$\xi$</context>
 
|
 
|
 
|
 
|
|<cmd>Xi</cmd>||<context>$\Xi$</context>
+
|{{cmd|Xi}}||<context>$\Xi$</context>
 
|-
 
|-
|<cmd>omicron</cmd>||<context>$\omicron$</context>
+
|{{cmd|omicron}}||<context>$\omicron$</context>
 
|-
 
|-
|<cmd>pi</cmd>||<context>$\pi$</context>
+
|{{cmd|pi}}||<context>$\pi$</context>
|<cmd>varpi</cmd>||<context>$\varpi$</context>
+
|{{cmd|varpi}}||<context>$\varpi$</context>
|<cmd>Pi</cmd>||<context>$\Pi$</context>
+
|{{cmd|Pi}}||<context>$\Pi$</context>
 
|-
 
|-
|<cmd>rho</cmd>||<context>$\rho$</context>
+
|{{cmd|rho}}||<context>$\rho$</context>
|<cmd>varrho</cmd>||<context>$\varrho$</context>
+
|{{cmd|varrho}}||<context>$\varrho$</context>
 
|-
 
|-
|<cmd>sigma</cmd>||<context>$\sigma$</context>
+
|{{cmd|sigma}}||<context>$\sigma$</context>
|<cmd>varsigma</cmd>||<context>$\varsigma$</context>
+
|{{cmd|varsigma}}||<context>$\varsigma$</context>
|<cmd>Sigma</cmd>||<context>$\Sigma$</context>
+
|{{cmd|Sigma}}||<context>$\Sigma$</context>
 
|-
 
|-
|<cmd>tau</cmd>||<context>$\tau$</context>
+
|{{cmd|tau}}||<context>$\tau$</context>
 
|-
 
|-
|<cmd>upsilon</cmd>||<context>$\upsilon$</context>
+
|{{cmd|upsilon}}||<context>$\upsilon$</context>
 
|
 
|
 
|
 
|
|<cmd>Upsilon</cmd>||<context>$\Upsilon$</context>
+
|{{cmd|Upsilon}}||<context>$\Upsilon$</context>
 
|-
 
|-
|<cmd>phi</cmd>||<context>$\phi$</context>
+
|{{cmd|phi}}||<context>$\phi$</context>
 
|
 
|
 
|
 
|
|<cmd>Phi</cmd>||<context>$\Phi$</context>
+
|{{cmd|Phi}}||<context>$\Phi$</context>
 
|-
 
|-
|<cmd>chi</cmd>||<context>$\chi$</context>
+
|{{cmd|chi}}||<context>$\chi$</context>
 
|-
 
|-
|<cmd>psi</cmd>||<context>$\psi$</context>
+
|{{cmd|psi}}||<context>$\psi$</context>
 
|
 
|
 
|
 
|
|<cmd>Psi</cmd>||<context>$\Psi$</context>
+
|{{cmd|Psi}}||<context>$\Psi$</context>
 
|-
 
|-
|<cmd>omega</cmd>||<context>$\omega$</context>
+
|{{cmd|omega}}||<context>$\omega$</context>
 
|
 
|
 
|
 
|
|<cmd>Omega</cmd>||<context>$\Omega$</context>
+
|{{cmd|Omega}}||<context>$\Omega$</context>
 
|}
 
|}
  
Line 156: Line 180:
 
==subscript and superscipt==
 
==subscript and superscipt==
  
TeX uses <code>^</code> and <code>_</code> to denote superscipts and subscipts. It is perhaps easiest to explain this by means of some examples. <context>$x_{10}^{15}$</context> is written as <code>$x_{10}^{15}$</code> or <code>$x^{15}_{10}$</code>. The order in which <code>_</code> and <code>^</code> are given does not matter. One can also type complicated expressions like <context>$a_{b_{c_{d_{e}}}}$</context> as <code>$a_{b_{c_{d_{e}}}}$</code>.
+
TeX uses <code>^</code> and <code>_</code> to denote superscipts and subscipts. It is perhaps easiest to explain this by means of some examples. <context>\setuplayout[scale=0.8]$x_{10}^{15}$</context> is written as <code>$x_{10}^{15}$</code> or <code>$x^{15}_{10}$</code>. The order in which <code>_</code> and <code>^</code> are given does not matter. One can also type complicated expressions like <context>\setuplayout[scale=0.8]$a_{b_{c_{d_{e}}}}$</context> as <code>$a_{b_{c_{d_{e}}}}$</code>.
  
 +
To align superscripts and subscripts one after the other (not above/below each other), add empty braces <code>{}</code> after each of them as <code>$T^a{}_b{}^c{}$</code> to obtain <context>\setuplayout[scale=0.8]$T^a{}_b{}^c{}$</context>. This effectively adds each index as superscript/subscript of the empty braces rather than the main character, thus aligning them separately and avoiding double superscript errors.
  
 
== List of All Math macros ==
 
== List of All Math macros ==
In ConTeXt, you can see the list of all math macros by <cmd>showmathcharacters</cmd>
+
In ConTeXt MkII, you can see the list of all math macros by {{cmd|showmathcharacters}}.
 +
In MkIV, \usemodule[fnt-25] followed by {{cmd|showmathfontcharacters}} produces a lengthy annotated catalogue.
  
 
Here is the first page of this list
 
Here is the first page of this list
  
 
<context width="13cm">
 
<context width="13cm">
 +
\setuplayout[scale=0.8,width=13cm]
 
\showmathcharacters
 
\showmathcharacters
 
</context>
 
</context>
 +
 +
[[Category:Math]]

Latest revision as of 10:55, 13 April 2021

<Math |

Introduction

To tell TeX that an expression needs to be typeset using conventions for math, type the expression in $...$. For examples $x$ gives , while $2$ gives . Notice that the x is in italic while the 2 is upright. This is the usual mathematic convention. You can also write in the math mode using the commands \m, \math or \mathematics.

Thus, the following four are equivalent. Use the style that you prefer.

Pythagoras formula, stating $a^2 + b^2 = c^2$ was one of the first trigonometric results
Pythagoras formula, stating \m{a^2 + b^2 = c^2} was one of the first trigonometric results
Pythagoras formula, stating \math{a^2 + b^2 = c^2} was one of the first trigonometric results
Pythagoras formula, stating \mathematics{a^2 + b^2 = c^2} was one of the first trigonometric results

and gives

Binary Operators Relations

Basic binary symbols can be produced by typing the correspoding keyboard character. These include

 + - = < >

A general expressions can be input in the natural manner. For example $x+y$ gives . Notice that TeX took care of the spacing around +. Mathematicians use a lot of symbols that are not avialable on the keyboard. TeX (and ConTeXt) provide macros to input them. For example $x \times y$ gives . The following is a parial list of frequently used binary operators and relations.

Commonly Used Binary Operators Commonly used relation symbols Set Relations
\pm \leq \subset
\mp \ll \subseteq
\times \geq \supset
\div \gg \supseteq
\ast \equiv \cap
\star \sim \cup
\bullet \simeq \in
\circ \approx
\cdot \neq

Greek Letters

To type the greek character α you can say $\alpha$ which gives . If you have a utf enabled keyboard, you can also type the α directly and ConTeXt will correctly interpret it. For example,

\enableregime[utf]

Here is some Greek math $α^2 + β^2 = γ^2$

Here is a complete list of greek letters

lowercase greek letters variation uppercase greek letters
\alpha
\beta
\gamma \Gamma
\delta \Delta
\epsilon \varepsilon
\zeta
\eta
\theta \vartheta \Theta
\iota
\kappa
\lambda \Lambda
\mu
\nu
\xi \Xi
\omicron
\pi \varpi \Pi
\rho \varrho
\sigma \varsigma \Sigma
\tau
\upsilon \Upsilon
\phi \Phi
\chi
\psi \Psi
\omega \Omega


subscript and superscipt

TeX uses ^ and _ to denote superscipts and subscipts. It is perhaps easiest to explain this by means of some examples. is written as $x_{10}^{15}$ or $x^{15}_{10}$. The order in which _ and ^ are given does not matter. One can also type complicated expressions like as $a_{b_{c_{d_{e}}}}$.

To align superscripts and subscripts one after the other (not above/below each other), add empty braces {} after each of them as $T^a{}_b{}^c{}$ to obtain . This effectively adds each index as superscript/subscript of the empty braces rather than the main character, thus aligning them separately and avoiding double superscript errors.

List of All Math macros

In ConTeXt MkII, you can see the list of all math macros by \showmathcharacters. In MkIV, \usemodule[fnt-25] followed by \showmathfontcharacters produces a lengthy annotated catalogue.

Here is the first page of this list