From: Leo B. <Leo...@um...> - 2023-08-29 17:42:51
|
On Tue, Aug 29 2023, Eduardo Ochs <edu...@gm...> wrote: > Hi list, > > In this message > > https://sourceforge.net/p/maxima/mailman/message/37875807/ > > Leo Butler showed a texput that makes tex1 use \frac instead of \over. > But I just noticed that when I use "display2d:'emaxima$" his texput > makes d/dx be displayed as 1/x... and I don't know how to debug that. > Help, please? emaxima is a red herring. The correction is to bind simp to false in the body of the lattex-er: texput("/", lambda([r], block([n,d,simp:false], n:num(r), d:denom(r), printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))))$ The function tex-d (src/mactex.lisp) creates a quotient with d in numerator and denominator. If simp=true, then that common factor is cancelled. Hence the puzzling form of output and your question. With that change: (%i12) tex('diff(f(x),x)) $ $$\frac{d}{d\,x}\,f\left(x\right)$$ (%i13) tex('diff(f(x,y),x,1,y,1)) $ $$\frac{d^2}{d\,x\,d\,y}\,f\left(x , y\right)$$ Best, Leo > > Here is the code: > > load("/home/edrx/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.lisp")$ > display2d:'emaxima$ > a/b; > 'diff(y,x); > texput("/", lambda([r], > block([n,d], > n:num(r), > d:denom(r), > printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))))$ > a/b; > 'diff(y,x); > > When I run it in a REPL I get this: > > (%i1) > load("/home/edrx/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.lisp")$ > > (%i2) display2d:'emaxima$ > > (%i3) a/b; > (%o3) {{a}\over{b}} > (%i4) 'diff(y,x); > (%o4) {{d}\over{d\,x}}\,y > (%i5) texput("/", lambda([r], > block([n,d], > n:num(r), > d:denom(r), > printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))))$ > > (%i6) a/b; > (%o6) \frac{a}{b} > (%i7) 'diff(y,x); > (%o7) \frac{1}{x}\,y > (%i8) > > Thanks in advance! > Eduardo Ochs > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |