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

MathGroup Archive 2010

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

Search the Archive

StringForm v.s Row

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111478] StringForm v.s Row
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Tue, 3 Aug 2010 06:34:30 -0400 (EDT)
  • Reply-to: murray at math.umass.edu

For creating labeled output, one might use either of the following sorts 
of expressions:

   StringForm["x = ``", x/.First@Solve[3x-4==0,x]]

   Row[{"x = ", x/.First@Solve[3x-4==0,x]}]

The resulting Output cells look the same, although the underlying 
expressions in those Output cells are not. Is one form preferable to the 
other, from the viewpoint of the appearance of the output, etc.?

[Yes, I realize that StringForm["controlstring", expr1,...] is doubtless 
what you'd want to use if:

   (1) the output were going to use the same value in more than one 
place in the control string or were going to permute the order of two or 
more expression values when they get inserted into the controlstring's 
"slots"; or

   (2) you wanted to include template text both before and after the 
value to be inserted and you wanted to isolate the text labeling from 
the expression whose value was to be inserted.]

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Simple Q
  • Next by Date: Re: Re: assuming certain properties about variables
  • Previous by thread: Re: Simple Q
  • Next by thread: Re: Brillouin function for a Ferromagnet