Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9191

Re: Different Color in ToString

From Helen Read <readhpr@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Different Color in ToString
Date 2012-03-22 10:49 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jkf03l$8i4$1@smc.vnet.net> (permalink)
References <jkcbgl$qed$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Different Color in ToString Scott Colwell <scolwell@uoguelph.ca> - 2012-03-21 10:45 +0000
  Re: Different Color in ToString David Reiss <dbreiss@gmail.com> - 2012-03-22 10:48 +0000
  Re: Different Color in ToString Helen Read <readhpr@gmail.com> - 2012-03-22 10:49 +0000

csiph-web