display square of derivative in LaTeX needs parenthesis

asked 1 year ago

QMeqGR gravatar image

Using %display latex

diff(x,t)^2 is displayed in LaTeX as

\frac{\partial}{\partial t}x^2

This is confusing when looking at the LaTeX output. It should have an extra set of parenthesis

(\frac{\partial}{\partial t}x)^2

Is there a way to get this to display correctly, or to use \frac{\partial x}{\partial t}?

Preview: (hide)

Comments

Indeed :

sage: latex(diff(x,t)^2)
\frac{\partial}{\partial t}x\left(t\right)^{2}

i e. tx(t)2.

OTOH :

sage: latex(diff(x^2,t))
2 \, x\left(t\right) \frac{\partial}{\partial t}x\left(t\right)

i.e. 2x(t)tx(t).

No ambiguity there...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 1 year ago )