Dear Hans, After updating the minimal, I got a strange output of math display mode. Would you please check it? Here is an example. Best regards, Thank you. Dalyoung %%%%%%%%%%%% \starttext Here is a strange output of math formula. It is displayed correctly in text line, but is displayed strangely in math display mode. \blank Here is a correct output in text line. $\int_0^t B(s)\ dB(s) = \frac{1}{2} B^2(t) - \frac{1}{2} t.$ \blank But in the output of display mode, the location of the sub- super-script of the integral sign is not normal and the output of \type{ \frac{1}{2} B^2(t)} is wrong. \startformula \int_0^t B(s)\ dB(s) = \frac{1}{2} B^2(t) - \frac{1}{2} t. \stopformula \stoptext %%%%%%%%%%%%%%
Hi Dalyoung, I can confirm that in displayed math, the digit 1 in the command \frac{1}{2} results in 494 > 1 which is unexpected… However the command {1 \over 2} gives the correct result. Actually there seems to be a spurious 494 > in the source tree of the latest release, since any command such as \frac{a}{2} results in 494 > a Best regards: OK
On 21 Dec 2015, at 14:01, Jeong Dal
wrote: Dear Hans,
After updating the minimal, I got a strange output of math display mode. Would you please check it?
Here is an example.
Best regards, Thank you.
Dalyoung
%%%%%%%%%%%% \starttext
Here is a strange output of math formula. It is displayed correctly in text line, but is displayed strangely in math display mode. \blank Here is a correct output in text line. $\int_0^t B(s)\ dB(s) = \frac{1}{2} B^2(t) - \frac{1}{2} t.$ \blank But in the output of display mode, the location of the sub- super-script of the integral sign is not normal and the output of \type{ \frac{1}{2} B^2(t)} is wrong.
\startformula \int_0^t B(s)\ dB(s) = \frac{1}{2} B^2(t) - \frac{1}{2} t. \stopformula \stoptext %%%%%%%%%%%%%% ___________________________________________________________________________________ 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 ___________________________________________________________________________________
Otared Kavian mailto:otared@gmail.com 21. Dezember 2015 um 14:14 Hi Dalyoung,
I can confirm that in displayed math, the digit 1 in the command \frac{1}{2} results in 494 > 1 which is unexpected… However the command {1 \over 2} gives the correct result.
Actually there seems to be a spurious 494 > in the source tree of the latest release, since any command such as \frac{a}{2} results in 494 > a It's a spurious "\??mathstylecache" in math-ini.mkiv and I sent a fix to
the dev-list. Wolfgang
Wolfgang,
Can you explain to us why it should be preferable for ConTeXt users to
employ \frac12 rather than the native TeX construction {1\over 2}?
I understand that the macro \frac does some additional trickery but the
two constructions should *always* yield identical results (when
keyed-in properly).
Of course, Donald Knuth disagrees with \frac from the point of view
of the aesthetics of the syntax.
Alan
On Mon, 21 Dec 2015 15:17:18 +0100
Wolfgang Schuster
However the command {1 \over 2} gives the correct result.
It's a spurious "\??mathstylecache" in math-ini.mkiv and I sent a fix to the dev-list.
On Tue, 22 Dec 2015, Alan BRASLAU wrote:
Wolfgang,
Can you explain to us why it should be preferable for ConTeXt users to employ \frac12 rather than the native TeX construction {1\over 2}? I understand that the macro \frac does some additional trickery but the two constructions should *always* yield identical results (when keyed-in properly).
One of the troubles with { .... \over ...} and the like is that TeX does not know which "style" to use. This can lead to extra processing when using any command defined using \mathpalatte (such as \text, stacked arrows, and others). Consider \text{...}. Basically, we want \text{...} to typeset it's argument in a \hbox with textsize equal to the normalsize in normal mode and equal to script size when used in a subscript and in scriptsciptsize when used in a sub-subscript. Now, in traditional tex, when parsing {\text{hello} \over 2} TeX does not kow what size to use for \text{...} until it encounters the \over. So, when parsing \text{hello}, TeX generates all possible sizes and then prunes them later on. With nested constructs like {\text{hello}_{\text{world} \over 2} \over 2} it can lead to exponential number of branches. With \frac{\text{hello}}{2}, TeX "knows" what style to use for the arguments. So, extra processing is not needed (at least, this is the idea in LuaTeX; in PDFTeX, multiple sizes need to be generated). This can lead to some slightly faster processing. Also see http://tex.stackexchange.com/a/1261/ answer from Taco. Contrast the definition of \cramped given there from one in the LaTeX mathtools package (http://ctan.bppro.ca/macros/latex/contrib/mathtools/mathtools.dtx) [search from MT_cramped_clap_internal:Nn] Aditya
So it it a TeX programming limitation.
The risk of leading to an exponential number of branches is addressed
by Knuth at the beginning of Chapter 17 of the TeXbook (p. 139):
"Mathematicians tend to \quote{overuse} \over when they first begin to
typeset their own work on a system like \TEX." ...
At one point, I went back to using \over rather than \frac as the later
was broken and gave no output. This has since been fixed, but I stayed
with \over as I find primary operators to be much more elegant syntax
than multiple argument macros. It is too bad that luatex does not
employ a better programming solution, as the use of \frac{}{} leads to
ugly mathematical source code.
I guess that I should not worry about it too much since, as Knuth points
out in Chapter 17, overuse of \over, etc. leads to ugly results
anyways, just as well as an overuse of \text in mathematical formulas
(as we physicists tend to abuse) also leads to ugly mathematics.
Alan
On Tue, 22 Dec 2015 17:30:22 -0500
Aditya Mahajan
On Tue, 22 Dec 2015, Alan BRASLAU wrote:
Wolfgang,
Can you explain to us why it should be preferable for ConTeXt users to employ \frac12 rather than the native TeX construction {1\over 2}? I understand that the macro \frac does some additional trickery but the two constructions should *always* yield identical results (when keyed-in properly).
One of the troubles with { .... \over ...} and the like is that TeX does not know which "style" to use. This can lead to extra processing when using any command defined using \mathpalatte (such as \text, stacked arrows, and others).
Consider \text{...}. Basically, we want \text{...} to typeset it's argument in a \hbox with textsize equal to the normalsize in normal mode and equal to script size when used in a subscript and in scriptsciptsize when used in a sub-subscript. Now, in traditional tex, when parsing
{\text{hello} \over 2}
TeX does not kow what size to use for \text{...} until it encounters the \over. So, when parsing \text{hello}, TeX generates all possible sizes and then prunes them later on. With nested constructs like
{\text{hello}_{\text{world} \over 2} \over 2}
it can lead to exponential number of branches.
With \frac{\text{hello}}{2}, TeX "knows" what style to use for the arguments. So, extra processing is not needed (at least, this is the idea in LuaTeX; in PDFTeX, multiple sizes need to be generated). This can lead to some slightly faster processing.
Also see http://tex.stackexchange.com/a/1261/ answer from Taco. Contrast the definition of \cramped given there from one in the LaTeX mathtools package (http://ctan.bppro.ca/macros/latex/contrib/mathtools/mathtools.dtx) [search from MT_cramped_clap_internal:Nn]
Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- Alan Braslau CEA DSM-IRAMIS-SPEC CNRS UMR 3680 Orme des Merisiers 91191 Gif-sur-Yvette cedex FRANCE tel: +33 1 69 08 73 15 fax: +33 1 69 08 87 86 mailto:alan.braslau@cea.fr
On 12/23/2015 3:19 AM, Alan BRASLAU wrote:
So it it a TeX programming limitation.
The risk of leading to an exponential number of branches is addressed by Knuth at the beginning of Chapter 17 of the TeXbook (p. 139): "Mathematicians tend to \quote{overuse} \over when they first begin to typeset their own work on a system like \TEX." ...
At one point, I went back to using \over rather than \frac as the later was broken and gave no output. This has since been fixed, but I stayed with \over as I find primary operators to be much more elegant syntax than multiple argument macros. It is too bad that luatex does not employ a better programming solution, as the use of \frac{}{} leads to ugly mathematical source code.
Well, it is not impossible in mkiv do make something 1\alansover2 that adjusts itself to some settings (i could probably do it right now) but who will use it (apart from you) and who would document it then ..
I guess that I should not worry about it too much since, as Knuth points out in Chapter 17, overuse of \over, etc. leads to ugly results anyways, just as well as an overuse of \text in mathematical formulas (as we physicists tend to abuse) also leads to ugly mathematics.
Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Hans Hagen mailto:pragma@wxs.nl 23. Dezember 2015 um 10:17 On 12/23/2015 3:19 AM, Alan BRASLAU wrote:
So it it a TeX programming limitation.
The risk of leading to an exponential number of branches is addressed by Knuth at the beginning of Chapter 17 of the TeXbook (p. 139): "Mathematicians tend to \quote{overuse} \over when they first begin to typeset their own work on a system like \TEX." ...
At one point, I went back to using \over rather than \frac as the later was broken and gave no output. This has since been fixed, but I stayed with \over as I find primary operators to be much more elegant syntax than multiple argument macros. It is too bad that luatex does not employ a better programming solution, as the use of \frac{}{} leads to ugly mathematical source code.
Well, it is not impossible in mkiv do make something 1\alansover2 that adjusts itself to some settings (i could probably do it right now) but who will use it (apart from you) and who would document it then .. Would this method allow fractions in the second form below with ÷ instead of \over?
\starttext \startformula 1 = \frac{2}{3} + { 1 ÷ 3 } \stopformula \stoptext Wolfgang
On 12/22/2015 11:30 PM, Aditya Mahajan wrote:
On Tue, 22 Dec 2015, Alan BRASLAU wrote:
Wolfgang,
Can you explain to us why it should be preferable for ConTeXt users to employ \frac12 rather than the native TeX construction {1\over 2}? I understand that the macro \frac does some additional trickery but the two constructions should *always* yield identical results (when keyed-in properly).
One of the troubles with { .... \over ...} and the like is that TeX does not know which "style" to use. This can lead to extra processing when using any command defined using \mathpalatte (such as \text, stacked arrows, and others).
Consider \text{...}. Basically, we want \text{...} to typeset it's argument in a \hbox with textsize equal to the normalsize in normal mode and equal to script size when used in a subscript and in scriptsciptsize when used in a sub-subscript. Now, in traditional tex, when parsing
{\text{hello} \over 2}
TeX does not kow what size to use for \text{...} until it encounters the \over. So, when parsing \text{hello}, TeX generates all possible sizes and then prunes them later on. With nested constructs like
{\text{hello}_{\text{world} \over 2} \over 2}
it can lead to exponential number of branches.
With \frac{\text{hello}}{2}, TeX "knows" what style to use for the arguments. So, extra processing is not needed (at least, this is the idea in LuaTeX; in PDFTeX, multiple sizes need to be generated). This can lead to some slightly faster processing.
normally this is not what tex spends most time on although indeed it get slow as soon as you do 8 (massive) font switches plus other initializations (more a macro package issue then)
Also see http://tex.stackexchange.com/a/1261/ answer from Taco. Contrast the definition of \cramped given there from one in the LaTeX mathtools package (http://ctan.bppro.ca/macros/latex/contrib/mathtools/mathtools.dtx) [search from MT_cramped_clap_internal:Nn]
the \over and \above primitives are kind of special in the sense that they force the tex parser to backtrack (in practice it goes into another state and reconsiders the previous mathlist (of char) to become part of the fraction specification) in the end there is a math list that gets processed and at that point tex will figure out the size (it only calculates once not four times as it knows what size it's in then) as adity mantiones, as soon as one wants control over the size one runs into the problem that one has to use some construct that calculates all sizes (as then we pass an already typeset stream) so that tex when doing the fraction can choose the one it needs; this is referred to as "choices": if you want a smaller 1 and 2 in {1\over2} then you need something {\allfour{1}\over\allfour{2}} which then quickly let you make a helper which then tends to be called \frac and 1\frac2 is not something you can do in macros you can just use {{foo}\over{bar}} if you prefer (use all those braces to make things predictable) but then you cannot easily influence styling luatex introduces a mechanism to predict the upcoming style so that one can act upon it and avoid the four choices but that is normally not a user level operation (too much code) the whole idea of \frac is to provide a way to control styling (smaller that normal for instance) in context the fraction mechanism is quite complex as all permutations you can imagine are wanted by (different) users and usage (and you don't want to know what people put in fractions) basically you have style-a {style-b {{style-c}\over{style-d}}} kind of cases and every style influences a nested one (in font size, spacing etc) and of course mixed use complicates matters (consistent spacing, coloring, etc) ----------------------------------------------------------------- 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 -----------------------------------------------------------------
On 12/22/2015 8:24 PM, Alan BRASLAU wrote:
Wolfgang,
Can you explain to us why it should be preferable for ConTeXt users to employ \frac12 rather than the native TeX construction {1\over 2}? I understand that the macro \frac does some additional trickery but the two constructions should *always* yield identical results (when keyed-in properly).
Of course, Donald Knuth disagrees with \frac from the point of view of the aesthetics of the syntax.
Are you sure he disagrees? For instance \frac {12} {34} is less code than { {12} \over {34} } and all over the texbook (and web code) shortcuts are used. Afaik his idea of TeX is that users should do what they like best. Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------
On Wed, 23 Dec 2015 16:52:22 +0100
Hans Hagen
Of course, Donald Knuth disagrees with \frac from the point of view of the aesthetics of the syntax.
Are you sure he disagrees? For instance \frac {12} {34} is less code than { {12} \over {34} } and all over the texbook (and web code) shortcuts are used. Afaik his idea of TeX is that users should do what they like best.
The issue, which has been largely discussed elsewhere, is that what Knuth had in mind is for the source code to be as readable as the formatted result in some sense. I'm sure, Hans, that you agree with this philosophy. {12 \over 34} (no inner grouping should be necessary?) reads as we (or a mathematician) would think, whereas \frac{12}{34} reads as a computer programmer might think. This last construct is simply UGLY (maybe "geeks" might disagree). A computer program should have an elegant syntax, and the syntax should not be dictated by the implementation but should be coherent with itself. This is one of the attractions of lua as a language, for it is quite elegant. Another choice of ours is MetaPost, which is quite beautiful (much, much more than pgf/TiKz that it inspired), but perhaps a bit too subtle and somewhat quirky for many users. I believe that there is a certain lore around the amsmath/LaTeX \frac{}{} that is not justified, nor should we really be promoting it. If there is indeed some penalty in handling the primitives \over, etc. in luatex, then this should eventually be fixed (but I do not believe, nor do I know, that there is, in practice). Alan
participants (6)
-
Aditya Mahajan
-
Alan BRASLAU
-
Hans Hagen
-
Jeong Dal
-
Otared Kavian
-
Wolfgang Schuster