0

I am wondering how would you print the expression with color using function Print. For example, I tried the code below but the output of print function is just black. Is there a method to choose the color for both my result and x+y+z in the code below?

result = x + y + z; 

Print[" my result =  ", result]
b3m2a1
  • 46,870
  • 3
  • 92
  • 239
emnha
  • 2,101
  • 13
  • 26
  • Use Style. Anything you wrap in Style will display with that Style. You can do much more interesting things than just Print. – b3m2a1 Mar 22 '18 at 08:37
  • I tried that but result above can be any expression not just x+y+z. So how do I use style? – emnha Mar 22 '18 at 08:46
  • You read the documentation for Style and then it's obvious... But if you need an explicit answer: e.g. Style[result, Red]. Get rid of the Print. You don't need it. Use Row instead. – b3m2a1 Mar 22 '18 at 08:48
  • I'd like to color both myresult and the expression of result. How can I use both in Style? – emnha Mar 22 '18 at 08:51
  • Look up Row. And read the documentation. Please. It lays it out. – b3m2a1 Mar 22 '18 at 08:52

0 Answers0