## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "TeXmacs/doc/devel/source/maths.en.tm" betweenTeXmacs-1.99.8-src.tar.gz and TeXmacs-1.99.9-src.tar.gz

About: GNU TeXmacs is a what-you-see-is-what-you-get scientific text editor, which was both inspired by TeX and GNU Emacs.

maths.en.tm  (TeXmacs-1.99.8-src):maths.en.tm  (TeXmacs-1.99.9-src)
<TeXmacs|1.> <TeXmacs|1.99.8>
<style|<tuple|tmdoc|english>> <style|<tuple|tmdoc|english|old-spacing>>
<\body> <\body>
<tmdoc-title|Mathematical typesetting> <tmdoc-title|Mathematical typesetting>
<section|Introduction> <section|Introduction>
In this chapter we describe the algorithms used by <TeXmacs> in order to In this chapter we describe the algorithms used by <TeXmacs> in order to
typeset mathematical formulas. This is a difficult subject, because typeset mathematical formulas. This is a difficult subject, because
esthetics and effectiveness do not always go hand in hand. Until now, <TeX> esthetics and effectiveness do not always go hand in hand. Until now, <TeX>
is widely accepted for having achieved an optimal compromise in this is widely accepted for having achieved an optimal compromise in this
respect. Nevertheless, we thought that several improvements could still be respect. Nevertheless, we thought that several improvements could still be
made, which have now been implemented in <TeXmacs>. We will shortly made, which have now been implemented in <TeXmacs>. We will shortly
describe the motivations behind them. describe the motivations behind them.
In order to obtain esthetic formulas, what criteria should we use? It is In order to obtain esthetic formulas, what criteria should we use? It is
often stressed that good typesetting allows the reader to concentrate on often stressed that good typesetting allows the reader to concentrate on
what he reads, without being distracted by ugly typesetting details. Such what he reads, without being distracted by ugly typesetting details. Such
distracting details arise when distinct, though similar parts of text are distracting details arise when distinct, though similar parts of text are
typeset in a non uniform way: typeset in a non uniform way:
<\description> <\description>
<item*|Different base lines>The eye expects text of a similar nature to <item*|Different base lines>The eye expects text of a similar nature to
be typeset with respect to a same base line. For instance, in be typeset with respect to a same base line. For instance, in
<math|x+y+z>, the bottoms of the <math|x> and <math|z> should be at the <math|x+y+z>, the bottoms of the <math|x> and <math|z> should be at the
same height as the bottom of the <math|u>-part in the <math|y>. This same height as the bottom of the <math|u>-part in the <math|y>. This
should again be the case in <math|2<rsup|x>+2<rsup|y>+2<rsup|z>>. should again be the case in <math|2<rsup|x>+2<rsup|y>+2<rsup|z>>.
<item*|Unequal spacing>Different components of text with approximately <item*|Unequal spacing>Different components of text with approximately
the same function should be separated by equal amounts of space. For the same function should be separated by equal amounts of space. For
instance, in <math|a<rsup|2>+f<rsup|2>>, the typesetter should notice the instance, in <math|a<rsup|2>+f<rsup|2>>, the typesetter should notice the
hangover of the <math|f>. This should again be the case in hangover of the <math|f>. This should again be the case in
<math|e<rsup|a>+e<rsup|f>+e<rsup|x>>. Similarly, the distance between the <math|e<rsup|a>+e<rsup|f>+e<rsup|x>>. Similarly, the distance between the
baselines of the <math|a> and the <math|i> in <math|a<rsub|i>> should not baselines of the <math|a> and the <math|i> in <math|a<rsub|i>> should not
be disproportially large with respect to the height of an <math|x>. be disproportionally large with respect to the height of an <math|x>.
</description> </description>
Additional difficulties may arise when considering automatically generated Additional difficulties may arise when considering automatically generated
formulas, in which case line breaking has to be dealt with in a formulas, in which case line breaking has to be dealt with in a
satisfactory way. satisfactory way.
Unfortunately, the different esthetic criteria may enter into conflict with Unfortunately, the different esthetic criteria may enter into conflict with
each other. For instance, consider the formula each other. For instance, consider the formula
<math|x<rsub|p>+x<rsub|p><rsup|2>>. On the one hand, the baselines of the <math|x<rsub|p>+x<rsub|p><rsup|2>>. On the one hand, the baselines of the
scripts should be the same, but the other hand, the first subscript should scripts should be the same, but the other hand, the first subscript should
not be with respect to the <math|x>. not be \Pdisproportionally low\Q with respect to the <math|x>.
Unfortunately, this dilemma can not been solved in a completely Unfortunately, this dilemma can not been solved in a completely
satisfactory way without the help of a human for the simple reason that the satisfactory way without the help of a human for the simple reason that the
computer has no way to know whether the <math|x<rsub|p>> and computer has no way to know whether the <math|x<rsub|p>> and
<math|x<rsub|p><rsup|i>> are . Indeed, if the <math|x<rsub|p>> <math|x<rsub|p><rsup|i>> are \Prelated\Q. Indeed, if the <math|x<rsub|p>>
and <math|x<rsub|p><rsup|i>> are close (like in and <math|x<rsub|p><rsup|i>> are close (like in
<math|x<rsub|p>+x<rsub|p><rsup|i>>), then it is natural to opt for a common <math|x<rsub|p>+x<rsub|p><rsup|i>>), then it is natural to opt for a common
base line. However, if they are further away from each other (like in base line. However, if they are further away from each other (like in
<math|x<rsub|p>+<big|sum><rsub|i=0><rsup|\<infty\>>c<rsub|i>x<rsub|p><rsup|i>> ), <math|x<rsub|p>+<big|sum><rsub|i=0><rsup|\<infty\>>c<rsub|i>x<rsub|p><rsup|i>> ),
then we might want to opt for different base lines and locally optimize the then we might want to opt for different base lines and locally optimize the
rendering of the first <math|x<rsub|p>>. rendering of the first <math|x<rsub|p>>.
Consequently, <TeXmacs> should offer a reasonable compromise for the most Consequently, <TeXmacs> should offer a reasonable compromise for the most
frequent cases, while offering methods for the user to make finer frequent cases, while offering methods for the user to make finer
adjustments in the remaining ones. We provide the constructs adjustments in the remaining ones. We provide the constructs
skipping to change at line 76 skipping to change at line 76
<\equation*> <\equation*>
\<phi\><around*|(|<big|sum><rsub|i>a<rsub|i>x<rsup|i>|)>=\<psi\><around*|(|< big|sum><rsub|<smash|j>>b<rsub|j>y<rsup|j>|)> \<phi\><around*|(|<big|sum><rsub|i>a<rsub|i>x<rsup|i>|)>=\<psi\><around*|(|< big|sum><rsub|<smash|j>>b<rsub|j>y<rsup|j>|)>
</equation*> </equation*>
have different sizes, then one may resize the bottom of the subscript have different sizes, then one may resize the bottom of the subscript
<math|j> of the second sum to <verbatim|0fn>. Alternatively, one may resize <math|j> of the second sum to <verbatim|0fn>. Alternatively, one may resize
the bottoms of both the <math|i> and <math|j> subscripts to (say) the bottoms of both the <math|i> and <math|j> subscripts to (say)
<verbatim|-0.3fn>. For easier adjustments you may use <verbatim|-0.3fn>. For easier adjustments you may use
adjust the size of the contents to the height of the character and adjust the size of the contents to the height of the character \Px\Q and
the largest one in the font respectively. the largest one in the font respectively.
Notice that one should adjust by preference in a structural and not visual Notice that one should adjust by preference in a structural and not visual
way. For instance, one should prefer <verbatim|-0.3fn> to <verbatim|-2mm> way. For instance, one should prefer <verbatim|-0.3fn> to <verbatim|-2mm>
in the above example, because the second option disallows you to switch to in the above example, because the second option disallows you to switch to
another font size for your document. Similarly, you should try not change another font size for your document. Similarly, you should try not change
the semantics of the formula. For instance, in the above example, you might the semantics of the formula. For instance, in the above example, you might
have added a to the <math|i> subscript of the sum. have added a \Pdummy subscript\Q to the <math|i> subscript of the sum.
However, this would alter the meaning of the formula (whence make it non However, this would alter the meaning of the formula (whence make it non
suitable as input to a computer algebra system) In the future, we plan to suitable as input to a computer algebra system) In the future, we plan to
For instance, in the case of a formula like For instance, in the case of a formula like
<\equation*> <\equation*>
1+x<rsub|1>+x<rsub|1><rsup|2>+\<cdots\>+x<rsub|2>+x<rsub|1>x<rsub|2>+x<rsub| 1><rsup|2>x<rsub|2>+\<cdots\>x<rsub|2><rsup|2>+x<rsub|1>x<rsub|2><rsup|2>+x<rsub |1><rsup|2>x<rsub|2><rsup|2>+\<cdots\>, 1+x<rsub|1>+x<rsub|1><rsup|2>+\<cdots\>+x<rsub|2>+x<rsub|1>x<rsub|2>+x<rsub| 1><rsup|2>x<rsub|2>+\<cdots\>x<rsub|2><rsup|2>+x<rsub|1>x<rsub|2><rsup|2>+x<rsub |1><rsup|2>x<rsub|2><rsup|2>+\<cdots\>,
</equation*> </equation*>
one might think of a construct to enclose the entire formula into an area, one might think of a construct to enclose the entire formula into an area,
skipping to change at line 162 skipping to change at line 162
<section|Some major mathematical constructs> <section|Some major mathematical constructs>
<subsection|Fractions> <subsection|Fractions>
The following heuristics are used: The following heuristics are used:
<\itemize> <\itemize>
<item>The horizontal middles of the numerator and the denominator are <item>The horizontal middles of the numerator and the denominator are
taken to be the same. taken to be the same.
<item>The vertical spaces between the numerator denominator and the <item>The vertical spaces between the numerator <abbr|resp.> denominator
fraction bar is at least <verbatim|sep>. and the fraction bar is at least <verbatim|sep>.
<item>The depth height) of the numerator denominator) is <item>The depth (<abbr|resp.> height) of the numerator (<abbr|resp.>
descended increased) to <verbatim|y1> <verbatim|y2>) if denominator) is descended (<abbr|resp.> increased) to <verbatim|y1>
necessary. This forces the base lines of not too large numerators (<abbr|resp.> <verbatim|y2>) if necessary. This forces the base lines of
denominators to be the same in presence of multiple fractions. not too large numerators <abbr|resp.> denominators to be the same in
presence of multiple fractions.
<item>The fraction bar has a overhang of <verbatim|sep/2> to both sides <item>The fraction bar has a overhang of <verbatim|sep/2> to both sides
and the logical limits of the fraction are another <verbatim|sep/2> and the logical limits of the fraction are another <verbatim|sep/2>
further. The logical left limit is zero. further. The logical left limit is zero.
</itemize> </itemize>
The italic corrections are not taken into account during the positioning The italic corrections are not taken into account during the positioning
algorithms, because this may create the impression that the numerator and algorithms, because this may create the impression that the numerator and
denominator are not correctly centered with respect to each other. denominator are not correctly centered with respect to each other.
Nevertheless, the italic corrections are taken into account in order to Nevertheless, the italic corrections are taken into account in order to
skipping to change at line 190 skipping to change at line 191
vanish at both sides). vanish at both sides).
<subsection|Roots> <subsection|Roots>
The following heuristics are used: The following heuristics are used:
<\itemize> <\itemize>
<item>The vertical space between the main argument and the upper bar is <item>The vertical space between the main argument and the upper bar is
at least <verbatim|sep>. at least <verbatim|sep>.
<item>The root itself is like a large delimiter. The <item>The root itself is typeset like a large delimiter. The positioning
positioning of a potential script works only is very dependent on the of a potential script works only is very dependent on the usage of <TeX>
usage of <TeX> fonts. fonts.
<item>The upper bar has a overhang of <verbatim|sep/2> at the right and <item>The upper bar has a overhang of <verbatim|sep/2> at the right and
the logical right limit of the root is situated another <verbatim|sep/2> the logical right limit of the root is situated another <verbatim|sep/2>
further to the right. further to the right.
</itemize> </itemize>
We take the logical right border plus the italic correction of the main We take the logical right border plus the italic correction of the main
argument in order to determine the right hand limit of the upper bar. The argument in order to determine the right hand limit of the upper bar. The
left italic correction is not needed. left italic correction is not needed.
skipping to change at line 227 skipping to change at line 228
The following heuristics are used: The following heuristics are used:
<\itemize> <\itemize>
<item>We use <TeX> fonts for small accents and an <item>We use <TeX> fonts for small accents and an
<with|font-shape|italic|ad hoc> algorithm for the wider ones. <with|font-shape|italic|ad hoc> algorithm for the wider ones.
<item>The distance between the main argument and the accent is at least <item>The distance between the main argument and the accent is at least
<verbatim|sep> (or a distance which depends on the <TeX> font for small <verbatim|sep> (or a distance which depends on the <TeX> font for small
accents). accents).
<item>The accent is positioned horizntally according to the right slope <item>The accent is positioned horizontally according to the right slope
of the main argument. of the main argument.
<item>The slopes for the accented box are inherited from those of the <item>The slopes for the accented box are inherited from those of the
main argument and the italic corrections are adjusted accordingly. main argument and the italic corrections are adjusted accordingly.
<item>All script height parameters of the accented box are inherited from <item>All script height parameters of the accented box are inherited from
the main argument. The only exception is <verbatim|ysup_hi_lim>, which the main argument. The only exception is <verbatim|ysup_hi_lim>, which
may be increased by the height of the accent, or determined in the may be increased by the height of the accent, or determined in the
generic way, whichever leads to the least value. It is indeed better to generic way, whichever leads to the least value. It is indeed better to
keep superscripts positioned reasonably low, whenever possible. keep superscripts positioned reasonably low, whenever possible.
skipping to change at line 303 skipping to change at line 304
<section|Big delimiters> <section|Big delimiters>
The automatic positioning and computation of sizes of big delimiters is The automatic positioning and computation of sizes of big delimiters is
again complicated because of potential conflicts between locally and again complicated because of potential conflicts between locally and
globally optimal esthetics. globally optimal esthetics.
First of all, <TeX> fonts come only with a discrete set of possible sizes First of all, <TeX> fonts come only with a discrete set of possible sizes
for large delimiters. This is an advantage from the point of view that it for large delimiters. This is an advantage from the point of view that it
favorites delimiters around slightly different expressions to have the same favorites delimiters around slightly different expressions to have the same