Difference between revisions of "Math/basic"
(Initial writeup) |
|||
(35 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | + | = 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 <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 | + | {| border="1" |
− | \ | + | ! colspan="2" | Commonly Used Binary Operators |
+ | ! colspan="2" | Commonly used relation symbols | ||
+ | ! colspan="2" | Set Relations | ||
+ | |- | ||
+ | |{{cmd|pm}}||<context>$\pm$</context> | ||
+ | |{{cmd|leq}}||<context>$\leq$</context> | ||
+ | |{{cmd|subset}}||<context>$\subset$</context> | ||
+ | |- | ||
+ | |{{cmd|mp}}||<context>$\mp$</context> | ||
+ | |{{cmd|ll}}||<context>$\ll$</context> | ||
+ | |{{cmd|subseteq}}||<context>$\subseteq$</context> | ||
+ | |- | ||
+ | |{{cmd|times}}||<context>$\times$</context> | ||
+ | |{{cmd|geq}}||<context>$\geq$</context> | ||
+ | |{{cmd|supset}}||<context>$\supset$</context> | ||
+ | |- | ||
+ | |{{cmd|div}}||<context>$\div$</context> | ||
+ | |{{cmd|gg}}||<context>$\gg$</context> | ||
+ | |{{cmd|supseteq}}||<context>$\supseteq$</context> | ||
+ | |- | ||
+ | |{{cmd|ast}}||<context>$\ast$</context> | ||
+ | |{{cmd|equiv}}||<context>$\equiv$</context> | ||
+ | |{{cmd|cap}}||<context>$\cap$</context> | ||
+ | |- | ||
+ | |{{cmd|star}}||<context>$\star$</context> | ||
+ | |{{cmd|sim}}||<context>$\sim$</context> | ||
+ | |{{cmd|cup}}||<context>$\cup$</context> | ||
+ | |- | ||
+ | |{{cmd|bullet}}||<context>$\bullet$</context> | ||
+ | |{{cmd|simeq}}||<context>$\simeq$</context> | ||
+ | |{{code|\in}}||<context>$\in$</context> | ||
+ | |- | ||
+ | |{{cmd|circ}}||<context>$\circ$</context> | ||
+ | |{{cmd|approx}}||<context>$\approx$</context> | ||
+ | |- | ||
+ | |{{cmd|cdot}}||<context>$\cdot$</context> | ||
+ | |{{cmd|neq}}||<context>$\neq$</context> | ||
+ | |} | ||
+ | |||
+ | = Sums, products, integrals= | ||
+ | |||
+ | == Sums with {{cmd|sum}} == | ||
+ | |||
+ | <context source="yes"> | ||
+ | \setupbodyfont[14pt] | ||
+ | \framed[frame=off,align=normal]{% | ||
+ | \m{\sum_{k = 0}^{j + n} a_k = e^{a + b - c}} \blank[small] | ||
+ | \dm{\sum_{k = 0}^{j + n} a_k = e^{a + b - c}}} | ||
+ | </context> | ||
+ | |||
+ | == Products with {{cmd|prod}} == | ||
+ | |||
+ | <context source="yes"> | ||
+ | \setupbodyfont[14pt] | ||
+ | \framed[frame=off,align=normal]{% | ||
+ | \m{\prod_{i=a}^{b} f(i)} \blank[small] | ||
+ | \dm{\prod_{i=a}^{b} f(i)}} | ||
+ | </context> | ||
+ | |||
+ | ==Integrals with {{cmd|int}} == | ||
+ | |||
+ | <context source="yes"> | ||
+ | \setupbodyfont[14pt] | ||
+ | \framed[frame=off,align=normal]{% | ||
+ | \m{\int_a^b f(x) \dd x } \blank[small] | ||
+ | \dm{\int_a^b f(x) \dd x } \blank[small] | ||
+ | |||
+ | \setupmathematics[differentiald=upright] | ||
+ | \dm{\int_a^b f(x) \dd x } \blank[small] | ||
+ | } | ||
</context> | </context> | ||
− | + | = Greek Letters = | |
+ | |||
+ | To type the greek character ''α'' you can say <code>$\alpha$</code> which gives <context>$\alpha$</context>. If you have a utf enabled keyboard, you can also type the α directly and ConTeXt will correctly interpret it. For example, | ||
<texcode> | <texcode> | ||
Line 20: | Line 91: | ||
</texcode> | </texcode> | ||
− | ==subscript and | + | Here is a complete list of greek letters |
+ | |||
+ | {| border="1" | ||
+ | ! colspan="2" | lowercase greek letters | ||
+ | ! colspan="2" | variation | ||
+ | ! colspan="2" | uppercase greek letters | ||
+ | |- | ||
+ | |{{cmd|alpha}}||<context>$\alpha$</context> | ||
+ | |- | ||
+ | |{{cmd|beta}}||<context>$\beta$</context> | ||
+ | |- | ||
+ | |{{cmd|gamma}}||<context>$\gamma$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Gamma}}||<context>$\Gamma$</context> | ||
+ | |- | ||
+ | |{{cmd|delta}}||<context>$\delta$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Delta}}||<context>$\Delta$</context> | ||
+ | |- | ||
+ | |{{cmd|epsilon}}||<context>$\epsilon$</context> | ||
+ | |{{cmd|varepsilon}}||<context>$\varepsilon$</context> | ||
+ | |- | ||
+ | |{{cmd|zeta}}||<context>$\zeta$</context> | ||
+ | |- | ||
+ | |{{cmd|eta}}||<context>$\eta$</context> | ||
+ | |- | ||
+ | |{{cmd|theta}}||<context>$\theta$</context> | ||
+ | |{{cmd|vartheta}}||<context>$\vartheta$</context> | ||
+ | |{{cmd|Theta}}||<context>$\Theta$</context> | ||
+ | |- | ||
+ | |{{cmd|iota}}||<context>$\iota$</context> | ||
+ | |- | ||
+ | |{{cmd|kappa}}||<context>$\kappa$</context> | ||
+ | |- | ||
+ | |{{cmd|lambda}}||<context>$\lambda$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Lambda}}||<context>$\Lambda$</context> | ||
+ | |- | ||
+ | |{{cmd|mu}}||<context>$\mu$</context> | ||
+ | |- | ||
+ | |{{cmd|nu}}||<context>$\nu$</context> | ||
+ | |- | ||
+ | |{{cmd|xi}}||<context>$\xi$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Xi}}||<context>$\Xi$</context> | ||
+ | |- | ||
+ | |{{cmd|omicron}}||<context>$\omicron$</context> | ||
+ | |- | ||
+ | |{{cmd|pi}}||<context>$\pi$</context> | ||
+ | |{{cmd|varpi}}||<context>$\varpi$</context> | ||
+ | |{{cmd|Pi}}||<context>$\Pi$</context> | ||
+ | |- | ||
+ | |{{cmd|rho}}||<context>$\rho$</context> | ||
+ | |{{cmd|varrho}}||<context>$\varrho$</context> | ||
+ | |- | ||
+ | |{{cmd|sigma}}||<context>$\sigma$</context> | ||
+ | |{{cmd|varsigma}}||<context>$\varsigma$</context> | ||
+ | |{{cmd|Sigma}}||<context>$\Sigma$</context> | ||
+ | |- | ||
+ | |{{cmd|tau}}||<context>$\tau$</context> | ||
+ | |- | ||
+ | |{{cmd|upsilon}}||<context>$\upsilon$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Upsilon}}||<context>$\Upsilon$</context> | ||
+ | |- | ||
+ | |{{cmd|phi}}||<context>$\phi$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Phi}}||<context>$\Phi$</context> | ||
+ | |- | ||
+ | |{{cmd|chi}}||<context>$\chi$</context> | ||
+ | |- | ||
+ | |{{cmd|psi}}||<context>$\psi$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Psi}}||<context>$\Psi$</context> | ||
+ | |- | ||
+ | |{{cmd|omega}}||<context>$\omega$</context> | ||
+ | | | ||
+ | | | ||
+ | |{{cmd|Omega}}||<context>$\Omega$</context> | ||
+ | |} | ||
+ | |||
+ | =Subscript and superscript= | ||
+ | |||
+ | 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= | ||
+ | |||
+ | With <code>\usemodule[fnt-25]</code>, {{cmd|showmathfontcharacters}} produces a lengthy annotated catalogue. | ||
+ | Here is the first page: | ||
+ | |||
+ | <context width="13cm"> | ||
+ | \setuplayout[scale=0.8,width=13cm] | ||
+ | \usemodule[fnt-25] | ||
+ | \starttext | ||
+ | \showmathfontcharacters | ||
+ | \stoptext | ||
+ | </context> | ||
+ | |||
+ | In ConTeXt MkII, you can see the list of all math macros by {{cmd|showmathcharacters}}. | ||
+ | |||
+ | |||
+ | = Spacing= | ||
+ | |||
+ | TeX handles math spacing by breaking a formula into parts, and assigning each of those parts a role such as 'Ord' (a variable or number) or 'Rel' (equality, larger than, et cetera). For each combination of roles, it then looks up the spacing appropriate between them in a table. These are the roles: | ||
+ | |||
+ | {| class=wikitable | ||
+ | | Ord || e.g. ''4'' or ''a'' or ''x<sup>2</sup>'' | ||
+ | |- | ||
+ | | Op || Unary operators such as ''sin'' or ''ln''. | ||
+ | |- | ||
+ | | Bin || Binary operators such as '+' | ||
+ | |- | ||
+ | | Rel || Relationships such as '=' or '>' or '\implies' | ||
+ | |- | ||
+ | | Open || open brackets of any kind | ||
+ | |- | ||
+ | | Close || closing brackets of any kind | ||
+ | |- | ||
+ | | Punct || Punctuation: digit separators like '.' or ','. | ||
+ | |- | ||
+ | | Inner || Fractions are inner. What else is inner? | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | To set up e.g. the spacing between ordinal items, do as follows (since dec 2012): | ||
+ | |||
+ | \startsetups math:morespacing | ||
+ | \ordordspacing\textstyle 1mu plus .5mu minus .25mu\relax | ||
+ | \stopsetups | ||
− | + | \setupmathematics | |
+ | [setups=math:morespacing] | ||
+ | [[Category:Math]] |
Latest revision as of 20:09, 12 May 2024
Contents
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 |
Sums, products, integrals
Sums with \sum
\setupbodyfont[14pt] \framed[frame=off,align=normal]{% \m{\sum_{k = 0}^{j + n} a_k = e^{a + b - c}} \blank[small] \dm{\sum_{k = 0}^{j + n} a_k = e^{a + b - c}}}
Products with \prod
\setupbodyfont[14pt] \framed[frame=off,align=normal]{% \m{\prod_{i=a}^{b} f(i)} \blank[small] \dm{\prod_{i=a}^{b} f(i)}}
Integrals with \int
\setupbodyfont[14pt] \framed[frame=off,align=normal]{% \m{\int_a^b f(x) \dd x } \blank[small] \dm{\int_a^b f(x) \dd x } \blank[small] \setupmathematics[differentiald=upright] \dm{\int_a^b f(x) \dd x } \blank[small] }
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 superscript
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
With \usemodule[fnt-25]
, \showmathfontcharacters produces a lengthy annotated catalogue.
Here is the first page:
In ConTeXt MkII, you can see the list of all math macros by \showmathcharacters.
Spacing
TeX handles math spacing by breaking a formula into parts, and assigning each of those parts a role such as 'Ord' (a variable or number) or 'Rel' (equality, larger than, et cetera). For each combination of roles, it then looks up the spacing appropriate between them in a table. These are the roles:
Ord | e.g. 4 or a or x2 |
Op | Unary operators such as sin or ln. |
Bin | Binary operators such as '+' |
Rel | Relationships such as '=' or '>' or '\implies' |
Open | open brackets of any kind |
Close | closing brackets of any kind |
Punct | Punctuation: digit separators like '.' or ','. |
Inner | Fractions are inner. What else is inner? |
To set up e.g. the spacing between ordinal items, do as follows (since dec 2012):
\startsetups math:morespacing \ordordspacing\textstyle 1mu plus .5mu minus .25mu\relax \stopsetups
\setupmathematics [setups=math:morespacing]