Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question

8 views
Skip to first unread message

Rene Grothmann

unread,
Jun 30, 2009, 2:30:19 AM6/30/09
to
(1) Can I change the tex() command to output \frac{a}{b} instead of {a
\over b} at the command tex(a/b). I looked at the texput() docs, but
there seems to be no function for this, or I cannot get it to work
properly.

(2) Can I define a function f(a,b) in Maxima, which works like "foo
a,b" or like "foo a b".

Thanks for any answers

Rene

Robert Dodier

unread,
Jun 30, 2009, 11:09:24 AM6/30/09
to
Rene Grothmann wrote:

> (1) Can I change the tex() command to output \frac{a}{b} instead of {a
> \over b} at the command tex(a/b).

There are a few ways to do it.

(a) load("mactex-utilities.lisp");
which redefines TeX properties for "/" and matrix(...)

(b) or just put this in a file and load it: (copied from mactex-
utilities)
(defun tex-mquotient (x l r)
(if (or (null (cddr x)) (cdddr x)) (wna-err (caar x)))
(setq l (tex (cadr x) (append l '("\\frac{")) nil 'mparen 'mparen)
r (tex (caddr x) (list "}{") (append '("}") r) 'mparen 'mparen))
(append l r))

(c) or this Maxima program: (recently added feature, not sure
when it appeared)
texdiv (e) := concat ("\\frac{", tex1 (first (e)), "}{", tex1 (second
(e)), "}");
texput ("/", texdiv);

> (2) Can I define a function f(a,b) in Maxima, which works like "foo
> a,b" or like "foo a b".

I don't see a way to do it. prefix("foo") tells Maxima to recognize
foo a as operator foo with argument a, but foo a b fails to parse,
and foo a, b parses, but not as you want it (it is equivalent to
ev(foo a, b)). You could write foo [a, b] (so there is one argument,
a list) but that's no better than foo(a, b).

Hope this helps

Robert Dodier

PS. Questions about Maxima are better directed to the Maxima
mailing list. http://maxima.sourceforge.net/maximalist.html

Rene Grothmann

unread,
Jul 1, 2009, 1:45:15 AM7/1/09
to
Thanks a lot.

(a) does not work, because I do not have "mactex-utilities.lisp" in my
distribution (5.16 for Windows). There is only a file mactex.lisp,
which does not do the trick. (b) worked, thanks! (c) does not work, I
tried that already. It still uses \choose.

I might add that I use Maxima as a CAS for Euler, so there might be
some specials. But essentially, Maxima should work completely as
expected.

Thanks

Rene Grothmann

PS: I asked the question in the maximalist mailing list at utexas. I
was not aware of the Sourceforge list.

Raymond Toy

unread,
Jul 1, 2009, 9:12:09 AM7/1/09
to
>>>>> "Rene" == Rene Grothmann <renegr...@googlemail.com> writes:

Rene> But essentially, Maxima should work completely as
Rene> expected.

What does that mean? That Maxima is working or that Maxima is not
working?

Rene> PS: I asked the question in the maximalist mailing list at utexas. I
Rene> was not aware of the Sourceforge list.

The real list is at utexas. I don't think anyone reads the
Sourceforge list. (At least on a regular basis. I certainly don't.)

Ray

0 new messages