Tag Info

Hot answers tagged

12

Changing shortcuts isn't that complicated. All you have to do is change one line in the file KeyEventTranslations.tr in a location in your file system specified by this command: FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources", $OperatingSystem}] Locate the following line in a text editor and change the key into the one ...


12

To format all your output expressions as TraditionalForm, you can set the $Post variable as: $Post = TraditionalForm Here's how it would look: To clear the definition for $Post (if you need to), just evaluate $Post =. You can add this to your init.m if you'd like to make this apply to all notebooks henceforth, but I wouldn't suggest doing that.


12

I've never seen that command before but this does work at least in version 7 on Windows: FrontEndExecute[ AddMenuCommands[ "BackgroundDialog", {Delimiter, Item["L&inen", Background -> RGBColor[0.980, 0.941, 0.902]], Item["A&liceBlue", Background -> RGBColor[0.941, 0.973, 1.0]], Item["Min&tCream", Background -> ...


11

This can be accomplished using LinkWrite. You can place the following code in init.m. To add a color to the background colors submenu you can use... LinkWrite[$ParentLink, AddMenuCommands[ "BackgroundDialog", {Delimiter, Item["M&y Color", Background -> RGBColor[0.980, 0.941, 0.902]]}]] To add a link to the AddOns documentation you can ...


10

Re: appearance, you can do this with a style sheet. Below are some cells with my styles for a) running the terminal in Mma and b) sending stuff to a word document. If that is what you are looking for I'll post a more detailed example. Re: "predictive text coloring" I presume you mean syntax styling of Mathematica code? If so this can be configured from ...


10

You need to add the following to KeyEventTranslations.tr: Item[KeyEvent["Tab", Modifiers -> {Control}], FrontEndExecute[FrontEndToken["CycleNotebooksForward"]]], Item[KeyEvent["Tab", Modifiers -> {Shift, Control}], FrontEndExecute[FrontEndToken["CycleNotebooksBackward"]]], This will map Control-Tab and Control-Shift-Tab to cycling between ...


10

Referencing Szabolcs's answer, here is the code that must be added to KeyEventTranslations.tr: Item[KeyEvent["m", Modifiers -> {Control}], FrontEndExecute[{ FrontEnd`SelectionMove[FrontEnd`SelectedNotebook[], All, Cell], FrontEnd`FrontEndToken["Clear"] }]], I chose Ctrl+M at random; change it to whatever you want. See this ...


10

Thanks to everyone for the helpful comments. Here's the exact procedure I used to fix this (specific to Mac OS X, version 10.8 if that matters, and Mathematica 8, but it should be analogously applicable to other versions and operating systems): Close Mathematica Delete the keymap cache. For me this was in ~/Library/Mathematica/FrontEnd/8.0 ...


9

I usually press the down key until I get out of the cell, then press shift-up to select it. Here are two buttons that will select or delete the whole cell for you: select = Button["Select Cell", SelectionMove[SelectedNotebook[], All, Cell]] delete = Button["Delete Cell", SelectionMove[SelectedNotebook[], All, Cell]; FrontEndTokenExecute["Clear"]] ...


9

Here's a quick solution. Note that it's only tested in Ubuntu - please test it in other operating systems and make any changes that are necessary. First we define a sendNotification command and then show how to create a style of input cell that automatically calls it. Also included is a palette that will modify any cell to have the appropriate CellEpilog ...


9

