ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* nath problems and patches
@ 2004-08-13 14:15 Christopher Creutzig
  2004-08-25 20:48 ` Giuseppe Bilotta
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Creutzig @ 2004-08-13 14:15 UTC (permalink / raw)


Giuseppe,

  you may or may not know about these problems already, so I decided to 
simply send them all.  I'm using t-nath.tex 2003.12.08, updated five 
minutes ago from www.tug.org, ConTeXt 2004.6.26, and pdfeTeX 
3.14159-1.10b-2.1 (Web2C 7.4.5).

nath seems to have trouble with $$...$$-formulas. This file won't compile:

\usemodule[nath]

\starttext
\placeformula
$$a$$
\stoptext

Error message:
Runaway argument?
\@@dollar {\to \asciiB \ExpandBothAfter \doifincsnameelse \asciiA 
\asciiB \ETC.
! File ended while scanning use of \convertargument.

Replacing $$...$$ by \startformula...\stopformula fixes this, but the 
following file won't compile either:

\usemodule[nath]

\starttext
\placeformula
\startformula \sum_{i=0}^m a_i\stopformula
\stoptext


The culprit, it seems, is that \inlinemath uses \xdef, but \mathop@@@ 
puts unexpandable code into the argument of ^ and _.  The following 
hackery seems to work:

\def\mathop@@@{%
  \ifsp@
   ^{\hbox{\edef\noexpand\!!stringa%
	{\noexpand\noexpand\noexpand\imath@{\the\sp@toks}}%
    \def\noexpand\\{,\ }\noexpand\!!stringa}}
  \fi
  \ifsb@
   _{\hbox{\edef\noexpand\!!stringa%
	{\noexpand\noexpand\noexpand\imath@{\the\sb@toks}}%
    \def\noexpand\\{,\ }\noexpand\!!stringa}}
  \fi}

Though I must confess I don't understand why the complexity with 
introducing \!!stringa is needed.  The following version works for me:

\def\mathop@@@{%
  \pushmacro\\
  \def\\{\noexpand\text{, }}%
  \ifsp@
    ^{\the\sp@toks}%
  \fi
  \ifsb@
    _{\the\sb@toks}%
  \fi
  \popmacro\\}



Parentheses in display formulas don't work:
\usemodule[nath]
\starttext
\startformula (x) \stopformula
\stoptext

  I don't know if at some time ConTeXt placed \the\everymath inside 
\everydisplay, but with the current ConTeXt, you need to \appendtoks to 
both.  I regard the output as broken, but at least it will compile.



  Another bug: t-nath.tex defines \savecatcode and \restorecatcode, but 
these names have already been used in verb-ini.tex.  I have locally 
replaced these with \nath!savecatcode and \nath!restorecatcode, seems to 
work.



A math problem not related to nath:
\starttext
\setupformulae[align=left]
\startformula
   \eqalignno{a&=b\cr c&=d}
\stopformula
\stoptext

doesn't work for me.  Anyone else?


Regards,
	Christopher Creutzig

PS: I won't be able to read mails in the next four weeks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: nath problems and patches
  2004-08-13 14:15 nath problems and patches Christopher Creutzig
@ 2004-08-25 20:48 ` Giuseppe Bilotta
  0 siblings, 0 replies; 2+ messages in thread
From: Giuseppe Bilotta @ 2004-08-25 20:48 UTC (permalink / raw)


Friday, August 13, 2004 Christopher Creutzig wrote:

> Giuseppe,

>   you may or may not know about these problems already, so I decided to
> simply send them all.  I'm using t-nath.tex 2003.12.08, updated five
> minutes ago from www.tug.org, ConTeXt 2004.6.26, and pdfeTeX 
> 3.14159-1.10b-2.1 (Web2C 7.4.5).

> nath seems to have trouble with $$...$$-formulas. This file won't compile:

> \usemodule[nath]

> \starttext
> \placeformula
> $$a$$
> \stoptext

> Error message:
> Runaway argument?
> \@@dollar {\to \asciiB \ExpandBothAfter \doifincsnameelse \asciiA
> \asciiB \ETC.
> ! File ended while scanning use of \convertargument.

> Replacing $$...$$ by \startformula...\stopformula fixes this,

That's because nath recatcodes the $ signs and the original
definition of \placeformula doesn't work when they are active.
(Hans, can we look into this together, please?)

Don't use $$ ... $$ with \placeformula (they should work ok for
numberless formulas though).

Actually, you've hit on one of the most strange bugs in the
nath module: it didn't support use of \startformula ...
\stopformula either! It *seemed* to work, but it didn't really
act properly. You may want to try your examples with \[ ... \]
instead of \startformula ... \stopformula, and see if you still
have the problems.

In the mean time, I will upload a new version of nath which
should also allow use of \startformula.

> Another bug: t-nath.tex defines \savecatcode and
> \restorecatcode, but these names have already been used in
> verb-ini.tex. I have locally replaced these with
> \nath!savecatcode and \nath!restorecatcode, seems to work.

Thanks for spotting it!

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-25 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-13 14:15 nath problems and patches Christopher Creutzig
2004-08-25 20:48 ` Giuseppe Bilotta

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