* nath catcode issues
@ 2004-07-04 13:36 Nikolai Weibull
2004-07-05 10:01 ` Giuseppe Bilotta
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-07-04 13:36 UTC (permalink / raw)
It seems that the code to enable catcode handling in nath math mode
isn't working. Currently, nath uses
\appendtoks
% \livechars@
\def({\delim@l 1\ch@lparenthesis}
\def){\delim@r 1\ch@rparenthesis}
\def[{\delim@l 1\o@lbrack}
\def]{\delim@r 1\o@rbrack}
\def>{\gt}
\def<{\lt}
\def!{\factorial}
\def,{\@comma}
\def;{\@semicolon}
\def`{\abbreviation}
% \killchars@
\to\everymath
to set it up, but as far as I can see this doesn't actually do anything
as \@comma doesn't get invoked for commas and \dots always renders like
\cdots. Am I missing something perhaps?
Furthermore,
\def\over{\n@err{Disabled command \string\over }
{No more a valid command. Replace {A \over B} with \frac A B.}}
\def\atop{\n@err{Disabled command \string\atop }
{No more a valid command. Use array instead.}}
\def\choose{\n@err{Disabled command \string\choose }
{No more a valid command. Replace {A \choose B} with \binom A B.}}
also messes up stuff in core-ref.tex for example:
! Disabled command \over.
\n@err ...rrhelp \expandafter {#2}\errmessage {#1}
\natherrormark
l.46 \indent\inchapter[definitions], \about
[definitions], covers the definit...
?
Which I don't quite understand, but core-ref.tex has the line
\definecommand over {\dospecialover}
which I suppose could be troublesome.
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nath catcode issues
2004-07-04 13:36 nath catcode issues Nikolai Weibull
@ 2004-07-05 10:01 ` Giuseppe Bilotta
2004-07-05 10:44 ` Nikolai Weibull
0 siblings, 1 reply; 8+ messages in thread
From: Giuseppe Bilotta @ 2004-07-05 10:01 UTC (permalink / raw)
Sunday, July 4, 2004 Nikolai Weibull wrote:
> It seems that the code to enable catcode handling in nath math mode
> isn't working. Currently, nath uses
[snip]
> to set it up, but as far as I can see this doesn't actually do anything
> as \@comma doesn't get invoked for commas and \dots always renders like
> \cdots. Am I missing something perhaps?
Well, the nath catcodes only apply in math mode, and indeed in
math mode , will trigger \@comma :)
About \dots: with the nath module, \dots will *in math mode*
use \cdots in all cases *except* after punctuation (e.g. after
a comma); indeed, the code
\[
a=b, \dots c=d \dots
\]
will give you \ldots in the first case and \cdots in the second
case. Do you have some example of when it doesn't work?
> Furthermore,
> \def\over{\n@err{Disabled command \string\over }
> {No more a valid command. Replace {A \over B} with \frac A B.}}
> \def\atop{\n@err{Disabled command \string\atop }
> {No more a valid command. Use array instead.}}
> \def\choose{\n@err{Disabled command \string\choose }
> {No more a valid command. Replace {A \choose B} with \binom A B.}}
> also messes up stuff in core-ref.tex for example:
AHA! Good point. Try this fix:
\def\over{\ifmmode\n@err{Disabled command \string\over }
{No more a valid command. Replace {A \over B} with \frac A
B.}\else\o@over\fi}
\def\atop{\ifmmode\n@err{Disabled command \string\atop }
{No more a valid command. Use array instead.}\else\o@atop\fi}
\def\choose{\ifmmode\n@err{Disabled command \string\choose }
{No more a valid command. Replace {A \choose B} with \binom A
B.}\else\o@choose\fi}
(hm. this is untested. I'm sure it'll bomb out because of
expansion, I'll have to design a cleaner one.)
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nath catcode issues
2004-07-05 10:01 ` Giuseppe Bilotta
@ 2004-07-05 10:44 ` Nikolai Weibull
2004-07-05 11:03 ` Giuseppe Bilotta
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-07-05 10:44 UTC (permalink / raw)
* Giuseppe Bilotta <gip.bilotta@iol.it> [Jul 05, 2004 12:10]:
> Well, the nath catcodes only apply in math mode, and indeed in
> math mode , will trigger \@comma :)
Hm, not here...
> About \dots: with the nath module, \dots will *in math mode*
> use \cdots in all cases *except* after punctuation (e.g. after
> a comma); indeed, the code
>
> \[
> a=b, \dots c=d \dots
> \]
>
> will give you \ldots in the first case and \cdots in the second
> case. Do you have some example of when it doesn't work?
Your example above renders with \cdots for both \dots.
\usemodule[nath]
\starttext
$a, b, \dots, n$
\[ a=b, \dots c=d \dots \]
\stoptext
The first line is my old test case, the second is yours...both render
with \cdots everywhere. Totally weird. I'm using the latest context
from the pragma-ade page.
> \def\over{\ifmmode\n@err{Disabled command \string\over }
> {No more a valid command. Replace {A \over B} with \frac A
> B.}\else\o@over\fi}
> \def\atop{\ifmmode\n@err{Disabled command \string\atop }
> {No more a valid command. Use array instead.}\else\o@atop\fi}
> \def\choose{\ifmmode\n@err{Disabled command \string\choose }
> {No more a valid command. Replace {A \choose B} with \binom A
> B.}\else\o@choose\fi}
Ah, of course...
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: nath catcode issues
2004-07-05 10:44 ` Nikolai Weibull
@ 2004-07-05 11:03 ` Giuseppe Bilotta
2004-07-05 12:42 ` Nikolai Weibull
0 siblings, 1 reply; 8+ messages in thread
From: Giuseppe Bilotta @ 2004-07-05 11:03 UTC (permalink / raw)
Monday, July 5, 2004 Nikolai Weibull wrote:
> * Giuseppe Bilotta <gip.bilotta@iol.it> [Jul 05, 2004 12:10]:
>> Well, the nath catcodes only apply in math mode, and indeed in
>> math mode , will trigger \@comma :)
> Hm, not here...
[snip]
> Your example above renders with \cdots for both \dots.
Weird indeed. I'm not using the latest ConTeXt. (Actually I'm
quite back with the updates ... gotta get down to it.) I'll see
if upgrading gives me the same problem and in case get a fix.
>> \def\over{\ifmmode\n@err{Disabled command \string\over }
>> {No more a valid command. Replace {A \over B} with \frac A
>> B.}\else\o@over\fi}
>> \def\atop{\ifmmode\n@err{Disabled command \string\atop }
>> {No more a valid command. Use array instead.}\else\o@atop\fi}
>> \def\choose{\ifmmode\n@err{Disabled command \string\choose }
>> {No more a valid command. Replace {A \choose B} with \binom A
>> B.}\else\o@choose\fi}
> Ah, of course...
> nikolai
It works like that? Excellent.
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: nath catcode issues
2004-07-05 11:03 ` Giuseppe Bilotta
@ 2004-07-05 12:42 ` Nikolai Weibull
2004-08-07 14:58 ` Giuseppe Bilotta
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-07-05 12:42 UTC (permalink / raw)
* Giuseppe Bilotta <gip.bilotta@iol.it> [Jul 05, 2004 14:00]:
> Weird indeed. I'm not using the latest ConTeXt. (Actually I'm
> quite back with the updates ... gotta get down to it.) I'll see
> if upgrading gives me the same problem and in case get a fix.
OK.
> >> \def\over{\ifmmode\n@err{Disabled command \string\over }
> >> {No more a valid command. Replace {A \over B} with \frac A
> >> B.}\else\o@over\fi}
> >> \def\atop{\ifmmode\n@err{Disabled command \string\atop }
> >> {No more a valid command. Use array instead.}\else\o@atop\fi}
> >> \def\choose{\ifmmode\n@err{Disabled command \string\choose }
> >> {No more a valid command. Replace {A \choose B} with \binom A
> >> B.}\else\o@choose\fi}
>
> > Ah, of course...
> > nikolai
>
> It works like that? Excellent.
It seems I spoke too soon. It does in fact not work. \o@over can't be
put like that inside the if-statement. A suggestion would be to re-work
the whole section and instead make it
\appendtoks
\def\over{\n@err{Disabled command \string\over }
{No more a valid command. Replace {A \string\over B} with \string\frac A B.}}
\def\atop{\n@err{Disabled command \string\atop }
{No more a valid command. Use array instead.}}
\def\choose{\n@err{Disabled command \string\choose }
{No more a valid command. Replace {A \string\choose B} with \string\binom A B. >>> }}
\to\everymath
but I don't know if that's a good solution. It forces you to use
\string\over in the second argument to \n@err which I don't understand
why, but otherwise TeX runs out of stack space. I suppose it's being
expanded even though it shouldn't be.
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: Re: nath catcode issues
2004-07-05 12:42 ` Nikolai Weibull
@ 2004-08-07 14:58 ` Giuseppe Bilotta
2004-08-08 19:28 ` Nikolai Weibull
0 siblings, 1 reply; 8+ messages in thread
From: Giuseppe Bilotta @ 2004-08-07 14:58 UTC (permalink / raw)
Monday, July 5, 2004 Nikolai Weibull wrote:
> * Giuseppe Bilotta <gip.bilotta@iol.it> [Jul 05, 2004 14:00]:
>> Weird indeed. I'm not using the latest ConTeXt. (Actually I'm
>> quite back with the updates ... gotta get down to it.) I'll see
>> if upgrading gives me the same problem and in case get a fix.
> OK.
I'm now using
ConTeXt ver: 2004.6.30 fmt: 2004.7.27 int: english mes: english
and your example
\usemodule[nath]
\starttext
$a, b, \dots, n$
\[
a=b, \dots c=d \dots
\]
\stoptext
uses, in order, \ldots, \ldots, \cdots which sounds like the
correct behaviour to me. The engine is
This is pdfeTeX, Version 3.141592-1.20a-rc4-2.1 (MiKTeX 2.4)
>> >> \def\over{\ifmmode\n@err{Disabled command \string\over }
>> >> {No more a valid command. Replace {A \over B} with \frac A
>> >> B.}\else\o@over\fi}
>> >> \def\atop{\ifmmode\n@err{Disabled command \string\atop }
>> >> {No more a valid command. Use array instead.}\else\o@atop\fi}
>> >> \def\choose{\ifmmode\n@err{Disabled command \string\choose }
>> >> {No more a valid command. Replace {A \choose B} with \binom A
>> >> B.}\else\o@choose\fi}
>>
>> > Ah, of course...
>> > nikolai
>>
>> It works like that? Excellent.
> It seems I spoke too soon. It does in fact not work. \o@over can't be
> put like that inside the if-statement. A suggestion would be to re-work
> the whole section and instead make it
> \appendtoks
> \def\over{\n@err{Disabled command \string\over }
> {No more a valid command. Replace {A \string\over B} with \string\frac A B.}}
> \def\atop{\n@err{Disabled command \string\atop }
> {No more a valid command. Use array instead.}}
> \def\choose{\n@err{Disabled command \string\choose }
> {No more a valid command. Replace {A \string\choose B}
> with \string\binom A B. >>> }}
> \to\everymath
> but I don't know if that's a good solution. It forces you to use
> \string\over in the second argument to \n@err which I don't understand
> why, but otherwise TeX runs out of stack space. I suppose it's being
> expanded even though it shouldn't be.
> nikolai
Also, I'm not sure that will work with text inside math. Can
you design a small test case that uses \over (directly or
indirectly) in normal text and in some \text inside a math
environment so that I can see what solution works fine?
In the meantime, I'm thinking along the lines of something like
\def\over{%
\ifmmode\n@err{Disabled command \string\over }
{No more a valid command. Replace {A \over B} with \frac A B.}%
\let\next\relax
\else\let\next\o@over\fi\next}
\def\atop{%
\ifmmode\n@err{Disabled command \string\atop }
{No more a valid command. Use array instead.}%
\let\next\relax
\else\let\next\o@atop\fi\next}
\def\choose{%
\ifmmode\n@err{Disabled command \string\choose }
{No more a valid command. Replace {A \choose B} with \binom A B.}%
\lext\next\relax
\else\let\next\o@choose\fi\next}
which should be robust enough. Can you try it in the context
where my previous solution busted?
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: Re: nath catcode issues
2004-08-07 14:58 ` Giuseppe Bilotta
@ 2004-08-08 19:28 ` Nikolai Weibull
2004-08-25 18:29 ` Giuseppe Bilotta
0 siblings, 1 reply; 8+ messages in thread
From: Nikolai Weibull @ 2004-08-08 19:28 UTC (permalink / raw)
* Giuseppe Bilotta <gip.bilotta@iol.it> [Aug 08, 2004 16:30]:
> ConTeXt ver: 2004.6.30 fmt: 2004.7.27 int: english mes: english
Me too.
> [Example]
Argh, that doesn't happen here...
> This is pdfeTeX, Version 3.141592-1.20a-rc4-2.1 (MiKTeX 2.4)
pdfeTeX (Web2C 7.4.5) 3.14159-1.10b-2.1
I run latest tetex.
> > > It works like that? Excellent.
> > It seems I spoke too soon. It does in fact not work.
> In the meantime, I'm thinking along the lines of something like
> \def\over{%
> \ifmmode\n@err{Disabled command \string\over }
> {No more a valid command. Replace {A \over B} with \frac A B.}%
> \let\next\relax
> \else\let\next\o@over\fi\next}
> \def\atop{%
> \ifmmode\n@err{Disabled command \string\atop }
> {No more a valid command. Use array instead.}%
> \let\next\relax
> \else\let\next\o@atop\fi\next}
> \def\choose{%
> \ifmmode\n@err{Disabled command \string\choose }
> {No more a valid command. Replace {A \choose B} with \binom A B.}%
> \lext\next\relax
> \else\let\next\o@choose\fi\next}
> which should be robust enough. Can you try it in the context
> where my previous solution busted?
I don't remember what busted, but it looks good. It works for my
thesis, which is weird because you misspelled a \let (\lext) and it
still worked fine.
Furthermore, nested parentheses and stuff that produces implicit
parentheses don't scale correctly. In fact, \left and \right don't seem
to work either:
\usemodule[nath]
\starttext
\[ (\frac{a}{b})^2 \]
versus
\[ \left(\frac{a}{b}\right)^2 \]
\stoptext
...,
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: Re: Re: nath catcode issues
2004-08-08 19:28 ` Nikolai Weibull
@ 2004-08-25 18:29 ` Giuseppe Bilotta
0 siblings, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2004-08-25 18:29 UTC (permalink / raw)
Sunday, August 8, 2004 Nikolai Weibull wrote:
> * Giuseppe Bilotta <gip.bilotta@iol.it> [Aug 08, 2004 16:30]:
>> ConTeXt ver: 2004.6.30 fmt: 2004.7.27 int: english mes: english
> Me too.
>> [Example]
> Argh, that doesn't happen here...
>> This is pdfeTeX, Version 3.141592-1.20a-rc4-2.1 (MiKTeX 2.4)
> pdfeTeX (Web2C 7.4.5) 3.14159-1.10b-2.1
> I run latest tetex.
> I don't remember what busted, but it looks good. It works for my
> thesis, which is weird because you misspelled a \let (\lext) and it
> still worked fine.
That part doesn't get reached by your thesis, evidently :)
> Furthermore, nested parentheses and stuff that produces implicit
> parentheses don't scale correctly. In fact, \left and \right don't seem
> to work either:
> \usemodule[nath]
> \starttext
> \[ (\frac{a}{b})^2 \]
> versus
> \[ \left(\frac{a}{b}\right)^2 \]
> \stoptext
This works here :\
Ok, looks like my version of nath and yours are more different
than I thought at first. I'll try to upload a new version in the
next days.
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-08-25 18:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-04 13:36 nath catcode issues Nikolai Weibull
2004-07-05 10:01 ` Giuseppe Bilotta
2004-07-05 10:44 ` Nikolai Weibull
2004-07-05 11:03 ` Giuseppe Bilotta
2004-07-05 12:42 ` Nikolai Weibull
2004-08-07 14:58 ` Giuseppe Bilotta
2004-08-08 19:28 ` Nikolai Weibull
2004-08-25 18:29 ` 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).