This will add Quit to Control+Q (and Alt+V Q Q): FrontEndExecute[ FrontEnd`AddMenuCommands["MenuListQuitEvaluators", {MenuItem["AddMenu &Quit", FrontEnd`KernelExecute[ToExpression["Quit[]"]], MenuKey["q", Modifiers -> {"Control"}], System`MenuEvaluator -> Automatic]}]] It only persists for the front end session. Usually I keep ...


9

This is similar to my Log question and similar methods can be used. $PrePrint = # /. { Csc[z_] :> 1 / Defer@Sin[z], Sec[z_] :> 1 / Defer@Cos[z] } &; Example: (x + y) Csc[x] Sec[y] (x + y)/(Cos[y] Sin[x])


8

You can't add an entirely new menu using AddMenuCommands. We have it from John Fultz here: "AddMenuCommands can only position a menu relative to one with a simple front end token." (I trust I've not taken that out of context.)


8

Yes, you can use InputAliases to style the replacements as you wish. I explained how to make auto replacements in this answer, but that was for a more specialized purpose. As a simple example, you can do something like: SetOptions[SelectedNotebook[], InputAliases -> {"foo" -> MakeBoxes@Row[{ Style[foo, FontColor -> Red, FontWeight ...


6

In the section of the manual about entering two dimensional input you can find the following quote. This may help. On a standard English-language keyboard, the character ^ appears as the shifted version of 6. Mathematica therefore accepts Ctrl+6 as an alternative to Ctrl+^. Note that if you are using something other than a standard English-language ...


6

One can use $PrePrint and ReplaceAll to effect this: $PrePrint = # /. { Log[n_]/Log[2] :> Defer @ Log2[n], Log[n_]/Log[10] :> Defer @ Log10[n], Log[n_]/Log[b_] :> Defer @ Log[b, n] } &; It is also possible to use Format but in this case it requires unprotecting Times: Unprotect[Times]; Format[Log[n_]/Log[2]] := Defer @ ...


6

Since you want this functionality to be able to insert aliases using the EscshortcutEsc syntax, you can edit the KeyEventsTranslation.tr file to achieve this. Copy the following file: $InstallationDirectory/SystemFiles/FrontEnd/TextResources/Macintosh/KeyEventTranslations.tr or its equivalent on your system to $UserBaseDirectory/ (with the same directory ...


6

You can also use hotstrings as a way of autocompletion. By using such replacements, words are immediately replaced by another word on typing a space after the hotstring: CreateDocument[{}, InputAutoReplacements -> {"sync" -> SynchronousInitialization}] You can set such replacements globally under Option Inspector (CtrlShiftO). Of course no one would ...


6

Surely I'm missing something, but... expr = (x - 1) (x - 2)/(x - 3)^2 1 / expr Try menu Evaluation > Evaluate In Place Palette Since the above is trivial, here is a palette to flip a selected fraction, assuming that it is in the form of a FractionBox. This has the advantage of not evaluating anything, which I suppose could change your ...


4

Now, with v9, I can undelete this answer :) You could set a context dependent on a certain counter value. Add to your stylesheet, to the "Input" style, the following option CellContext:>"Section"<>ToString@CurrentValue[{"CounterValue", "Section"}]<>"`" and in my few tests you get a context dependent on the last section number. It can ...


4

I can only speak for Windows but I would expect the solution should be similar for Mac. I created a file $BaseDirectory\FrontEnd\init.m In that file I added the following lines. Note they are slightly different than what you provide but should do what you want. FrontEndExecute[AddMenuCommands["AboutBoxDialog",{Delimiter, Item["Installed Add ...


4

I find it easiest to create a Notebook with the features I want, and then open that Notebook to launch Mathematica. Save this code as a .nb file. If you want Mathematica to also open "Maximized" rather than in the slightly-less-than-Maximized form it usually does, also create a shortcut to this Notebook and change the properties to Maximized, then use ...


4

It seems your Windows system works differently than mine (Win7-64). I don't believe I can use the Ctrl-Space combo, but I know how to change the setting: Right click on the language symbol in the task bar Select Settings from the pop-up menu, in the resulting dialog box pick the 3rd tab Select the action by clicking on a keyboard name, and pressing ...


4

Building on Albert's answer I added code such that Ctrl Shift End will select all cells downwards. Just execute this code in a notebook and restart Mathematica: mymenuitems=" (* Select all cells downwards *) Item[KeyEvent[\"End\", Modifiers -> {Control, Shift}], KernelExecute[ Module[{ enb = EvaluationNotebook[], ...


4

It sounds to me like you want a Code (style) cell without the gray background. Select to Format > Style > Code or press Alt+8. Select Format > Background Color > None If this is correct you can create a new custom style in a private style sheet that has these characteristics by default. As requested here is how to create a private style sheet: In ...


3

"these will end up being more trouble than they are worth." - to my mind, this is a very accurate assessment of the situation. As far as syntax is concerned, you will face multiple obstacles, starting from package and front-end parser differences you outlined (which makes the use of e.g. Notation package in packages quite non-trivial if not problematic), ...


3

I have two solutions. The first is specific to the Doc pages, the second one is more general and is my preferred one. 1st solution. Take any doc page. For ex. type "Plot" and then press F1. You will get the "Plot" doc page. As you see the In-out pairs are bracketed, but the higher-order structures, like "Plot" or "Basic Examples" or "Scope" are not....or so ...


3

This isn't a full answer, but maybe those with more knowledge can take it from here. To capture key presses of a particular key, one can do the following: k=0; SetOptions[$FrontEndSession, FrontEndEventActions -> {{"KeyDown", "q"} :> (++k), PassEventsDown -> True} ] The previous example increments k each time the letter q is pressed. Note: ...


3

I also don't know a straightforward way to do what you want, so Mr.Wizard could well be right. But there are workarounds as e.g. the following which is "abusing" CellTags. It is however somewhat hacky and not very fast and reliable and I'm not sure whether it is good enough for your every day use: Module[{ enb = EvaluationNotebook[], tag = StringJoin[ ...


2

Apparently Ctrl+F6 and Ctrl+Shift+F6 are default Windows keyboard shortcuts, although I was only aware of the Tab variants. Because of this, these commands on not (apparently) configurable from within Mathematica. Further, Mathematica does not recognize the Tab commands. It may be possible to rig something using SetSelectedNotebook but so far I have ...



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