You can use a variation of the following idea where I fix a similar issue with Solve:
$Notations = Alternatives[
Subscript, Superscript, Subsuperscript, SubPlus, SubMinus, SubStar, SuperPlus,
SuperMinus, SuperStar, SuperDagger, Overscript, Underscript, Underoverscript,
OverBar, OverVector, OverTilde, OverHat, OverDot, UnderBar
];
Unprotect[D];
D[a__] /; !FreeQ[{a}, $Notations[__]] := Block[{CompressedData},
With[{z=Unevaluated[D[a]] /. s:$Notations[__] :> CompressedData[Compress[s]]},
z /; !MatchQ[z,_D]
]
]
Protect[D];
Then:
D[t Subscript[t,0] + t^2, t]
2 t + Subscript[t, 0]
Attributes[Subscript] = {Constant, NHoldAll}. – Goofy Jan 23 '24 at 16:43Subscript[t, 0]uset0and format it to look likeSubscript[t, 0], i.e.,Format[t0] = Subscript["t", 0];ThenD[t0, t]evaluates to0– Bob Hanlon Jan 23 '24 at 17:55