Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Strings with different Styles in a Grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122481] Re: Strings with different Styles in a Grid
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
  • Date: Sat, 29 Oct 2011 07:14:28 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j8dteq$kfm$1@smc.vnet.net>

On Fri, 28 Oct 2011 10:42:50 +0100, Don <donabc at comcast.net> wrote:

> Here is a Grid of strings, with some strings having different styles.
>
> Grid[{{Style["aa", Red, Bold], Style["bb", Green]}, {"cc", "dd"}}]
>
> The "cc" string should be output with the first "c" in the color Blue and
> in Bold, the second "c" should be in the color Red.
>
> How does one "break apart" the "cc" string to give each "c" a different  
> style
> while still maintaining it as a single item for the Grid function?
>
> Something like this, which is very intuitive, simply doesn't work
>
> Grid[{{Style["aa", Red, Bold], Style["bb", Green]},
>   {{Style["c", Blue, Bold], Style["c", Red]}, "dd"}}]
>
>
> And this, doesn't work either  ...
>
> Grid[{{Style["aa", Red, Bold], Style["bb", Green]},
>   {StringJoin[Style["c", Blue, Bold], Style["c", Red]], "dd"}}]
>
> Thank you in advance.
>
> Don
>

Try:

Grid[{
  {Style["aa", Red, Bold], Style["bb", Green]},
  {Row[{Style["c", Blue, Bold], Style["c", Red]}], "dd"}
}]



  • Prev by Date: Re: Matematica Beginner/Student and Mysql
  • Next by Date: Re: Matematica Beginner/Student and Mysql
  • Previous by thread: Re: Strings with different Styles in a Grid
  • Next by thread: Re: Strings with different Styles in a Grid