Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On Wed, 7 Jun 2017 18:03:35 +0200 Hans Hagenwrote: > > I have been massacred on this list for ever preferring \over to > > \frac... > > and because of the many {} you then need you get these mismatch > errors ... but, you can make > > \unexpanded\def\fakefrac#1#2{{{#1}\over{#2}}} The syntax {a \over b} is much more readable (to a mathematician) than \frac{a}{b} which looks fine to a programmer. This has nothing to say about how one or the other performs, it is a purely syntactical preference. Alan ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On Wed, Jun 7, 2017 at 7:31 PM, Hans Hagenwrote: > On 6/7/2017 4:50 PM, Mikael P. Sundqvist wrote: >> >> On Mon, Jun 5, 2017 at 10:24 AM, Mikael P. Sundqvist >> wrote: >>> >>> Hi, >>> >>> this might be a matter of taste. >>> >>> look at the output of (attached). In my opinion the first square root >>> is to "high", while it looks better on the second line. From >>> setup-en.pdf it looks like the default of \setupmathradical is set to >>> normal (and not default). I don't understand what normal should mean, >>> but I think the alternative=default looks better. (The lucida fonts >>> are loaded in this example, since the effect is more clear for them). > > Ok, this is the story > > -- radicals (roots) are rather special and have some hard coded properties > (like always scriptscript in the degree) > > -- \over (and friends) that are used in \frac (which by the way can be > configured in many ways) has the danger of getting the wrong style as side > effect of parsing (math list construction) and processing > > -- in context we want to support color etc for noth in a consistent way as > well as style control (important in educational math) > > Normally it works out ok with the 'normal' setting but there is some catch > here. The size of the radical symbols is determine by > > -- RadicalVerticalGap = 50 > -- RadicalDisplayStyleVerticalGap = 175 > > (These are lucide values) and it happens that the second one if too large > which can give a bad threshold in our case. In cambria it's > > RadicalVerticalGap = 166 > RadicalDisplayStyleVerticalGap = 345 > > So a 1:2 ratio. If we use that for lucida it looks better, so > > lucida-opentype-math.lfg > > can become: > > local function FixRadicalDisplayStyleVerticalGap(value,target,original) > local o = original.mathparameters.RadicalVerticalGap -- 50 > return 2 * o * target.parameters.factor > end > > return { > name = "lucida-opentype-math", > version = "1.00", > comment = "Goodies that complement lucida opentype.", > author = "Hans Hagen", > copyright = "ConTeXt development team", > mathematics = { > parameters = { > RadicalDisplayStyleVerticalGap = > FixRadicalDisplayStyleVerticalGap, > }, > alternates = { > italic = { feature = 'ss01', value = 1, comment = > "Mathematical Alternative Lowercase Italic" }, > arrow= { feature = 'ss02', value = 1, comment = > "Mathematical Alternative Smaller Arrows" }, > operator = { feature = 'ss03', value = 1, comment = > "Mathematical Alternative Smaller Operators" }, > calligraphic = { feature = 'ss04', value = 1, comment = > "Mathematical Alternative Calligraphic Characters" }, > zero = { feature = 'ss05', value = 1, comment = > "Mathematical Alternative Zero" }, > partial = { feature = 'ss20', value = 1, comment = > "Mathematical Alternative Upright Partial Differential" }, > }, > }, > } > > It's sort of a font property: the more sizes the better and sometimes you're > simply hit by the threshold not suiting your case. > > > Hans > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands >tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > - > ___ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ Hans, many thanks for your explanation, it is really appreciated when you take your time to do this! I updated my local lucida-opentype-math.lfg and indeed it works like charm. I think the uncramped version I get now looks better than what I forced with the temporary solution that I did not understand. /Mikael ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On 6/7/2017 4:50 PM, Mikael P. Sundqvist wrote: On Mon, Jun 5, 2017 at 10:24 AM, Mikael P. Sundqvistwrote: Hi, this might be a matter of taste. look at the output of (attached). In my opinion the first square root is to "high", while it looks better on the second line. From setup-en.pdf it looks like the default of \setupmathradical is set to normal (and not default). I don't understand what normal should mean, but I think the alternative=default looks better. (The lucida fonts are loaded in this example, since the effect is more clear for them). Ok, this is the story -- radicals (roots) are rather special and have some hard coded properties (like always scriptscript in the degree) -- \over (and friends) that are used in \frac (which by the way can be configured in many ways) has the danger of getting the wrong style as side effect of parsing (math list construction) and processing -- in context we want to support color etc for noth in a consistent way as well as style control (important in educational math) Normally it works out ok with the 'normal' setting but there is some catch here. The size of the radical symbols is determine by -- RadicalVerticalGap = 50 -- RadicalDisplayStyleVerticalGap = 175 (These are lucide values) and it happens that the second one if too large which can give a bad threshold in our case. In cambria it's RadicalVerticalGap = 166 RadicalDisplayStyleVerticalGap = 345 So a 1:2 ratio. If we use that for lucida it looks better, so lucida-opentype-math.lfg can become: local function FixRadicalDisplayStyleVerticalGap(value,target,original) local o = original.mathparameters.RadicalVerticalGap -- 50 return 2 * o * target.parameters.factor end return { name = "lucida-opentype-math", version = "1.00", comment = "Goodies that complement lucida opentype.", author = "Hans Hagen", copyright = "ConTeXt development team", mathematics = { parameters = { RadicalDisplayStyleVerticalGap = FixRadicalDisplayStyleVerticalGap, }, alternates = { italic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" }, arrow= { feature = 'ss02', value = 1, comment = "Mathematical Alternative Smaller Arrows" }, operator = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Smaller Operators" }, calligraphic = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, zero = { feature = 'ss05', value = 1, comment = "Mathematical Alternative Zero" }, partial = { feature = 'ss20', value = 1, comment = "Mathematical Alternative Upright Partial Differential" }, }, }, } It's sort of a font property: the more sizes the better and sometimes you're simply hit by the threshold not suiting your case. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On 6/7/2017 5:12 PM, Otared Kavian wrote: Hi, Indeed using \frac yields a weird result in the example sent by Mikael. Compare the output of the three formulas below, with or without \setupmathradical[sqrt][alternative=default]. The results are correct using \over in both cases, while the first one is weird when using \frac and \setupmathradical[sqrt][alternative=default]. Best regards: OK %%% start of test file \starttext \startbuffer[math] \startformula \sqrt{1+\Bigl(\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}\Bigr)^2} \stopformula \startformula 1+\Bigl(\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}\Bigr)^2 \stopformula \startformula \sqrt{1+\Bigl({f(x_k)-f(x_{k-1}) \over x_k - x_{k-1}}\Bigr)^2} \stopformula \stopbuffer \getbuffer[math] \hairline \setupmathradical[sqrt][alternative=default] \getbuffer[math] \stoptext interesting side effect of Ustack (i'll look at it) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On 6/7/2017 5:45 PM, Alan BRASLAU wrote: On Wed, 7 Jun 2017 17:12:44 +0200 Otared Kavianwrote: The results are correct using \over in both cases, while the first one is weird when using \frac and I have been massacred on this list for ever preferring \over to \frac... and because of the many {} you then need you get these mismatch errors ... but, you can make \unexpanded\def\fakefrac#1#2{{{#1}\over{#2}}} - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
> On 7 Jun 2017, at 17:45, Alan BRASLAUwrote: > > On Wed, 7 Jun 2017 17:12:44 +0200 > Otared Kavian wrote: > >> The results are correct using \over in both cases, while the first >> one is weird when using \frac and > > I have been massacred on this list for ever preferring \over to \frac... Do not be sad, we will bring flowers to console you - some of us do not hate \over ;-) ;-) ;-) > __ ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On Wed, 7 Jun 2017 17:12:44 +0200 Otared Kavianwrote: > The results are correct using \over in both cases, while the first > one is weird when using \frac and I have been massacred on this list for ever preferring \over to \frac... ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
Hi, Indeed using \frac yields a weird result in the example sent by Mikael. Compare the output of the three formulas below, with or without \setupmathradical[sqrt][alternative=default]. The results are correct using \over in both cases, while the first one is weird when using \frac and \setupmathradical[sqrt][alternative=default]. Best regards: OK %%% start of test file \starttext \startbuffer[math] \startformula \sqrt{1+\Bigl(\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}\Bigr)^2} \stopformula \startformula 1+\Bigl(\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}\Bigr)^2 \stopformula \startformula \sqrt{1+\Bigl({f(x_k)-f(x_{k-1}) \over x_k - x_{k-1}}\Bigr)^2} \stopformula \stopbuffer \getbuffer[math] \hairline \setupmathradical[sqrt][alternative=default] \getbuffer[math] \stoptext %%% end of test file > On 7 Jun 2017, at 16:50, Mikael P. Sundqvistwrote: >> […] > > Hans, > > maybe the \setupmathradical[sqrt][alternative=default] was not so > successful after all. Or maybe this is a bug: > > %%% start of test file > \setupmathradical[sqrt][alternative=default] > > \starttext > \startformula > \sqrt{1+\Bigl(\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}\Bigr)^2} > \stopformula > \stoptext > %%% stop of test file > > The numerator looks too small in my opinion. Compiled with 2017.06.06 13:22. > > /Mikael > ___ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] mathradical defaults to "normal", should it perhaps be "default"?
On Mon, Jun 5, 2017 at 10:24 AM, Mikael P. Sundqvistwrote: > Hi, > > this might be a matter of taste. > > look at the output of (attached). In my opinion the first square root > is to "high", while it looks better on the second line. From > setup-en.pdf it looks like the default of \setupmathradical is set to > normal (and not default). I don't understand what normal should mean, > but I think the alternative=default looks better. (The lucida fonts > are loaded in this example, since the effect is more clear for them). > > /Mikael > > \setupbodyfont[lucidaot] > > \starttext > > \startTEXpage[offset=2pt] > \startformula > \sqrt{1+x^2}\neq \frac{1}{\sqrt{1+x^2}} > \stopformula > > %the default setting for mathradical seems to be "normal". We change > it to "normal" > \setupmathradical[sqrt][alternative=default] > > \startformula > \displaystyle\sqrt{1+x^2}\neq \frac{1}{\sqrt{1+x^2}} > \stopformula > \stopTEXpage > > \stoptext Hans, maybe the \setupmathradical[sqrt][alternative=default] was not so successful after all. Or maybe this is a bug: %%% start of test file \setupmathradical[sqrt][alternative=default] \starttext \startformula \sqrt{1+\Bigl(\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}\Bigr)^2} \stopformula \stoptext %%% stop of test file The numerator looks too small in my opinion. Compiled with 2017.06.06 13:22. /Mikael ctx-example22.pdf Description: Adobe PDF document ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___