Changes

Jump to navigation Jump to search
1,396 bytes removed ,  05:12, 23 July 2006
m
remove duplicated code.
< [[Math]]
This set of math examples is taken from the comments in the [[source:core-mat.tex|core-mat.tex]] file, which contains most of the core ConTeXt math macros. The <tt>textwidth</tt> has been set to 8 cm in these examples so that the page isn't too wide (see [[Layout]] and <cmd>setuplayout</cmd> for further information specific to layout).
----
In the next examples we explicitly align formulas to the left (<cmd>raggedleft</cmd>), center and right (<cmd>raggedright</cmd>):
<texcode>\setupformulas[align=left]\startformula c^2 = a^2 + b^2 \stopformula\setupformulas[align=middle]\startformula c^2 context source= a^2 + b^2 \stopformula\setupformulas[align"yes" text=right]\startformula c^2 = a^2 + b^2 \stopformula</texcode> "Or in print: <context">
\setuplayout[textwidth=8cm]
\setupformulas[align=left]
</context>
With formula numbers these formulas look as followsthe code is:
<contextsource="yes" text="And the formulas look like:">
\setuplayout[textwidth=8cm]
\setupformulas[align=left]
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</context>
 
This was keyed in as:
 
<texcode>
\setupformulas[align=left]
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
\setupformulas[align=middle]
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
\setupformulas[align=right]
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</texcode>
When tracing is turned on (<cmd>tracemathtrue</cmd>) you can visualize the bounding box of the formula,
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:
<texcode>\setupformulas[align=middle,strutcontext source="yes]\tracemathtrue\placeformula \startformula c^2 " text= a^2 + b^2 \stopformula</texcode> "This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.] <context">
\setuplayout[textwidth=8cm]
\setupformulas[align=middle,strut=yes]
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space
<texcode>\tracemathtrue\setupformulas[align=middle]\startformula c^2 = a^2 + b^2 \stopformula\placeformula \startformula c^2 context source= a^2 + b^2 \stopformula</texcode> <context"yes">
\setuplayout[textwidth=8cm]
\tracemathtrue
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.
<texcode>Some example text, again, to show where the right and left margins of the text block are.\tracemathtrue\setupformulas[aligncontext source=right,leftmargin=3em]\startformula c^2 = a^2 + b^2 \stopformula\placeformula \startformula c^2 = a^2 + b^2 \stopformula \setupformulas[align=left,rightmargin=1em]\startformula c^2 = a^2 + b^2 \stopformula\placeformula \startformula c^2 = a^2 + b^2 \stopformula</texcode> <context"yes">
\setuplayout[textwidth=8cm]
Some example text, again, to show where the right and left margins of the text block are.
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</context>
 
You can also inherit the margin from the environment.
<texcode>Some example text, again, to show where the right and left margins of the text block are.\tracemathtrue\setupformulas[aligncontext source=right,margin=standard]\startformula c^2 = a^2 + b^2 \stopformula\placeformula \startformula c^2 = a^2 + b^2 \stopformula</texcode> <context"yes">
\setuplayout[textwidth=8cm]
Some example text, again, to show where the right and left margins of the text block are.
The distance between the formula and the number is only applied when the formula is left or right aligned.
<texcode>\tracemathtrue\setupformulas[aligncontext source=left,distance=2em]\startformula c^2 = a^2 + b^2 \stopformula\placeformula \startformula c^2 = a^2 + b^2 \stopformula</texcode> <context"yes">
\setuplayout[textwidth=8cm]
\tracemathtrue
6

edits

Navigation menu