Re: Different Color in ToString
- To: mathgroup at smc.vnet.net
- Subject: [mg125629] Re: Different Color in ToString
- From: Scott Colwell <scolwell at uoguelph.ca>
- Date: Fri, 23 Mar 2012 01:31:40 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
That is perfect, thanks Alexei. SC ----- Original Message ----- From: "Alexei Boulbitch" <Alexei.Boulbitch at iee.lu> To: mathgroup at smc.vnet.net Cc: scolwell at uoguelph.ca Sent: Thursday, 22 March, 2012 5:28:43 AM Subject: [mg125629] Different Color in ToString 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 I would do as follows: myNr[x_Numeric] := Text@Style[ToString[x], Red]; myText[x_String] := Text@Style[x, Blue]; n = 3; Row[{myText["There is "], myNr[n], myText[" numbers here"]}] Try it. Have fun, Alexei Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone=C2 : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu -- Scott R. Colwell, Ph.D. Associate Professor, Dept. of Mkt/Cons Studies Adjunct Professor, Dept. of Psychology MINS Building 201a University of Guelph Guelph, Ontario, Canada, N1G 2W1
- Follow-Ups:
- Re: Different Color in ToString
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: Different Color in ToString