MathGroup Archive 2012

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

Search the Archive

Re: How Can I Make A String Variable With Styled Text?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128792] Re: How Can I Make A String Variable With Styled Text?
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Sun, 25 Nov 2012 23:26:37 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k8psvt$is4$1@smc.vnet.net>

One should be able to do this with the function Interpretation;
however, Interpretation does not seem to work properly with strings.
I "interpret" that as a bug...

Thus, I believe that one should be able to define

temp = Interpretation[
  Row[{Style["This is boldface.", Bold], "  The rest is not."}],
  "This is boldface.  The rest is not."]

and then be able to execute some thing like,

Characters[temp]

and get the list of characters in the string.  This, however, does not
work.

--David


On Nov 24, 2:31 am, Gregory Lypny <gregory.ly... at videotron.ca> wrote:
> Hello everyone,
>
> I have a string variable
>
> myString = "This is boldface.  The rest is not."
>
> When I execute myString, I want the first sentence to appear in bold type.  Selecting the sentence and formatting it as bold when I create the string does not work.  StringForm will do the trick, as in
>
>         myString = StringForm["`` The rest is not.", Style["This is boldface", Bold]]
>
> but, of course, the Head of myString will no longer be String.  Is there any other way to do this?
>
> Gregory




  • Prev by Date: Numerical expression
  • Next by Date: Re: Model fitting
  • Previous by thread: Re: How Can I Make A String Variable With Styled Text?
  • Next by thread: How to calculate derivative of a vector function