This question explains how to set the tex output for a function to be handled analogously to powers on trigonometric functions; however, I was wondering how it would have to be modified if one wanted to change the actual commands used for the parentheses?
\cos \left( <arg> \right)
introduces an inappropriate space between the cos
and the first parenthesis. This can be compensated for by inserting \mathopen{}
between \cos
and \left(
, i.e.:
\cos\mathopen{} \left( <arg> \right)
However, while texput(cos, lambda([e], [a]:args(e), printf(false, "\\cos \\mathopen{} \\left( ~a \\right)", tex1(a))))
renders the desired adjustment for something like cos(<arg>)
, anything involving powers, such as cos(<arg>)^2
returns to the default handling of cos
.
Because cos
is already in the list of *tex-mexpt-trig-like-fns*
, I wasn't certain how to get the desired handling for parentheses, when there are exponents.