help debugging latex() printing with trace()

43 views
Skip to first unread message

Eric Majzoub

unread,
Oct 26, 2023, 7:03:27 PM10/26/23
to sage-support
I would like to debug the latex printing of an expression that ambiguous.

To reproduce it:
t = var('t')
x = function('x')(t)
latex( diff(x,t)^2 )

This produces ambiguous output, essentially:

partial_t x^2

instead of

(partial_t x)^2

I have tried:
from sage.misc.trace import trace
trace("latex( diff(x,t)^2 )")

but I can't understand in which .py file the translation of "diff" occurs. As I understand the source code, there should be a _latex_(self) for every object or method to display latex code, but I can't seem to find it here.

Any help is greatly appreciated.


Dima Pasechnik

unread,
Oct 27, 2023, 4:12:17 AM10/27/23
to sage-s...@googlegroups.com
This is done in pynac, a Sagemath package written in C++ (a fork of GiNaC)
src/sage/symbolic/pynac.pxi contains the interface to it.

HTH



>
> Any help is greatly appreciated.
>
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/a530254d-9fec-452f-80cd-153d3769d34fn%40googlegroups.com.

Nils Bruin

unread,
Oct 27, 2023, 5:32:10 PM10/27/23
to sage-support
It happens here:


However, the code deciding whether the base of an exponential expression needs parentheses is elsewhere.

Reply all
Reply to author
Forward
0 new messages