login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #324 Bug in width$OutputForm revision 2 of 4

1 2 3 4
Editor: kratt6
Time: 2007/12/20 02:02:14 GMT-8
Note: give more details

changed:
-In 'OutputForm' there is a function 'width' that returns the amount of space taken by some element of 'OutputForm'. For example
In 'OutputForm' there is a function 'width' that returns the amount of space taken by some element of 'OutputForm' when printed as ASCII. For example

added:
)se ou alg on
)se ou tex off
sin x

added:
x^2

added:
\end{axiom}
I would expect 2 here.

\begin{axiom}
1/2

added:
I would expect 1 here.


added:
It would be good to have a similar function for TeX output, by the way.

Submitted by : (unknown) at: 2007-11-17T22:26:34-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

In OutputForm there is a function width that returns the amount of space taken by some element of OutputForm when printed as ASCII. For example

axiom
)se ou alg on
 
axiom
)se ou tex off
sin x
(1) sin(x)
Type: Expression(Integer)
axiom
width((sin x)::OutputForm)$OutputForm
(2) 6
Type: Integer

However, the width for squares and fractions seems to be wrong:

axiom
x^2
2 (3) x
Type: Polynomial(Integer)
axiom
width((x^2)::OutputForm)$OutputForm
(4) 5
Type: Integer

I would expect 2 here.

axiom
1/2
1 (5) - 2
Type: Fraction(Integer)
axiom
width((1/2)::OutputForm)$OutputForm
(6) 5
Type: Integer

I would expect 1 here.

The function is unfortunately not implemented in SPAD but rather calls outformWidth coded in BOOT in the file i-output.boot.

It would be good to have a similar function for TeX? output, by the way. Martin