MathGroup Archive 2008

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

Search the Archive

Re: Colored Output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87252] Re: Colored Output
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sat, 5 Apr 2008 04:24:54 -0500 (EST)
  • Organization: University of Bergen
  • References: <ft4n1k$3pt$1@smc.vnet.net>

foice.news at gmail.com wrote:
> I would like to have evaluated expression with some costants painted
> in a particular color, just to make reading easier.
> Say my input is
> 
> D[a*Sin[x]]
> 
> and the output should be
> 
> a*Cos[x]
> 
> with colored "a", say magenta.
> 
> Is this achievable, and how? which kind of attributed of the constant
> a should I set?

I don't know much about expression formatting.  While this appears to 
work in a few simple tests, I do not know how robust it is:

MakeBoxes[a, StandardForm] = StyleBox["a", FontColor -> Red]

After this line has been evaluated, the symbol 'a' will be printed in 
red (when output is set to StandardForm).  The formatting rule can be 
removed with

MakeBoxes[a, StandardForm] =.

Szabolcs


  • Prev by Date: Re: Label vertices in Graph to display with GraphPlot
  • Next by Date: Help with Check Function Arguments & Options
  • Previous by thread: Re: Colored Output
  • Next by thread: Re: Colored Output