## #2667 tex1 of f(x)^n

None
closed
nobody
5
2016-08-24
2013-12-03
David Bevan
No

With simp:false, tex1(sqrt(x)^n) gives "{\it sqrt}^{n}\left(x\right)", which can't possibly be right.

This seems to be part of a more general issue. tex1(f(x)^n) gives "f^{n}\left(x\right)" rather than the expected "f\left(x\right)^{n}". The form given should only be produced if f is sin, cos, etc.

Note that tex1(f(x)^(2*n)) does give "f\left(x\right)^{2\,n}".

## Discussion

• Robert Dodier - 2013-12-04
• labels: --> tex
• Description has changed:

Diff:

--- old
+++ new
@@ -1,4 +1,3 @@
-
With simp:false, tex1(sqrt(x)^n) gives "{\it sqrt}^{n}\left(x\right)", which can't possibly be right.

This seems to be part of a more general issue. tex1(f(x)^n) gives "f^{n}\left(x\right)" rather than the expected "f\left(x\right)^{n}". The form given should only be produced if f is sin, cos, etc.


• Leo Butler - 2016-08-01

Attached is a patch to remedy this bug. The idea is simple: an expression of the form

f(x)^n


can be texed as either

f^n(x)


or

f(x)^n


depending on whether f is "trig-like" (i.e. the first aberration is due tto the convention involving trig functions and their cousins).

tex-mexpt implements something like this, but in a far too inclusive way, which accounts for this bug report.

The patch splits up tex-mexpt into 2 functions, maybe-tex-mexpt-trig-like and tex-mexpt. The first is almost entirely cut from the old tex-mexpt. However, it also queries tex-mexpt-trig-like-fn-p to see if a function is trig-like for the purposes of tex-mexpt. At the moment this is determined by membership in a list, but this could also be treated as a symbol property and texput modified accordingly.

Also attached are the mods to rtest_tex.mac and a diff of the tmp-rtest-4.tex output without and with the patch.

Last edit: Leo Butler 2016-08-01
• Robert Dodier - 2016-08-24
• status: open --> closed

• Robert Dodier - 2016-08-24

I've applied the patch as commit cf9cbb2, thanks Leo. Closing this report.