Math typesetting problems
Hi all, I've run into a couple of problems with math typesetting. (I'm using the latest ConTeXt standalone beta.) The following doesn't print [x,x] at all: \startformula [x,x]_t = x \stopformula It can be fixed by using \left[x,x\right]_t, but I find the behaviour weird. Another problem I have is related to the positioning of minus signs in front of fractions. I would expect the minus sign to align with the horizontal line of the fraction, as it does on LaTeX. Below is an example formula to illustrate my point. The result seems to be independent of the font in use. \startformula -\frac{e^{\frac{4}{5}}}{4} \stopformula Janne
Hi Janne, Janne wrote:
I've run into a couple of problems with math typesetting. (I'm using the latest ConTeXt standalone beta.) The following doesn't print [x,x] at all:
\startformula [x,x]_t = x \stopformula
This is because \startformula can take one optional argument in square brackets, and [x,x] is interpreted as that argument. You can make \startformula stop looking for [...] either by telling it to `\relax`, or by giving it an empty `[]` of its own to chew on. \startformula[] [x,x]_t = x \stopformula \startformula\relax [x,x]_t = x \stopformula I can't quite find at the moment what sort of options the [...] can contain, sorry. Cheers, Sietse
Hi Sietse, Sietse wrote:
This is because \startformula can take one optional argument in square brackets, and [x,x] is interpreted as that argument. You can make \startformula stop looking for [...] either by telling it to `\relax`, or by giving it an empty `[]` of its own to chew on.
Thanks for the explanation, this makes sense. Should have seen that myself. :) Janne
On Jan 27, 2013, at 7:09 AM, Sietse Brouwer
This is because \startformula can take one optional argument in square brackets, and [x,x] is interpreted as that argument. You can make \startformula stop looking for [...] either by telling it to `\relax`, or by giving it an empty `[]` of its own to chew on.
...
I can't quite find at the moment what sort of options the [...] can contain, sorry.
It takes the same options as \switchtobodyfont \starttext \startformula[] [x,x]_t = x \stopformula \startformula[small] [x,x]_t = x \stopformula \startformula[24pt] [x,x]_t = x \stopformula \stoptext ________________________________ This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments).
Le 27 janv. 13 à 12:52, Janne Junnila a écrit :
Hi all,
Another problem I have is related to the positioning of minus signs in front of fractions. I would expect the minus sign to align with the horizontal line of the fraction, as it does on LaTeX. Below is an example formula to illustrate my point. The result seems to be independent of the font in use.
\startformula -\frac{e^{\frac{4}{5}}}{4} \stopformula
Janne
Hi Janne, With \dfrac it looks good. With \fraction the minus sign is on the top of the fraction. Best regards, Roland
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Indeed it seems like the alignment is good with \dfrac, but this does not solve my problem, since I wish to also use fractions with script-size or scriptscript-size (\xfrac, \xxfrac). The specific formula I have is \startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula Thanks, Janne Roland wrote:
With \dfrac it looks good. With \fraction the minus sign is on the top of the fraction. Best regards, Roland
Le 28 janv. 13 à 10:11, Janne Junnila a écrit :
Indeed it seems like the alignment is good with \dfrac, but this does not solve my problem, since I wish to also use fractions with script-size or scriptscript-size (\xfrac, \xxfrac). The specific formula I have is
\startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula
Thanks, Janne OK ! So you need an expert, I'm just a newbie :) I would be interested to know how to do that. Best, Roland
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On Mon, 28 Jan 2013, Roland Thiers wrote:
Le 28 janv. 13 à 10:11, Janne Junnila a écrit :
Indeed it seems like the alignment is good with \dfrac, but this does not solve my problem, since I wish to also use fractions with script-size or scriptscript-size (\xfrac, \xxfrac). The specific formula I have is
\startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula
Thanks, Janne OK ! So you need an expert, I'm just a newbie :) I would be interested to know how to do that. Best, Roland
I'll look into fractions later this week. All the fraction macros of ConTeXt were based on \genfrac macro from AMSTeX so, in principle, they should behave in the same manner. Aditya
Am 28.01.2013 um 20:41 schrieb Aditya Mahajan
On Mon, 28 Jan 2013, Roland Thiers wrote:
Le 28 janv. 13 à 10:11, Janne Junnila a écrit :
Indeed it seems like the alignment is good with \dfrac, but this does not solve my problem, since I wish to also use fractions with script-size or scriptscript-size (\xfrac, \xxfrac). The specific formula I have is \startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula Thanks, Janne OK ! So you need an expert, I'm just a newbie :) I would be interested to know how to do that. Best, Roland
I'll look into fractions later this week. All the fraction macros of ConTeXt were based on \genfrac macro from AMSTeX so, in principle, they should behave in the same manner.
The \frac command uses \vcenter for the content while \dfrac and \tfrac only set the mathstyle before placing the content with the \over primitive. Wolfgang
On Mon, 28 Jan 2013, Wolfgang Schuster wrote:
I'll look into fractions later this week. All the fraction macros of ConTeXt were based on \genfrac macro from AMSTeX so, in principle, they should behave in the same manner.
The \frac command uses \vcenter for the content while \dfrac and \tfrac only set the mathstyle before placing the content with the \over primitive.
Then something has been lost in the MkII -> MkIV transition. I am pretty sure (cannot check right now), that the code in MkII used \genfrac (which is a fancy wrapper around \over \ovewithdelim etc) Aditya
Am 28.01.2013 um 21:48 schrieb Aditya Mahajan
On Mon, 28 Jan 2013, Wolfgang Schuster wrote:
I'll look into fractions later this week. All the fraction macros of ConTeXt were based on \genfrac macro from AMSTeX so, in principle, they should behave in the same manner.
The \frac command uses \vcenter for the content while \dfrac and \tfrac only set the mathstyle before placing the content with the \over primitive.
Then something has been lost in the MkII -> MkIV transition. I am pretty sure (cannot check right now), that the code in MkII used \genfrac (which is a fancy wrapper around \over \ovewithdelim etc)
Yes, MkII uses \genfrac but in MkIV the command is no longer available and all fraction commands have been rewritten. Wolfgang
On Mon, Jan 28, 2013 at 09:33:52PM +0100, Wolfgang Schuster wrote:
The \frac command uses \vcenter for the content while \dfrac and \tfrac only set the mathstyle before placing the content with the \over primitive.
The use of \vcenter seems odd here as it means the fraction rule will no longer guranteed to be centered around the math axis: \starttext \math{-\frac{a^{2^{2^2}}}{a} {a^{2^{2^2}}\over a}} \stoptext Also, why \frac is forcing text style fractions even in display mode? \starttext \startformula -\frac{a^{2^{2^2}}}{a} {a^{2^{2^2}}\over a} \stopformula \stoptext Both behaviours are different from MkII. Regards, Khaled
On 1/29/2013 12:20 AM, Khaled Hosny wrote:
On Mon, Jan 28, 2013 at 09:33:52PM +0100, Wolfgang Schuster wrote:
The \frac command uses \vcenter for the content while \dfrac and \tfrac only set the mathstyle before placing the content with the \over primitive.
The use of \vcenter seems odd here as it means the fraction rule will no longer guranteed to be centered around the math axis: \starttext \math{-\frac{a^{2^{2^2}}}{a} {a^{2^{2^2}}\over a}} \stoptext
Also, why \frac is forcing text style fractions even in display mode? \starttext \startformula -\frac{a^{2^{2^2}}}{a} {a^{2^{2^2}}\over a} \stopformula \stoptext
Both behaviours are different from MkII.
I redid the mkiv code ... configurable, defineable, inheritable ... the whole lot \starttext \definemathfraction[myfrac] [mathstyle=script] \definemathfraction[myfracx][mathstyle=script,alternative=outer] \startformula {a^{2^{2^2}}\over a} \frac{a^{2^{2^2}}}{a} \frac{a^{2}}{b} \myfrac{a^{2}}{b} \myfracx{a^{2}}{b} \stopformula \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hi Janne,
Personnally I prefer to use the Plain TeX alternative \over (which works fine in ConTeXt), that is
${a \over b}$
instead of
$\frac{a}{b}$
Compare the following two outputs in the example you want to typeset: I think the second is more or less what you want
\starttext
Using \type{\frac} gives:
\startformula
f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) +
U(t-s)) + \frac{(S(u-t) +
U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}}
\stopformula
\blank
Using \type{\over} gives:
\startformula
f_{B_t | B_s = S, B_u = U}(x) = {
e^{-{(u-s)x^2 - 2x(S(u-t) + U(t-s)) +
{(S(u-t) + U(t-s))^2 \over (u-s)} \over 2(t-s)(u-t)}} \over
\sqrt{2\pi {(t-s)(u-t) \over u-s}}}
\stopformula
\stoptext
Best regards: OK
On 28 janv. 2013, at 10:11, Janne Junnila
Indeed it seems like the alignment is good with \dfrac, but this does not solve my problem, since I wish to also use fractions with script-size or scriptscript-size (\xfrac, \xxfrac). The specific formula I have is
\startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula
Thanks, Janne
Roland wrote:
With \dfrac it looks good. With \fraction the minus sign is on the top of the fraction. Best regards, Roland
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On Mon, 28 Jan 2013, Otared Kavian wrote:
Hi Janne,
Personnally I prefer to use the Plain TeX alternative \over (which works fine in ConTeXt), that is ${a \over b}$ instead of $\frac{a}{b}$
Compare the following two outputs in the example you want to typeset: I think the second is more or less what you want
\starttext Using \type{\frac} gives: \startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula
Formatting and temporary macros (I usually use \1 \2 etc) make a huge difference in readability: \startformula \def\1 {\frac{ (u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2} {(u-s)} }{ 2(t-s)(u-t)} } % f_{B_t | B_s = S, B_u = U}(x) = \frac { e^{\1} } { \sqrt{2\pi\frac{(t-s)(u-t)}{u-s}} } \stopformula
\blank Using \type{\over} gives: \startformula f_{B_t | B_s = S, B_u = U}(x) = { e^{-{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + {(S(u-t) + U(t-s))^2 \over (u-s)} \over 2(t-s)(u-t)}} \over \sqrt{2\pi {(t-s)(u-t) \over u-s}}} \stopformula
\stoptext
At some stage, we also need to look at nath's automatic conversion of display fractions to inline fractions (e.g., in the numberator \frac{ (S(u-t) + U(t-s))^2 } { (u-s) } should be typeset as (S(u-t) + U(t-s))^2/(u-s) because it is being typeset in \scriptstyle. Aditya
participants (9)
-
Aditya Mahajan
-
Hans Hagen
-
Janne Junnila
-
Khaled Hosny
-
Otared Kavian
-
Rogers, Michael K
-
Roland Thiers
-
Sietse Brouwer
-
Wolfgang Schuster