On Sun, Jan 5, 2025 at 23:48 (-0500), Aditya Mahajan wrote:
On Sun, 5 Jan 2025, Jim wrote:
On Fri, Jan 3, 2025 at 12:29 (-0500), Aditya Mahajan wrote:
On Fri, 3 Jan 2025, Jim wrote:
Has anyone who has read this far care to comment on the wiki questions: (2) Should the example there be re-written to use preferred ConTeXt syntax?
Definitely, yes to (2)!
I changed \over usage to \frac on the wiki page known, as of very recently, as "Text blocks/Environments/Frames" (i.e., https://wiki.contextgarden.net/Text_blocks/Environments/Frames )
However, the greyed math (see "Shaded background for part of a displayed equation" about 1/4 the way down the page) is too high. I changed \mframed to \inmframed which made it less bad, but I am at a loss as to The Right Way to get good horizontal alignment here.
Does anyone here who knows The Right Way have the time to either (a) fix the wiki, or (b) tell me The Right Way (and then I'll cheerfully fix the wiki)?
I am confident that I could kludge it to the correct height with a little box lowering trickery, but surely there is a better way.
This is how I'd do it:
\definemathframed [graymath] [frame=off, location=mathematics, background=color, backgroundcolor=gray, backgroundoffset=3pt]
\starttext \startformula \ln (1+x) =\, \graymath{x - \frac{x^2}{2}} \,+ \frac{x^3}{3}-\cdots. \stopformula \stoptext
The key part is location=mathematics (or \mcframed .. short for math-centered).
Thanks for that, Aditya. As per my promise (notwithstanding the bug that you note below) I did update the wiki page. I like to make minimal updates to avoid insulting original authors, so I just added location=mathematics to the original author's definition.
However, there appears to be a bug as the \frac is shown in text style instead of display style.
Damn. I was so happy to get \frac working and the formula almost aligned the smaller fraction didn't completely register.
Here is a minimal example illustrating the bug:
\startformula \mcframed[mathstyle=display]{\frac{1}{x}} + \frac {1}{x} + \mcframed{\displaystyle \frac{1}{x}} \stopformula
Given Hans' follow-up, I'll keep an eye on this and further update the wiki page if/when the solution comes into my inbox. Jim