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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to