ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug report, \frac as redefined in m-newmat.tex
@ 2004-08-02  8:44 Brooks Moses
  2004-08-02 20:40 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Brooks Moses @ 2004-08-02  8:44 UTC (permalink / raw)


The following simple file works fine if I comment out the 
\usemodule[newmat] line, but crashes if I put it in.

   \usemodule[newmat]
   \starttext
   \placeformula
    \startformula
    \eqalign{\frac{1}{2} \cr}
    \stopformula
   \stoptext

- Brooks

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

* Re: Bug report, \frac as redefined in m-newmat.tex
  2004-08-02  8:44 Bug report, \frac as redefined in m-newmat.tex Brooks Moses
@ 2004-08-02 20:40 ` Hans Hagen
  2004-08-03 18:30   ` Brooks Moses
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2004-08-02 20:40 UTC (permalink / raw)


Hi Brooks

> The following simple file works fine if I comment out the 
> \usemodule[newmat] line, but crashes if I put it in.
>
>   \usemodule[newmat]
>   \starttext
>   \placeformula
>    \startformula
>    \eqalign{\frac{1}{2} \cr}
>    \stopformula
>   \stoptext


ah ... the alignment lookahead problem, i think we can safely patch 
\mathematics to catch lookahead as well as make frac more robust for 
unwanted expansion

\usemodule[newmat]

\unexpanded\def\frac#1#2{\mathematics{\genfrac{}{}{}\donothing{#1}{#2}}}

\def\mathematics#1{\relax\ifmmode#1\else$#1$\fi}

\starttext

\placeformula
\startformula
\eqalign{\frac{1}{2}}
\stopformula

\stoptext 

-----------------------------------------------------------------
                                          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] 6+ messages in thread

* Re: Bug report, \frac as redefined in m-newmat.tex
  2004-08-02 20:40 ` Hans Hagen
@ 2004-08-03 18:30   ` Brooks Moses
  2004-08-03 22:14     ` Hans Hagen Outside
  0 siblings, 1 reply; 6+ messages in thread
From: Brooks Moses @ 2004-08-03 18:30 UTC (permalink / raw)


At 01:40 PM 8/2/2004, you wrote:
>ah ... the alignment lookahead problem, i think we can safely patch 
>\mathematics to catch lookahead as well as make frac more robust for 
>unwanted expansion
>
>\usemodule[newmat]
>
>\unexpanded\def\frac#1#2{\mathematics{\genfrac{}{}{}\donothing{#1}{#2}}}
>
>\def\mathematics#1{\relax\ifmmode#1\else$#1$\fi}
[...]

That fixes the problem on my end; thanks!

Will you be updating the defintions of \tfrac, \dfrac, and so forth in 
m-newmat to match?  I admit to not being too sure whether I think it's a 
good idea to support using math constructs such as \frac outside of math 
mode, but I do think that if one's going to do that, it's good to be 
consistent and do it with the variants too.

- Brooks

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

* Re: Bug report, \frac as redefined in  m-newmat.tex
  2004-08-03 18:30   ` Brooks Moses
@ 2004-08-03 22:14     ` Hans Hagen Outside
  2004-08-03 22:52       ` Brooks Moses
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen Outside @ 2004-08-03 22:14 UTC (permalink / raw)


Brooks Moses wrote:

> At 01:40 PM 8/2/2004, you wrote:
>
>> ah ... the alignment lookahead problem, i think we can safely patch 
>> \mathematics to catch lookahead as well as make frac more robust for 
>> unwanted expansion
>>
>> \usemodule[newmat]
>>
>> \unexpanded\def\frac#1#2{\mathematics{\genfrac{}{}{}\donothing{#1}{#2}}}
>>
>> \def\mathematics#1{\relax\ifmmode#1\else$#1$\fi}
>
> [...]
>
> That fixes the problem on my end; thanks!
>
> Will you be updating the defintions of \tfrac, \dfrac, and so forth in 
> m-newmat to match?  I admit to not being too sure whether I think it's 
> a good idea to support using math constructs such as \frac 

do they need patching? they don't use \mathematics afaik

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] 6+ messages in thread

