Hi Hans, On Fri, Jan 3, 2025 at 09:13 (+0100), Hans Hagen wrote:
On 1/3/2025 1:56 AM, Jim wrote:
Hi,
I was perusing an update to https://wiki.contextgarden.net/index.php?title=Framed&diff=next&oldid=35583 and noticed that the grey math was not properly aligned on the wiki page.
But then I tried it on my system, and, worse yet, I found out that
\setuppapersize[A5] \setupcolors[state=start] \def\graymath{\mframed[frame=off, background=color, backgroundcolor=gray, backgroundoffset=3pt]}
\starttext \startformula {x^3\over3} - 2 \stopformula \stoptext
creates a fraction that I would expect from
{x^3\over3 - 2}
Is this just my (newly updated) context, or has the year 2025 started off with a \over problem?
It's been so for a while. In fact, using \over was never advocated
OK, I'm not entirely surprised by that. But... as mentioned, I see it used in the wiki. And I know that the wiki isn't the same sort of official documentation as the manual, but (a) there it is, and (b) in the wiki it works. I know little about the wiki, is it using some other/older version of ConTeXt (e.g., Mk II or Mk IV) to generate the examples? If the answer is "yes", is that something that should be reconsidered?
For various reasons you should use:
\frac{x^3}{3} - 2
Here are some:
- in lmtx we configure {} to as anywhere else in tex: grouping or argument delimiters; if not it will always create atoms
- \over is a special but confusing case of parsing where, when it is seen, tex will take the previous atom and pair that with an upcoming only case of such parsing
- just try to predict what
{x} \over {y} {x+1} \over {y} x + {1} \over {y} x + 1\over y {x + {1} \over {y}} {x + 1\over y}
etc etc are supposed to do especially when you also mix in \scriptstyle, \red, \bf or alike in different places in or ourside these { }
I will admit in my plain TeX documents I always used {<numer> \over <denom>} to let TeX know the extent of the numerator and denominator, and it always (?!) did The Right Thing (i.e., typeset a fraction with "numer" over "denom"), but I don't tend to use hugely complicated fractions, so maybe I could have run into problems if I tried trickier things.
- this means that when one wants to control rendering rather dirty tricks have to be used to might not always work
- for that reason \frac is there (afaik not only in context): we can control how the numerator and denominator are handled in more detail
- in lmtx (see the extended math manual) we've spend a lot (!) of time on improving math rendering and spacing especially, so in our case fractions are native classes
I'm sure Mikael can add some more arguments ... like different kind of fractions, skrewed fraction etc, but maybe best read the quite extensive mathincontext manual first.
Thanks for your comments and the pointer to the manual. Back to the wiki: I have made some edits to the wiki here and there when I got (more or less) definitive statements from someone who I assumed is a ConTeXt "guru" (or higher), or when I was correcting some typo or grammar error, or when I added an example I thought was enlightening. In this case, the edit is major, and I would not want anyone to feel I was stepping on anyone's toes by rewriting the examples in the framed page. Has anyone who has read this far care to comment on the wiki questions: (1) Why does \over work correctly in the \framed wiki example, and (2) Should the example there be re-written to use preferred ConTeXt syntax? Cheers. Jim