Re: RE: "Anti-Comments"?

*To*: mathgroup at smc.vnet.net*Subject*: [mg69187] Re: [mg69164] RE: [mg69096] "Anti-Comments"?*From*: "Chris Chiasson" <chris at chiasson.name>*Date*: Fri, 1 Sep 2006 06:41:28 -0400 (EDT)*References*: <200608310839.EAA19638@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

I thought about responding, but I didn't have any plausible ideas. I now might have one, but I don't feel like trying to make it work, so are the instructions in text form: Use the notation package or regular Mathematica functions to define an operator *( and another operator )*. This may be impossible due to the charactersyou want to use; I'm unsure. You will need to figure out how the parser will order the two operations, which will depend on their precedence. You should probably give both operators the attribute HoldAll. Once you have the input and the precedence, it will be a simple matter for you to give whatever output you want. Of course, you should remember to set the Evaluatable option to True for the cell if you want it to work. On 8/31/06, David Park <djmp at earthlink.net> wrote: > I want to respond to this but I'm not quite certain of the best response! So > this will be more in the line of musing. > > My first impression is that you want to make Input cells into Text cells and > Text cells into Input cells, so why not just switch the names? But what I > think you are really getting after is a tighter integration of textual > material and active definitions and commands. That seems like a good thing, > especially since many users don't use Text cells at all. > > One can put inline cells into Text cells, as you mentioned, and even > evaluate them by selecting the inline cell and using Shift-Ctrl-Enter. But > they seem to have to be evaluated separately and one can't just evaluate the > Text cell. So I see this as principally a little fancy word processing. > > The way the front end works now is that textual material and active input > are in different cells. This means a new line and space between them. So > that's as tight as one can integrate them. (At least conveniently.) As some > people know, I like to call the regular style of research papers and > textbooks the TED style (Text, Equations, Diagrams) and I like to call > Mathematica with the front end the Ted Advanced style, which is much more > powerful. But here is a case where we can't completely mimic the TED style, > by having important definitions mixed in with the textual material on the > same line. > > But is that necessarily a bad thing? One of the troubles with regular TED > math books is that essential definitions and descriptive material are often > woven so tightly together that one can easily miss essential steps or > conditions. I guess that is why they say that mathematics is close reading. > Putting all descriptive and explanatory material in Text cells and all > active material in Input cells certainly makes a clean separation between > the two. > > If we look at your specific example I would first change your definition. > > results[a_] := Plot[{x, Sin[a x]}, {x, 0, Pi}, Frame -> True] > > Then I would do a succession of Text and Input cells... > > The normal case is > > results[1]; > > But if we change the parameter a to 3 the result looks quite different. > > results[3]; > > And if we choose a = 4 the result is really different. > > results[4]; > > ...I don't see that this is greatly different than your desired > presentation. > > Also I think it is a distinct advantage to include the a parameter in the > definition of results. Without it, a reader could evaluate results and not > know what the parameter is or where it was last defined. The reader of the > notebook would have to do some 'close reading' to ascertain where a was set. > There shouldn't be a disconnect between the parameters a routine uses and > the actual use of the routine. > > I can see some advantages in 'active Text cells' but I would hate to see WRI > drastically change the notebook interface. What we get might not be what we > like. I think the present interface is pretty good. I'm willing to go with > it and try to learn how to use it to best advantage. I want to spend my time > thinking about the math and physics and I don't want to be continually > facing a new interface. > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > > From: AES [mailto:siegman at stanford.edu] To: mathgroup at smc.vnet.net > > > [Apologies if my earlier version of this query was answered and I missed > it.] > > You can put text comments inside an Input cell using the (* ---- *) > syntax and they'll be displayed, but not executed. > > Is it possible to have an "anti-comment" capability -- maybe indicated > by an anti-comment syntax like *( --Input stuff-- )* -- that will do > the opposite? > > That is, I'd like to be able to insert properly coded Input expressions > inside a Text cell and have them be executed -- *without* messing with > the basic Text cell structure. > > Example: Define, using an Input cell in the initialization part of a > notebook, > > results := Module[{}, Plot[{x, Sin[a x]}, {x, 0, Pi}] > > and then, later in the notebook, have Text cells (*standard* Text cells) > with contents like: > > But if we change the input parameter to be *( a = 3 )*, the > new *( result )* looks quite different: > > - - plot shows up here -- > > And if we chose *( a = 4 )* the *( result )* is really > different: > > - - another plot shows up here -- > > NOTE!! I'm not asking how one might define any such *( )* commands to > accomplish this result -- I'm just using them to illustrate how the > executable subcells would fit into the text cells. > > Section 1.1.10 of The Book tells how to insert a differently formatted > formula in a text cell using ctrl-( and ctrl-). My question is: using > any kind of menu commands or mousing around, can an inserted subcell > that is displayed inside a standard Text (or Heading) cell be made > executable??? > > > -- http://chris.chiasson.name/