Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9205 > unrolled thread
| Started by | Scott Colwell <scolwell@uoguelph.ca> |
|---|---|
| First post | 2012-03-23 06:32 +0000 |
| Last post | 2012-03-23 06:32 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Different Color in ToString Scott Colwell <scolwell@uoguelph.ca> - 2012-03-23 06:32 +0000
| From | Scott Colwell <scolwell@uoguelph.ca> |
|---|---|
| Date | 2012-03-23 06:32 +0000 |
| Subject | Re: Different Color in ToString |
| Message-ID | <jkh5dn$jrp$1@smc.vnet.net> |
That is perfect, thanks Alexei.
SC
----- Original Message -----
From: "Alexei Boulbitch" <Alexei.Boulbitch@iee.lu>
Cc: scolwell@uoguelph.ca
Sent: Thursday, 22 March, 2012 5:28:43 AM
Subject: 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@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
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web