Hot answers tagged

13

You may use the "DocumentationExampleInputs" property of the "WolframLanguageSymbol" entity or WolframLanguageData function. With "WolframLanguageSymbol" entity: EntityValue[Entity["WolframLanguageSymbol", "Round"], "DocumentationExampleInputs"] For more than one at a time you can use "EntityAssociation" to have the entities as keys. EntityValue[...


7

You can use DumpSave["state.mx", "Global`"] to put all the defined variables/symbols in a given instance into a file. Then you can afterwards reload that with Get["state.mx"]. This is probably the most 'portable state' form you can get for moving a notebook's loaded data to another computer, without moving the source data.


5

It can done in OS X, but AFAIK only from a previously open Documentation Center notebook. If you have one open, then you can do it this way. Run your mouse cursor over any hyperlink in the Documentation Center notebook. Bring up the context menu. (right-click or ctrl-left-click) Select Open in New Window.


5

Borrowing some of the display-related code for TransformationFunction[], I came up with this: MakeBoxes[PartitionedMatrixForm[M_, {p_Integer, q_Integer}], fmt_] ^:= Module[{mat}, mat = If[Unevaluated[M] =!= {{}} && MatrixQ[Unevaluated[M]] && And @@ MapThread[0 <= Abs[#2] <= #1 - 1 &, {Dimensions[M], {p,...


4

FrontEndTokenExecute[nb, "EvaluateNotebook"] does not return anything, it won't wait for a nb to finish evaluating. If it worked I think it was a coincidence. Compare those examples: The first one is analogous to your approach. procedure1[] := Module[{nb}, nb = NotebookPut @ Notebook[ Table[ Cell[BoxData@MakeBoxes[Print[#]; Pause[1];], "Input"...


4

This is operating system dependent. On OS X (my OS), Mathematica comes with a Quick Look plug-in. When installed it provides exactly the service you are asking for. All I have to do is select the notebook's icon in a Finder window an hit Space


4

You may use the Low-Level Notebook Programming guide. Create a notebook with CreateDocument for the example that has duplicate cells. SeedRandom[123]; nb = CreateDocument[Table[ExpressionCell[n, "Input"], {n, RandomInteger[{1, 5}, 20]}]] The Cells can be GatherBy'ed their NotebookRead representation. They will have different CellChangeTimes so this is ...


3

Alternatively, if you want to use Mathematica, then you can do something like so-- dir="path/to/directory"; SetDirectory[dir]; fn = FileNames[]; (* select just .nb files, so you don't import and other files, etc. *) notebooks = StringCases[fn, ___ ~~ ".nb"] // Flatten; (* select the notebooks that you want *) Select[ notebooks, StringMatchQ[ ...


3

Indeed, the existing notebook can be called repeatedly from another notebook, which iterates over the desired parameters, passing them to the existing notebook, which then passes the answers back to the calling notebook, which records them. For instance, begin the calling notebook with Dynamic[{loop, linked`vdtdz}] distab = {}; Dynamic[distab // TableForm] ...


2

A self-closing dialog window using NotebookDynamicExpression selfclose1[content_, closetime_] := CreateDialog[ Column[{ content, CancelButton[ImageSize -> Full]}], NotebookDynamicExpression -> Dynamic[Refresh[ If[Clock[closetime, closetime, 1] == closetime, NotebookClose[]], UpdateInterval -> closetime, TrackedSymbols :&...


2

This is what I understood OP needs: SetAttributes[foo, HoldFirst]; foo[proc_] := Module[{dialog}, dialog = MessageDialog["whatever"]; RunScheduledTask[NotebookClose @ dialog, {3}]; proc] a more advanced example can be found in Palette button with progress bar


2

Oh, sorry everyone. I've got an answer here right after I posted my answer...... But I think this solution may be helpful for other users annoyed with Pause: new = CreateDialog[Plot[x^2, {x, 0, 1}]]; PrintTemporary@DynamicModule[{t = Now, check = True}, Dynamic[ If[check && Now - t >= Quantity[3, "Seconds"], NotebookClose[new]; ...


2

I would simply execute grep -He '\\<Sin\\>' *.nb in a command shell (with the appropriate working directory). You might be able to do this within Mathematica, but I doubt it would be worth the trouble.


2

The gap in the first example may be controlled with the Option CellFrameMargins. This can be done for one cell at a time or by creating a custom Style Sheet. Either is assisted by use of the Option Inspector. Selecting your Title cell (use the selection bracket to its right), then opening the Option Inspector and searching for CellFrameMargins should show ...


1

Temporary setting: SetOptions[$FrontEndSession, "ShowCellBracket" -> False] Fixed setting: SetOptions[$FrontEndSession, "ShowCellBracket" -> False] Only for a given notebook: SetOptions[nb, "ShowCellBracket" -> False]



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