MathGroup Archive 2006

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

Search the Archive

RE: "Anti-Comments"?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69287] RE: [mg69096] "Anti-Comments"?
  • From: "Ingolf Dahl" <ingolf.dahl at telia.com>
  • Date: Tue, 5 Sep 2006 05:31:06 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi AES,
This question is similar to one question from Mark Adler
(http://forums.wolfram.com/mathgroup/archive/2006/Feb/msg00104.html). Check
the whole thread! In that context, I made a little palette and a button,
which I now have improved, and send to you. Using it, you might execute
inline Input cells, or freely mix Input and Text cells. 

The buttons in my MergeExecPalette act in the following way:

EmbedCells puts all selected cells as Inline cells inside a Text cell. Text
cells without options are just stored as text within this main cell. Cell
ends are transformed into line ends. (This feature could easily be removed
in the code, but I think it is wise to have a clear visual separation
between Text and Input,)  Repeated use of the button should not cause deeper
and deeper embedded cells. The command can be used to freeze output, creates
commented code or graphic cells with figure captions.

ExplodeCells reverses the action of EmbedCells.

MergeInputCells creates a new cell with the merged content of all selected
Input cells (ordinary or Inline cells). Since the input cells are merged,
you might start with having a left bracket in one cell and the right bracket
in another, and still get working code at the end.

MergeExec first does the same as MergeInputCells, but also executes and
deletes the created cell.

The placement of the palette could be in your Mathematica\Applications
directory inside a MergeExec\FrontEnd\Palettes subdirectory.

I also send you a notebook with an Execute button, which acts in the same
way as the MergeExec button, but with the difference that the Execute button
is intended to be placed inside a Text cell where there also are Inline
cells of the Input style. The button thus merges these cells and execute
them.

Please check the palette and the button and see if they are of any help! Any
feedback is appreciated. 

If anyone else in MathGroup is interested, or just curious, please drop me
an email, and then I mail the palette and button to you. Since the code is
new and quite untested, I want to have the possibility to send improvements,
if needed. If I get any user feedback, I later may place the code for
download at http://web.telia.com/~u31815170/Mathematica/.

Best regards

Ingolf Dahl
Sweden
 

> -----Original Message-----
> From: AES [mailto:siegman at stanford.edu] 
To: mathgroup at smc.vnet.net
> Subject: [mg69287] [mg69096] "Anti-Comments"?
> 
> [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???
> 
> 



  • Prev by Date: Re: Re: generalized foldlist problem - part 2
  • Next by Date: Re: Re: generalized foldlist problem - part 2
  • Previous by thread: Re: RE: "Anti-Comments"?
  • Next by thread: Re: Re: a curious answer