How to consistently define StandardForm for output?
- To: mathgroup at smc.vnet.net
- Subject: [mg125851] How to consistently define StandardForm for output?
- From: Yi Wang <tririverwangyi at gmail.com>
- Date: Thu, 5 Apr 2012 05:47:27 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I defined a function PD[f_, x_]. To be more readable, I want to display it as =E2=88=82=E2=82=93f. Thus I defined Format[PD[f_, x_]] := RowBox[{SubscriptBox["\[PartialD]", x], f}] // DisplayForm However, when I copy the output "=E2=88=82=E2=82=93f" to new input and evaluate, I get result "0" because now =E2=88=82=E2=82=93f is interpreted as D[f, x], not the new function I defined. My question is: How to define PD[f_, x_] such that it displays as =E2=88=82=E2=82=93f and when I copy the output =E2=88=82=E2=82=93f to new input, it still means PD[f_, x_]? PS: It should be possible because I see a Mathematica package (xAct) can do that. But the package is huge and I failed to read its source code and see how it is accomplished.