Skip to main content
deleted 16 characters in body
Source Link
Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327

If you evaluate or print the following string you get what you want:

"\!\(\*\nStyleBox[\"text\"\*StyleBox[\"text\",\nFontColorFontColor->RGBColor[1, 0, 0]]\) \!\(\*\nStyleBox[\"text\"\*StyleBox[\"text\",\nFontColorFontColor->RGBColor[0, 0, 1]]\)"

Mathematica graphics

This is a single string and it contains color information for different substrings.

Do[Print@"\!\(\*\nStyleBox[\"text\"\*StyleBox[\"text\",\nFontColorFontColor->RGBColor[1, 0, 0]]\) \!\(\*\nStyleBox[\"text\"\*StyleBox[\"text\",\nFontColorFontColor->RGBColor[0, 0, 1]]\)", {5}]

Mathematica graphics

If you evaluate or print the following string you get what you want:

"\!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[1, 0, 0]]\) \!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[0, 0, 1]]\)"

Mathematica graphics

This is a single string and it contains color information for different substrings.

Do[Print@"\!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[1, 0, 0]]\) \!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[0, 0, 1]]\)", {5}]

Mathematica graphics

If you evaluate or print the following string you get what you want:

"\!\(\*StyleBox[\"text\",FontColor->RGBColor[1, 0, 0]]\) \!\(\*StyleBox[\"text\",FontColor->RGBColor[0, 0, 1]]\)"

Mathematica graphics

This is a single string and it contains color information for different substrings.

Do[Print@"\!\(\*StyleBox[\"text\",FontColor->RGBColor[1, 0, 0]]\) \!\(\*StyleBox[\"text\",FontColor->RGBColor[0, 0, 1]]\)", {5}]

Mathematica graphics

Source Link
Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327

If you evaluate or print the following string you get what you want:

"\!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[1, 0, 0]]\) \!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[0, 0, 1]]\)"

Mathematica graphics

This is a single string and it contains color information for different substrings.

Do[Print@"\!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[1, 0, 0]]\) \!\(\*\nStyleBox[\"text\",\nFontColor->RGBColor[0, 0, 1]]\)", {5}]

Mathematica graphics