MathGroup Archive 2008

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

Search the Archive

RE: Formatting Problem with Summation Symbol

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88582] RE: [mg88550] Formatting Problem with Summation Symbol
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 9 May 2008 03:23:32 -0400 (EDT)
  • References: <200805080813.EAA14300@smc.vnet.net> <11438836.1210253438999.JavaMail.root@m02>

Here is an elaboration that saves us from wrapping every statement in Style.
Column is actually a type of GridBox and the option to use here is
AllowScriptLevelChange. We write a definition that allows us to combine a
series of statements into a single output cell.

Derivation::usage = 
  "Derivation[step1,step2,...] will display a series of Mathematica \
statements as a single Column output cell.";
SyntaxInformation[Derivation] = {"ArgumentsPattern" -> {__}};
Derivation[steps__] :=
 Column[{steps}, Left, 1, 
  BaseStyle -> {GridBoxOptions -> {AllowScriptLevelChange -> False}}]

Then an example of its use might be:

Derivation[
 Style[Row[{"The first step involves an intgral: " , 
    Sum[a[n] x^n, {n, 0, N}], " with ", a[n] -> Sin[n x]}], 
  ScriptLevel -> 1],
 
 step1 = p[x] == HoldForm@Sum[Sin[n x] x^n, {n, 0, N}],
 
 "Evaluating",
 
 step1 // ReleaseHold,
 
 "This is the second step:",
 
 q[x] == HoldForm@Integrate[x^n Sin[n x], {x, 0, Pi}],
 
 "etc., etc."
 ]

The output is in a single cell, which can be double-clicked to hide the
input statement. We did use a Style statement to revert to ScriptLevel->1 on
one of the annotation statements. The only trouble with this construction is
that we can't use the %, %% reference notation. 


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark 


From: Carl Woll [mailto:carlw at wolfram.com] 
Subject: [mg88582] Re: [mg88550] Formatting Problem with Summation Symbol

David Park wrote:

>I often write short derivations in a single cell with a statement on each 
>line and sometimes Print statements interspersed as commentary. This gives 
>one input cell and multiple output cells. Then one can select all the
output 
>cells and double-click to hide the input cell. However, sometimes it is a 
>bit inconvenient to select all the output cells so I would like to display 
>them as lines in a  Column instead. Then there would be only one output
cell 
>to select. However, it is difficult to obtain the same formatting in Column

>as one obtains in output cells.
>
>Is there a method to use a Column 
>expression and have each line look like regular Output formatting?
> 
>
Column formats its contents using ScriptLevel->1. So, override this by 
including an explicit Style directive:

Column[{Style[p[x] == Sum[a[n] x^n, {n, 0, N}], ScriptLevel -> 0]}]

Carl Woll
Wolfram Research



  • Prev by Date: Manipulate Hints, Tips, Tricks
  • Next by Date: Re: A bug in Show[]?
  • Previous by thread: Re: Formatting Problem with Summation Symbol
  • Next by thread: A very strange calculation in Mathematica 6