maxima tex 输出以显示 sin 和 cos 的括号 [英] maxima tex output to show brackets for sin and cos
本文介绍了maxima tex 输出以显示 sin 和 cos 的括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 maxima 的 tex 输出并想改变它输出 sin(x) 的方式.目前确实如此:
I use maxima's tex output and would like to change the way it outputs sin(x). It currently does:
tex(sin(x));
$$\sin x$$
但我想在 x 周围加上括号,但并非总是如此;例如,如果我使用这个:
But I would like to have brackets around the x, but not always; for instance, if i use this:
sin(x/2) already has \left( and \right)
tex(sin(x/2));
\begin{equation} \sin \left({{x}\over{2}}\right) \end{equation}
这可能吗,也许用 texput 函数?
is this possible, maybe with the texput function?
推荐答案
好吧,如果你不反对放入一点 Lisp 代码:
Well, if you are not adverse to putting in a little Lisp code:
(%i1) :lisp (setf (get '%sin 'tex) nil)
(%i1) :lisp (setf (get '%cos 'tex) nil)
这去掉了预定义的处理函数(将 sin 和 cos 视为前缀运算符).然后你得到:
That takes away the predefined handler function (which treats sin and cos as prefix operators). Then you get:
(%i1) tex (sin(x) + cos(y));
$$\cos \left(y\right)+\sin \left(x\right)$$
这篇关于maxima tex 输出以显示 sin 和 cos 的括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文