Tag Info

Hot answers tagged

9

The only solution I have found is to delete the contents of the directory given by: FileNameJoin[{$UserBaseDirectory, "Paclets"}] More specifically it appears to be sufficient to delete a single file: FileNameJoin[{$UserBaseDirectory, "Paclets", "Configuration", "pacletSiteData_10.pmd2"}] To prevent Mathematica freezing on the next start-up I need to ...


7

There is a special cell attribute called CellID. I would suggest using this instead of cell tags to avoid the problem that you mentioned with cell tags being inherited. Here's an example of how Select can be used to retrieve a cell with a specific cell ID: nb = CreateWindow[]; cells = <| "name" -> RandomInteger[10^6], "status" -> ...


7

One way, based on the self-delete example in the documentation for Button: Button["Start", SelectionMove[ButtonNotebook[], All, GeneratedCell]; NotebookDelete[ButtonNotebook[]]; Print[Plot[x^3, {x, -1, 1}]]]


5

This will delete everything in the evaluation Notebook: NotebookDelete[Cells[]] This will generate a Palette Button that deletes everything is the selected Notebook: CreatePalette @ Button["Clear Notebook", NotebookDelete @ Cells @ InputNotebook[]] As noted in the comments it is probably just as fast, if not faster, to simply Select All and Clear ...


4

Mathematica does not support any kind of comment-to-line-end specaial character(s). You will have to resign yourself to living with that. It does support a very useful and easy to apply block un/commenting feature. I am running on OS X, so the keyboard shortcut for the context (mouse-right-click) menu's Un/Comment command is Cmnd+/. I use that do any kind ...


4

This is very efficient for large Notebooks: NotebookPut[Notebook[{}], EvaluationNotebook[]]; (simple replacement of the evaluation notebook with blank notebook). I have tested this method with a Notebook of size 976 Mb containing 36031 Cells and it was cleared out in no time, while the NotebookDelete[Cells[]] method seems to take forever for this ...


4

Does this fit your needs? Scan[ SetOptions[#, CellGroupingRules -> None] &, Cells[] ]


4

You can use CellEventActions by adding it to the Stylesheet or hard-coding it for each cell. Here is a cell that changes when clicked. DynamicModule[{bgd = LightRed}, CellPrint[ TextCell["Click within this cell", "Output", Background -> Dynamic[bgd], CellEventActions -> {"MouseClicked" :> (bgd = LightGreen)} ...


4

Can't be done. This can be verified by converting the input form expression into standard form. Start with Integrate[1/(x^2 + y^2 + z^2)^(5/2), {x, 0, b}, {y, 0, l}, GenerateConditions -> False] Select the expression and click on Standard Form in the Convert To sub-menu of the Cell menu. (That choice will be checked as if it were active, but ...


3

An example of how to set the cell option Styles can be found here. The question is what is the token used to set the cell alignment? To answer this create some five cells and then manually set the cell alignment to Align Left, Align at 25%, Align Center, Align at 75% and Align Right using the Format menu and Text Alignment row. Now select a cell and go to ...


3

In case this is helpful to anyone stumbling upon this thread this as I did, here is simpler code to select all cells from the end of a notebook to the current evaluation cell. endAtID = First @ EvaluationCell[]; SelectionMove[EvaluationNotebook[], After, Notebook]; SelectionMove[EvaluationNotebook[], Previous, Cell]; While[ SelectedCells[][[1, 1]] =!= ...


2

The text is stored (upon releasing the mouse button) in the variable val with this code: EventHandler[ InputField[], {"MouseUp" :> (val = CurrentValue["SelectionData"])}, PassEventsDown -> True ] It should work in other contexts as well besides InputField, as I noted in my comment it is not clear from your question what the context is.


2

The following copies the selected text to the clipboard DynamicModule[{}, EventHandler[Dynamic@InputField[x], {"MouseUp" :> FrontEndExecute[FrontEndToken[FrontEnd`SelectedNotebook[], "Copy"]]}, PassEventsDown -> True]]


2

If you mean screen, then ctrl + A to select all cells and then hit del. If you mean memory, then ClearAll["Global`*"] if it does not help, restart...


2

You can explicitly specify that only "Input" Cells should be closed: Do[CurrentValue[cell, CellOpen] = False, {cell, Cells[CellStyle -> {"Input"}, CellTags -> {"noclass"}]} ] As Kuba notes in the comment, it is CellTags what is inherited by generated output Cell. This issue recently raised in this question. If the inheritance is not desirable you ...


1

As indicated in the comments, this bug has been fixed as of version 10.0.2. See also these other questions: (58799), (86891), (72750) and (90054).


1

I did not attempt to implement everything you show but only what is needed for the two final examples. I initially seemed to have a problem with precedence but now it is working? I am not certain of what change made the difference, if any, but I'll post what I have now in case it is special in some way. I added these lines at the top of ...



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