MathGroup Archive 2012

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

Search the Archive

Re: Different Color in ToString

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125615] Re: Different Color in ToString
  • From: Helen Read <readhpr at gmail.com>
  • Date: Thu, 22 Mar 2012 05:48:21 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jkcbgl$qed$1@smc.vnet.net>

On 3/21/2012 6:45 AM, Scott Colwell 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,
>

Use Row.

n = 3;
Row[{Style["There is ", Blue], Style[n, Red, Bold],
   Style[" numbers here", Blue]}]

Row can mix strings with expressions, with no need for ToString.

-- 
Helen Read
University of Vermont



  • Prev by Date: Re: Different Color in ToString
  • Next by Date: Re: Different Color in ToString
  • Previous by thread: Re: Different Color in ToString
  • Next by thread: Re: Different Color in ToString