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).

However, there appears to be a bug as the \frac is shown in text style instead 
of display style. Here is a minimal example illustrating the bug:

\startformula
   \mcframed[mathstyle=display]{\frac{1}{x}}
   +
   \frac {1}{x}
   + 
   \mcframed{\displaystyle \frac{1}{x}}
\stopformula

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to