ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \mathstrut in \underbrace and nath
@ 2004-11-17 16:00 Nikolai Weibull
  2004-11-18 15:34 ` Giuseppe Bilotta
  0 siblings, 1 reply; 13+ messages in thread
From: Nikolai Weibull @ 2004-11-17 16:00 UTC (permalink / raw)


Example:

\usemodule[nath]
\starttext
\startnathequation
  \underbrace{\mathstrut rr\dots r}_{n \text{times}}
\stopnathequation
\stoptext

Error:

! Missing } inserted.
<inserted text>
                }
<to be read again>
                   \o@dollar
\o@math ->\o@dollar
                    \relax
\finishddelimbox@ ->\mathclose {} \o@math
                                          \egroup
\delim@l #1#2->\mathopen {} \finishddelimbox@
                                              \put@ {\the \ht \sizebox }\ht@...

\mathph@nt ...tbox \nextbox \voidb@x {$\m@th #1{#2
                                                  }$}
...
l.4 ...race{\mathstrut rr\dots r}_{n \text{times}}

?

My guess is that the expansion of \mathstrut, being \vphantom(, is being
misinterpreted as a delimiter (as '(' is active in nath), but that's
just a layman's guess.
	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] 13+ messages in thread

* Re: \mathstrut in \underbrace and nath
  2004-11-17 16:00 \mathstrut in \underbrace and nath Nikolai Weibull
@ 2004-11-18 15:34 ` Giuseppe Bilotta
  2004-11-18 18:51   ` Nikolai Weibull
  0 siblings, 1 reply; 13+ messages in thread
From: Giuseppe Bilotta @ 2004-11-18 15:34 UTC (permalink / raw)


Wednesday, November 17, 2004 Nikolai Weibull wrote:

> Example:

> \usemodule[nath]
> \starttext
> \startnathequation
>   \underbrace{\mathstrut rr\dots r}_{n \text{times}}
> \stopnathequation
> \stoptext

> Error:

> ! Missing } inserted.
> <inserted text>

[snip]

> My guess is that the expansion of \mathstrut, being \vphantom(, is being
> misinterpreted as a delimiter (as '(' is active in nath), but that's
> just a layman's guess.
> 	nikolai

Bingo. In nath this is now fixed by letting \mathstrut use |
instead of (.

I'll try to get the new amsl and nath modules out today.

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: \mathstrut in \underbrace and nath
  2004-11-18 15:34 ` Giuseppe Bilotta
@ 2004-11-18 18:51   ` Nikolai Weibull
  2004-11-19 15:12     ` Christopher Creutzig
  0 siblings, 1 reply; 13+ messages in thread
From: Nikolai Weibull @ 2004-11-18 18:51 UTC (permalink / raw)


* Giuseppe Bilotta <gip.bilotta@iol.it> [Nov 18, 2004 16:40]:
> > \usemodule[nath]
> > \starttext
> > \startnathequation
> >   \underbrace{\mathstrut rr\dots r}_{n \text{times}}
> > \stopnathequation
> > \stoptext

> > Error:

> > ! Missing } inserted.
> > <inserted text>

