MathGroup Archive 1997

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

Search the Archive

Formatting Sampler Demo

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8569] Formatting Sampler Demo
  • From: Red <red at nym.alias.net>
  • Date: Sat, 6 Sep 1997 23:16:30 -0400
  • Organization: mail2news@nym.alias.net
  • Sender: owner-wri-mathgroup at wolfram.com

-----BEGIN PGP SIGNED MESSAGE-----

In the Demo notebook "Formatting Sampler" (* for version 3.0 *) that
describes how to put color or boxes around your expressions
there is an error.
(Find the demos in the Help Browser submenus)

In the second section called Manipulating Box Structures
it tells how to see where the rowboxes are by doing the following:

Factor[x^12 - 1]

boxes = ToBoxes[%]

DisplayForm[boxes /. SuperscriptBox -> OverscriptBox]

DisplayForm[(#1 /. a:RowBox[_] -> FrameBox[a] & ) //@ boxes]

The result is not right because it has double boxes
in most places; it doesn't look right.

The correct thing is this:

DisplayForm[ Replace[#, a:RowBox[_] -> FrameBox[a] ]& //@ boxes]

This is correct because of the way the former is evaluated.


The same problem happens in Coloring Box Structures section, 
though not as noticable. To change the DepthColoring 
function change /. (that's ReplaceAll) with Replace:

DepthColoring[expr_]:=
  Module[{b=ToBoxes[expr],d},
    d=2 Depth[
          b];(# ~Replace~
             (x:(_RowBox):>
  StyleBox[x,Background\[Rule]Hue[0.78 Depth[x]/d,.5]]))&//@b]


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBNBEl2rcaab4ltFhVAQEzwQP/S7N4LSyi/N4Jg/uyghF6I9rqOyTvrkMs
5z5pVcwPL5QV8axcjpzhdaNQFS0gwwN6D80ZdROdolpsm6q+hW5M7IPpbIxHu0OA
gL5BVMpxPLyh4UTVNbjBW01oTdWClTePXHBYnj3ZhmP8DUK80ouDx37wwAYce7JT
CFI/R/6+AHg=
=MyxV
-----END PGP SIGNATURE-----


  • Prev by Date: Mathematica on BeOS
  • Next by Date: Something like Flatten
  • Previous by thread: Mathematica on BeOS
  • Next by thread: Something like Flatten