Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Constructing a Label

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93375] Re: Constructing a Label
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Wed, 5 Nov 2008 04:55:02 -0500 (EST)
  • References: <gepb15$sfr$1@smc.vnet.net>

Nikolaus Rath schrieb:
> Hello,
> 
> I want to automatically construct labels of the form
> "A = <value of A>" for a number of plots.
> 
> However, I cannot quite figure out how to generate the above
> expression. My first idea was to construct it as a string
> 
> label = "A = " <> ToString[A]
> 
> but this looks horribly if A is more complicated than just a single
> literal. So I assume that I have to "concatenate" the Mathematica
> expressions "A = " and A (rather than the stringified A). But how do I
> do that? My feeble attempts with
> 
> label = RowBox["A", "=", A]

For Version 6 you are close, this should work:

label=Row[{"A","=",A}]

for earlier versions you would need something like:

label=DisplayForm[RowBox[{"A","=",ToBoxes[A]}]]

but that also depends a little on what you will then do with label...

hth,

albert


  • Prev by Date: Re: LabeledListPlot
  • Next by Date: Re: Mathematica Help Urgent (Very New Beginner)
  • Previous by thread: RE: Constructing a Label
  • Next by thread: Re: Constructing a Label