> > My guess is that the expansion of \mathstrut, being \vphantom(, is being
> > misinterpreted as a delimiter (as '(' is active in nath), but that's
> > just a layman's guess.

> Bingo. In nath this is now fixed by letting \mathstrut use |
> instead of (.

:-)

> I'll try to get the new amsl and nath modules out today.

Thanks, great work.

I don't want to rain on your parade, but I just found another bug:

\usemodule[nath]
\starttext
$A \longrightarrow B$
\stoptext

gives

! Undefined control sequence.
\dodosmash [#1]->\edef \@@smash
                                {#1}\futurelet \nexttoken \dododosmash
\relbar ->\mathrel {\smash
                           -}
\longrightarrow ->\relbar
                          \joinrel \rightarrow
<argument> A \longrightarrow
                             B
\inlinemath ...inemath@ {\noexpand \wrapfrac@ { #1
                                                  }} \endgroup \protectinlin...

\imath@ ...mathoptions@on \o@math \inlinemath {#1}
                                                  \o@math \mathoptions@off
...
l.19 $A \longrightarrow B$

? 

which seems a bit more difficult to fix.  I can't do it anyway,
	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] 13+ messages in thread

* Re: \mathstrut in \underbrace and nath
  2004-11-18 18:51   ` Nikolai Weibull
@ 2004-11-19 15:12     ` Christopher Creutzig
  2004-11-19 15:38       ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Christopher Creutzig @ 2004-11-19 15:12 UTC (permalink / raw)


Nikolai Weibull wrote:

> ! Undefined control sequence.
> \dodosmash [#1]->\edef \@@smash
>                                 {#1}\futurelet \nexttoken \dododosmash
> \relbar ->\mathrel {\smash
>                            -}

  Uh-uh.  The problem is clear: \inlinemath tries (in the definition of 
\inlinemath@) to expand the formula (in the sense of TeX macro 
expansion).  \longrightarrow cum suis are, however, not expandable in 
ConTeXt.

  Now, I do believe the xdef is a bug in nath, but the following 
workaround does work:

\protected\def\longrightarrow    {\relbar\joinrel\rightarrow}

  Hans, do you have a command that sort of changes an existing 
definition as if \protected had been used in the first place?

regards,
	Christopher

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

* Re: \mathstrut in \underbrace and nath
  2004-11-19 15:12     ` Christopher Creutzig
@ 2004-11-19 15:38       ` Hans Hagen
  2004-11-19 15:58         ` Christopher Creutzig
  2004-11-19 17:16         ` Nikolai Weibull
  0 siblings, 2 replies; 13+ messages in thread
From: Hans Hagen @ 2004-11-19 15:38 UTC (permalink / raw)


Christopher Creutzig wrote:
> Nikolai Weibull wrote:
> 
>> ! Undefined control sequence.
>> \dodosmash [#1]->\edef \@@smash
>>                                 {#1}\futurelet \nexttoken \dododosmash
>> \relbar ->\mathrel {\smash
>>                            -}
> 
> 
>  Uh-uh.  The problem is clear: \inlinemath tries (in the definition of 
> \inlinemath@) to expand the formula (in the sense of TeX macro 
> expansion).  \longrightarrow cum suis are, however, not expandable in 
> ConTeXt.
> 
>  Now, I do believe the xdef is a bug in nath, but the following 
> workaround does work:
> 
> \protected\def\longrightarrow    {\relbar\joinrel\rightarrow}
> 
>  Hans, do you have a command that sort of changes an existing definition 
> as if \protected had been used in the first place?

first of all, \protected is not what you think it is; i had a \protected before 
etex was around; the context name is \unexpanded

\let\unprotectedlongrightarrow\longrightarrow
\unexpanded\def\longrightarrow{\unprotectedlongrightarrow}


Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: \mathstrut in \underbrace and nath
  2004-11-19 15:38       ` Hans Hagen
@ 2004-11-19 15:58         ` Christopher Creutzig
  2004-11-19 17:34           ` Hans Hagen
  2004-11-19 17:16         ` Nikolai Weibull
  1 sibling, 1 reply; 13+ messages in thread
From: Christopher Creutzig @ 2004-11-19 15:58 UTC (permalink / raw)


Hans Hagen wrote:

> first of all, \protected is not what you think it is; i had a \protected 
> before etex was around; the context name is \unexpanded

  Ok, then what's \protected?  Is it performing an \unprotect/\protect 
pair around the definition?  But then, why did it work?

> \let\unprotectedlongrightarrow\longrightarrow
> \unexpanded\def\longrightarrow{\unprotectedlongrightarrow}

  Yes, I'd though of that, I justwanted to know if there is some higher 
level version already existing.

regards,
	ccr

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

* Re: \mathstrut in \underbrace and nath
  2004-11-19 15:38       ` Hans Hagen
  2004-11-19 15:58         ` Christopher Creutzig
@ 2004-11-19 17:16         ` Nikolai Weibull
  2004-11-19 17:53           ` Re[2]: " Giuseppe Bilotta
  1 sibling, 1 reply; 13+ messages in thread
From: Nikolai Weibull @ 2004-11-19 17:16 UTC (permalink / raw)


* Hans Hagen <pragma@wxs.nl> [Nov 19, 2004 16:40]:
> \let\unprotectedlongrightarrow\longrightarrow
> \unexpanded\def\longrightarrow{\unprotectedlongrightarrow}

Thanks, that works fine,
	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] 13+ messages in thread

* Re: \mathstrut in \underbrace and nath
  2004-11-19 15:58         ` Christopher Creutzig
@ 2004-11-19 17:34           ` Hans Hagen
  2004-11-22  9:20             ` Christopher Creutzig
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2004-11-19 17:34 UTC (permalink / raw)


Christopher Creutzig wrote:
> Hans Hagen wrote:
> 
>> first of all, \protected is not what you think it is; i had a 
>> \protected before etex was around; the context name is \unexpanded
> 
> 
>  Ok, then what's \protected?  Is it performing an \unprotect/\protect 
> pair around the definition?  But then, why did it work?
> 
>> \let\unprotectedlongrightarrow\longrightarrow
>> \unexpanded\def\longrightarrow{\unprotectedlongrightarrow}

ah, i though that you wanted the etex \protected -)

in context protext/unprotect is to be used when ! @ ? are used inmacro names 
which was not the case here

>  Yes, I'd though of that, I justwanted to know if there is some higher 
> level version already existing.

nop

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re[2]: \mathstrut in \underbrace and nath
  2004-11-19 17:16         ` Nikolai Weibull
@ 2004-11-19 17:53           ` Giuseppe Bilotta
  2004-11-19 22:10             ` h h extern
  0 siblings, 1 reply; 13+ messages in thread
From: Giuseppe Bilotta @ 2004-11-19 17:53 UTC (permalink / raw)


Friday, November 19, 2004 Nikolai Weibull wrote:

> * Hans Hagen <pragma@wxs.nl> [Nov 19, 2004 16:40]:
>> \let\unprotectedlongrightarrow\longrightarrow
>> \unexpanded\def\longrightarrow{\unprotectedlongrightarrow}

> Thanks, that works fine,
> 	nikolai

Shall this go in nath? Or, Hans, will you protect those macros?

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: \mathstrut in \underbrace and nath
  2004-11-19 17:53           ` Re[2]: " Giuseppe Bilotta
@ 2004-11-19 22:10             ` h h extern
  2004-11-20 11:35               ` Re[2]: " Giuseppe Bilotta
  0 siblings, 1 reply; 13+ messages in thread
From: h h extern @ 2004-11-19 22:10 UTC (permalink / raw)


Giuseppe Bilotta wrote:

> Shall this go in nath? Or, Hans, will you protect those macros?

if so, i need to protect the lot, any system/logic behind what to protect ?

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re[2]: \mathstrut in \underbrace and nath
  2004-11-19 22:10             ` h h extern
@ 2004-11-20 11:35               ` Giuseppe Bilotta
  2004-11-21 22:19                 ` h h extern
  0 siblings, 1 reply; 13+ messages in thread
From: Giuseppe Bilotta @ 2004-11-20 11:35 UTC (permalink / raw)


Friday, November 19, 2004 h h extern wrote:

> Giuseppe Bilotta wrote:

>> Shall this go in nath? Or, Hans, will you protect those macros?

> if so, i need to protect the lot, any system/logic behind what to protect ?

I have no idea. Everything? What's the downside of protecting a
macro?

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: \mathstrut in \underbrace and nath
  2004-11-20 11:35               ` Re[2]: " Giuseppe Bilotta
@ 2004-11-21 22:19                 ` h h extern
  0 siblings, 0 replies; 13+ messages in thread
From: h h extern @ 2004-11-21 22:19 UTC (permalink / raw)


Giuseppe Bilotta wrote:
> Friday, November 19, 2004 h h extern wrote:
> 
> 
>>Giuseppe Bilotta wrote:
> 
> 
>>>Shall this go in nath? Or, Hans, will you protect those macros?
> 
> 
>>if so, i need to protect the lot, any system/logic behind what to protect ?
> 
> 
> I have no idea. Everything? What's the downside of protecting a
> macro?

sometimes you want it to be expandable

\unexpanded\def\blabla{\handle{blabla}}

will not expand even if \handle is expandable (could be a problem in for 
instance fallbacks for pdf bookmarks and such)

\def\blabla{\handle{blabla}}

now one can overload \handle, and \handle can be protected if needed

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: \mathstrut in \underbrace and nath
  2004-11-19 17:34           ` Hans Hagen
@ 2004-11-22  9:20             ` Christopher Creutzig
  0 siblings, 0 replies; 13+ messages in thread
From: Christopher Creutzig @ 2004-11-22  9:20 UTC (permalink / raw)


Hans Hagen wrote:

>>  Ok, then what's \protected?  Is it performing an \unprotect/\protect 
>> pair around the definition?  But then, why did it work?

> in context protext/unprotect is to be used when ! @ ? are used inmacro 
> names which was not the case here

  I know.  So, does ConTeXt's \protected\def temporarily switch on one 
level of \unprotect?  But for some strange reason, the whole thing 
worked ...

regards,
	Christopher

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

end of thread, other threads:[~2004-11-22  9:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-17 16:00 \mathstrut in \underbrace and nath Nikolai Weibull
2004-11-18 15:34 ` Giuseppe Bilotta
2004-11-18 18:51   ` Nikolai Weibull
2004-11-19 15:12     ` Christopher Creutzig
2004-11-19 15:38       ` Hans Hagen
2004-11-19 15:58         ` Christopher Creutzig
2004-11-19 17:34           ` Hans Hagen
2004-11-22  9:20             ` Christopher Creutzig
2004-11-19 17:16         ` Nikolai Weibull
2004-11-19 17:53           ` Re[2]: " Giuseppe Bilotta
2004-11-19 22:10             ` h h extern
2004-11-20 11:35               ` Re[2]: " Giuseppe Bilotta
2004-11-21 22:19                 ` h h extern

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