Difference between revisions of "mathstackers"
(Created page with "== mathstackers == ConTeXt has a nice structure in order to define new math commands in which some characters are stacked over another one. A typical example is when you want to...") |
|||
Line 1: | Line 1: | ||
== mathstackers == | == mathstackers == | ||
− | ConTeXt has a nice structure in order to define new math commands in which some characters are stacked over another one. | + | ConTeXt has a nice structure called {{code|1=mathstackers}} in order to define new math commands in which some characters are stacked over another one. For more information refer to {{src|math-stc.mkiv}}. |
+ | |||
+ | The two command {{code|1=\mathover[symbol]{}{}}} and {{code|\mathunder[symbol]{}{}}} are built and can be used directly. However one may define one's own commands. | ||
+ | |||
A typical example is when you want to put a small circle on top of a letter (as one would when defining the topological interior of a set…). | A typical example is when you want to put a small circle on top of a letter (as one would when defining the topological interior of a set…). | ||
− | To do so we define first a new stacker named here {{code| | + | To do so we define first a new stacker named here {{code|1=MySymbol}}, and then invoking that with {{code|1=\definemathover}} we define two new commands {{code|1=\interior}} and {{code|1=\mystarred}} which can be used in math mode. |
+ | <texcode> | ||
\definemathstackers[MySymbol] | \definemathstackers[MySymbol] | ||
[voffset=-.3\mathexheight, | [voffset=-.3\mathexheight, | ||
Line 12: | Line 16: | ||
middlecommand=\mathematics] | middlecommand=\mathematics] | ||
− | + | \definemathover[MySymbol][interior]["2218] %this a small circle | |
− | \definemathover[MySymbol][interior]["2218] | + | \definemathover[MySymbol][mystarred]["2717] % this is an asterisk |
− | \definemathover[MySymbol][ | ||
\starttext | \starttext | ||
− | + | Here is the new command \type{\interior{K}}: $\interior{K}$. Compare this to \type{\mathring{K}}: $\mathring{K}$. | |
+ | |||
+ | Here is the new command \type{\mystarred{K}}: $\mystarred{K}$. | ||
− | Here | + | Here are the built-in commands \type{\mathover} and \type{\mathunder}: |
+ | |||
+ | $\mathover[symbol]{"2217}{A}$, % 2217 is a circle | ||
+ | $\mathover[symbol]{"2218}{A}$, % 2218 is an asterisk | ||
+ | $\mathover[symbol]{"2219}{A}$, % 2219 is a bullet | ||
+ | $\mathunder[symbol]{"2217}{A}$, | ||
+ | $\mathunder[symbol]{"2218}{A}$, | ||
+ | $\mathunder[symbol]{"2219}{A}$. | ||
− | |||
\stoptext | \stoptext | ||
+ | </texcode> | ||
+ | When typeset in {{code|1=mkiv}} one can see that the command {{code|1=\interior{K}}} shows the letter K with a small circle above it. |
Revision as of 13:36, 30 August 2017
mathstackers
ConTeXt has a nice structure called mathstackers
in order to define new math commands in which some characters are stacked over another one. For more information refer to math-stc.mkiv.
The two command \mathover[symbol]{}{
} and \mathunder[symbol]{}{
} are built and can be used directly. However one may define one's own commands.
A typical example is when you want to put a small circle on top of a letter (as one would when defining the topological interior of a set…).
To do so we define first a new stacker named here MySymbol
, and then invoking that with \definemathover
we define two new commands \interior
and \mystarred
which can be used in math mode.
\definemathstackers[MySymbol] [voffset=-.3\mathexheight, hoffset=\zeropoint, mathclass=ord, topoffset=.4\mathemwidth, % poor man's italic correction middlecommand=\mathematics] \definemathover[MySymbol][interior]["2218] %this a small circle \definemathover[MySymbol][mystarred]["2717] % this is an asterisk \starttext Here is the new command \type{\interior{K}}: $\interior{K}$. Compare this to \type{\mathring{K}}: $\mathring{K}$. Here is the new command \type{\mystarred{K}}: $\mystarred{K}$. Here are the built-in commands \type{\mathover} and \type{\mathunder}: $\mathover[symbol]{"2217}{A}$, % 2217 is a circle $\mathover[symbol]{"2218}{A}$, % 2218 is an asterisk $\mathover[symbol]{"2219}{A}$, % 2219 is a bullet $\mathunder[symbol]{"2217}{A}$, $\mathunder[symbol]{"2218}{A}$, $\mathunder[symbol]{"2219}{A}$. \stoptext
When typeset in mkiv
one can see that the command \interior{K
} shows the letter K with a small circle above it.