New answers tagged

2

Just an extension to Alexei Boulbitch's answer: if you want to highlight x, you can change the function to: Clear[rule]; expr = Expand[(x + y) (x + z) (x + w)]; rule[x_] := {Power[x, y_] :> Power[x, y], x :> Style[x, Background -> Yellow]}


2

Try this: expr = Expand[(x + y) (x + z) (x + w)]; rule[x_] := x -> Style[x, Background -> Yellow]; Then you may apply the rule to the expression as follows expr /. rule[x^3] with the effect or expr /. rule[x^2] giving but the most simple substitution expr /. rule[x] does not work, since it highlights all terms containing x. But ...


2

One way could be using a Style. Expand[(x + y) (x + z) (x + w)] /. {x^2 -> Style[x^2, Red, Background -> LightBlue]}



Top 50 recent answers are included