I'm constructing a function that gives me subindices in output.
The function is HAt
.
For example:
HAt[u == u0, t -> 0]
The function is constructed following:
HAt/:MakeBoxes[HAt[eq_, x_-> n_], StandardForm]:=
RowBox[
{SubscriptBox[
RowBox[{"", ToBoxes[eq[[1]]], ")"}],
RowBox[{ToBoxes[x], "=", ToBoxes[n]}]],
"\[Equal]",
SubscriptBox[
RowBox[{"(", ToBoxes[eq[[2]]], ")"}],
RowBox[{ToBoxes[x],"=",ToBoxes[n]}]]}]
So, the problema is when the right-hand (or left-hand) of my equation is a number. For example, if I put:
HAt[u == 0, t -> 0]
But I want some like this:
I think the ideia is put some condition at eq[[2]]
when this term is a numerical term, some like that:
HAt/:MakeBoxes[HAt[eq_, x_ -> n_] /; eq[[2]]_Numeric, StandardForm] :=
RowBox[
{SubscriptBox[
RowBox[{"(",ToBoxes[eq[[1]]],")"}],
RowBox[{ToBoxes[x], "=", ToBoxes[n]}]],
"\[Equal]",
ToBoxes[eq[[2]]]}]
But the above doesn't work. How do I write the condition I want to enforce correctly?
PatternTest
? AlsoNumeric
isn't a thing...NumericQ
is though. $\endgroup$ – b3m2a1 Jan 29 '19 at 21:01