Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Different Color in ToString

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125612] Re: Different Color in ToString
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Thu, 22 Mar 2012 05:47:18 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201203211044.FAA27057@smc.vnet.net>

n = 3;

Row@{Style["There are ", Blue],
  Style[n, Red],
  Style[" numbers here", Blue]}

Row@Thread@Style[
   {"There are ", n, " numbers here"},
   {Blue, Red, Blue}]

Print[Style["There are ", Blue],
 Style[n, Red],
 Style[" numbers here", Blue]]

Print @@ Thread@Style[
   {"There are ", n, " numbers here"},
   {Blue, Red, Blue}]


Bob Hanlon


On Wed, Mar 21, 2012 at 6:44 AM, Scott Colwell <scolwell at uoguelph.ca> wrote:
> Does anyone know how to change the color of the font in a ToString command.
>
> For example, in the following, the text should be blue, but the number 3 should be red.
>
> n = 3;
> Text[Style["There is "<> ToString[Style[n, Red]] <> " numbers here", Blue]]
>
> Thank you,
>



  • Prev by Date: Re: Different Color in ToString
  • Next by Date: Exporting a formula to Excel via copypaste
  • Previous by thread: Re: Different Color in ToString
  • Next by thread: Re: Different Color in ToString