ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A couple of questions on math customizing.
@ 2005-07-11  8:48 Brooks Moses
  0 siblings, 0 replies; only message in thread
From: Brooks Moses @ 2005-07-11  8:48 UTC (permalink / raw)


I'm working on doing my own math alignment routines.  After a lot of poking 
about in core-mat.tex, I came to the conclusion that \startinnermath and 
\stopinnermath were probably the things to modify, and the "most polite" 
way to do that was by defining my own alignment name.  So, the following 
does what I want for a test case:

(Note that \defineinnermathhandler is a shortcut to define versions of 
\startinnermath and \stopinnermath corresponding to the given alignment.)

   \starttext
   \defineinnermathhandler{test}
     {\let\doplaceformulanumber\empty}
     {}
   \setupformulas[align=test]
   \placeformula{a}
   \startformula
   c^2 = a^2 + b^2  \eqno{\formulanumber}
   \stopformula
   \stoptext

First, if I want \stopinnermath to handle the formula number, I have to 
somehow turn off the \doplaceformulanumber that gets called at the 
beginning of \dostopformula.  Redefining the macro to \empty in 
\startinnermath works, but it seems a bit inelegant.  Is there a better way?

Second, if I move that \eqno{\formulanumber} up into \stopinnermath, as in 
the following sample, I get an error about "\eqno not allowed in math 
mode", despite the fact that it seems to be doing the exact same thing as 
the previous example.

   \starttext
   \defineinnermathhandler{test}
     {\let\doplaceformulanumber\empty}
     {\eqno{\formulanumber}}
   \setupformulas[align=test]
   \placeformula{a}
   \startformula
   c^2 = a^2 + b^2
   \stopformula
   \stoptext

Then, if I enclose the \eqno in an if statement borrowed from the 
just-erased definition of \doplaceformulanumber, it works again:

   \starttext
   \unprotect
   \defineinnermathhandler{test}
     {\let\doplaceformulanumber\empty}
     {\eqno{\formulanumber}}
     {\doifelse \@@fmlocation \v!left%
         {\normalleqno {\formulanumber}}%
         {\normalreqno {\formulanumber}}}
   \protect
   \setupformulas[align=test]
   \placeformula{a}
   \startformula
   c^2 = a^2 + b^2
   \stopformula
   \stoptext

What's up with that, and what do I need to do to be able to put a bare 
\eqno in the \stopinnermath macro?

Thanks!
- Brooks

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-11  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-11  8:48 A couple of questions on math customizing Brooks Moses

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).