Tag Info

Hot answers tagged

9

Use : NotebookWrite[nb, ToBoxes[ptemp]] With NotebookWrite[], you must use boxes ("low-level-box-language"), not Graphics (which belongs to normal Mathematica language, like nearly everything). The "box-language" is what you see when you type ctrl-shift-E on a cell. ToBoxes transforms pTemp to a box. NotebookWrite[] inserts automatically the data (the ...


7

You can do ClearAll[Evaluate[$Context <> "*"]] Or switch the context to be unique to each group of cells.ΒΈ Depending on your needs you can also use Quit[], which will terminate the kernel, therbye clearing everything.


6

LaunchKernels launches subkernels used for parallel calculations. These are not meant to and cannot be set to as the evaluator for a notebook. To set the evaluator for a notebook, use Evaluation -> Kernel Configuration Options to set up a new kernel, then use Evaluation -> Notebook's Kernel to assign it to the current notebook.


5

This works : SelectionMove[SelectedNotebook[], All, EvaluationCell]; SelectionMove[SelectedNotebook[], Previous, CellGroup]; FrontEndTokenExecute["SelectionOpenAllGroups"] The problem was that in SelectionMove[SelectedNotebook[], Previous, CellGroup], Previous refers to the current selection which is not well defined when you do the initialization. I ...


5

Using the menu item Preferences / Advanced / Option Inspector you can easily do that, or from within the notebook evaluate: SetOptions[InputNotebook[], Saveable -> False] will do what you want. However, notice that Save As still works (not sure if it has to or if this is an intelligent design decision).


4

It appears that it only works once because it messes up the cell expressions it modifies the first time it is evaluated. I started with a notebook with several kinds of cells but only one text cell, which had the cell expresion Cell["Some text", "Text"] I evaluated nb = EvaluationNotebook[]; Scan[(CurrentValue[#, StyleNames] = "Section") &, ...


1

On other browsers/platforms, you may see this: and if you click on (preview) you'll see this: although you can't copy this, because it's a GIF...


1

If you wish to do this programmatically instead of using the mouse in the front end, you can place the following code after the section you wish to change the color of, then it should select the section and change the background: SelectionMove[SelectedNotebook[], Previous, CellGroup]; obj = SelectionMove[SelectedNotebook[], Previous, CellGroup] ...


1

Try to group the entire section and set the backround color to gray from the "Writing assistant pallete". You can also use create your own stylesheet by going to "Format->Edit Stylesheet->Choose a style->Section". Then you change the bckround color to gray using the "Writing assistant pallete". Every time you create a new section, the backround color will ...



Only top voted, non community-wiki answers of a minimum length are eligible