Tag Info

Hot answers tagged

4

While I was working on alternative TeX export, I had similar requirement. I wanted to export annotated Mathematica code to TeX, with annotations reflecting front ends syntax highlighting. Since I couldn't find a way to use front end itself to do it, I decided to write my own package. My SyntaxAnnotations package is now available on GitHub. It works by ...


4

Here is a quick pass at a Palette that does this. The same commands could be used for keyboard commands in KeyEventTranslations.tr. This is not rigorously written or tested so be careful with it. mover[label_, c_List] := Button[label, With[{nb = SelectedNotebook[]}, (NotebookWrite[nb, #2]; SelectionMove[nb, Previous, Cell]) &[ ...


3

Try running this for autosaving your notebook at fixed periods. At least this way you will only lose a few minutes of work if you get another crash. save=DynamicModule[{autosaveTime = 1, nb = EvaluationNotebook[]}, Row[{ "Autosave every", Spacer[5], Row[{ InputField[Dynamic[autosaveTime], Number, FieldSize -> 1.5], Spacer[3], ...


3

I also consider this an inacceptable bug. Nevertheless I wanted to share a workaround which I think avoids the problem but is unfortunately a lot of effort to add to more complicated cases: CreateDocument[ DynamicModule[{x={500,500},lastValue}, Framed[ Slider[Dynamic[x[[1]]],{400,600}], ImageSize->Dynamic[ ...


3

Upon opening you can change the stylesheet and remove the docked cell: SetOptions[EvaluationNotebook[], DockedCells -> {},StyleDefinitions -> "Default.nb"] Then if you want to change the "Code" styles to something else, possibly "Input", do this: NotebookFind[EvaluationNotebook[], "Code", All, CellStyle] ...


3

Here is one way. Using the parseString function from this answer of Mr.Wizard, the following will create a notebook with an entire package's code being placed in a single Code - style cell: parseString[s_String, prep : (True | False) : True] := FrontEndExecute[UndocumentedTestFEParserPacket[s, prep]] ClearAll[openPackage]; ...


2

I agree with this comment, so let me put here a wiki: I'm reasonably certain this is designed behavior - the variable coloring is only supposed to apply to the Global` context. As an indication, in Preferences>Appearance>Syntax Coloring>Other the typical blue color is assigned to "Global symbols that have no value assigned". I'm not aware ...


2

Since your code has a bottleneck in NotebookGet, the only way to speed it up directly would be to speed up the latter. If your notebook exists on disk, you may try using something like this: ClearAll[nbget]; nbget[nbfile_String?FileExistsQ] := FirstCase[_Notebook]@ToHeldExpression@Import[nbfile, "String"]; nbget[nb_NotebookObject] := With[{file = ...


1

This appears to be a reproducible bug. I submitted a ticket to Wolfram and I received a response that they will look in to it: Hello - Thank you for your email. I have reproduced this problem with downloading files from the Wolfram Cloud and report the problem to our developers. This may allow them to fix the problem in the future. ...



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