* Re: Bug report, \frac as redefined in  m-newmat.tex
  2004-08-03 22:14     ` Hans Hagen Outside
@ 2004-08-03 22:52       ` Brooks Moses
  2004-08-04  8:30         ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Brooks Moses @ 2004-08-03 22:52 UTC (permalink / raw)


On Wed, Aug 04, 2004 at 12:14:29AM +0200, Hans Hagen Outside wrote:
> Brooks Moses wrote:
> > That fixes the problem on my end; thanks!
> >
> > Will you be updating the defintions of \tfrac, \dfrac, and so forth in 
> > m-newmat to match?  I admit to not being too sure whether I think it's 
> > a good idea to support using math constructs such as \frac 
> 
> do they need patching? they don't use \mathematics afaik

They don't need patching in the sense of fixing a bug, no -- it's more a
matter of consistency in behavior.

What I see is that there's a list of definitions for \frac, \dfrac,
\tfrac, and various other similar forms, all of which can be used in
math mode only, and do not use \mathematics.

Then, a couple of lines after that, there's the second definition for
\frac, which is the one that needed patching.  This one, unlike the
first definition, is wrapped in \mathematics so that it can work outside
math mode.

So I'm wondering why only \frac has this second definition that allows
it to work outside of math mode.  I would think that things should be
consistent -- either that all of the definitions in the first list
should be changed to use \mathematics, or that \frac should be returned
to the simpler version -- so that \tfrac is still simply "\frac typeset
in text mode" as one would expect it to be.

Even if they're all left in the current form, I'd think that the unused
definition of \frac in the first list should be removed.

My argument for simplifying \frac to take the \mathematics out of it is
that it is a math-mode construct that typesets its arguments in math
mode, and allowing it to be used outside of math mode encourages sloppy
TeXing.  It also hides the point of transition to math mode, meaning
that x and \frac{1}{x} will typeset x differently, which strikes me as
confusing.  I recognize that this is a very debatable position, though,
and that there are at the very least arguments for backwards
compatiblity that contradict it.

- Brooks

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

* Re: Bug report, \frac as redefined in  m-newmat.tex
  2004-08-03 22:52       ` Brooks Moses
@ 2004-08-04  8:30         ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2004-08-04  8:30 UTC (permalink / raw)


Hi Brooks,

>Then, a couple of lines after that, there's the second definition for
>\frac, which is the one that needed patching.  This one, unlike the
>first definition, is wrapped in \mathematics so that it can work outside
>math mode.
>
>So I'm wondering why only \frac has this second definition that allows
>it to work outside of math mode.  I would think that things should be
>consistent -- either that all of the definitions in the first list
>should be changed to use \mathematics, or that \frac should be returned
>to the simpler version -- so that \tfrac is still simply "\frac typeset
>in text mode" as one would expect it to be.
>  
>
this has a historical reason; it was added because latex users expect 
\frac to be there and to work in text mode as well;

>Even if they're all left in the current form, I'd think that the unused
>definition of \frac in the first list should be removed.
>  
>
well, just consider it not to be there; it should definitely not be 
mentioned in manuals -)

>My argument for simplifying \frac to take the \mathematics out of it is
>that it is a math-mode construct that typesets its arguments in math
>mode, and allowing it to be used outside of math mode encourages sloppy
>TeXing.  It also hides the point of transition to math mode, meaning
>that x and \frac{1}{x} will typeset x differently, which strikes me as
>confusing.  I recognize that this is a very debatable position, though,
>and that there are at the very least arguments for backwards
>compatiblity that contradict it.
>  
>
if i remember right (maybe tobias burnus remembers more) it was mainly meant to be used in section titles; in such cases, when one sets a font  explicitly, math is often not set up accordingly and frac permits one to do at least fractions 

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] 6+ messages in thread

end of thread, other threads:[~2004-08-04  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-02  8:44 Bug report, \frac as redefined in m-newmat.tex Brooks Moses
2004-08-02 20:40 ` Hans Hagen
2004-08-03 18:30   ` Brooks Moses
2004-08-03 22:14     ` Hans Hagen Outside
2004-08-03 22:52       ` Brooks Moses
2004-08-04  8:30         ` Hans Hagen

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