Changes

Jump to navigation Jump to search
3,799 bytes added ,  20:42, 28 April 2007
</context>
</td></tr></table>
 
== Changing Formula alignment ==
 
Normally a formula is centered, but in case you want to align it left or right, you can set up formulas to behave
that way. Normally a formula will adapt its left indentation to the environment:
 
<context>
\setuplayout[textwidth=8cm]
This is a bit of text for purpose of example.\epar
\startitemize
\item This is some other example text.\epar
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
\item This is yet other example text.\epar
\stopitemize
This is a bit more text for other purpose of example.\epar
</context>
 
In the next examples we explicitly align formulas to the left (<cmd>raggedleft</cmd>), center and right (<cmd>raggedright</cmd>):
 
<context source="yes" text="Or in print:">
\setuplayout[textwidth=8cm]
\setupformulas[align=left]
\startformula c^2 = a^2 + b^2 \stopformula
\setupformulas[align=middle]
\startformula c^2 = a^2 + b^2 \stopformula
\setupformulas[align=right]
\startformula c^2 = a^2 + b^2 \stopformula
</context>
 
With formula numbers the code is:
 
<context source="yes" text="And the formulas look like:">
\setuplayout[textwidth=8cm]
\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
</context>
 
When tracing is turned on (<cmd>tracemathtrue</cmd>) you can visualize the bounding box of the formula,
 
<context>
\setuplayout[textwidth=8cm]
\tracemathtrue
\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
</context>
 
As you can see, the dimensions are the natural ones, but if needed you can force a normalized line:
 
<context source="yes" text="This time we get a more spacy result. [Ed. Note: For this example equation, there appears to be no visible change.]">
\setuplayout[textwidth=8cm]
\setupformulas[align=middle,strut=yes]
\tracemathtrue
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</context>
 
We will now show a couple of more settings and combinations of settings. In centered formulas, the number takes no space
 
<context source="yes">
\setuplayout[textwidth=8cm]
\tracemathtrue
\setupformulas[align=middle]
\startformula c^2 = a^2 + b^2 \stopformula
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</context>
 
You can influence the placement of the whole box with the parameters <tt>leftmargin</tt> and <tt>rightmargin</tt>.
 
<context source="yes">
\setuplayout[textwidth=8cm]
Some example text, again, to show where the right and left margins of the text block are.
\tracemathtrue
\setupformulas[align=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
</context>
 
You can also inherit the margin from the environment.
 
<context source="yes">
\setuplayout[textwidth=8cm]
Some example text, again, to show where the right and left margins of the text block are.
\tracemathtrue
\setupformulas[align=right,margin=standard]
\startformula c^2 = a^2 + b^2 \stopformula
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</context>
 
The distance between the formula and the number is only applied when the formula is left or right aligned.
 
<context source="yes">
\setuplayout[textwidth=8cm]
\tracemathtrue
\setupformulas[align=left,distance=2em]
\startformula c^2 = a^2 + b^2 \stopformula
\placeformula \startformula c^2 = a^2 + b^2 \stopformula
</context>
= Referencing formulae =

Navigation menu