Mathematica provide Algebraic Manipulate palette for simplifying expression. But the palette window will always stay on top, which is quite annoying.

Is is possible to customize mathematica's right click menu to add frequently used Simplify tools? In this way we can first select expressions, then right click on it and select simplifying operation. I think this is handier than palette.

• it doesn't answer your question at the end but shows the way: How do I programmatically add to contextual menus? – Kuba Dec 10 '15 at 7:58
• You can make that palette non-floating using SetOptions[First@Notebooks["AlgebraicManipulation"], WindowFloating -> False]. – Karsten 7. Dec 10 '15 at 8:45
• @Karsten7. Sorry for the late reply. Actually, when it is non-floating, it is another kind of annoying when using the palette : ) – matheorem Dec 12 '15 at 13:57
• @Kuba Thank you, Kuba. After reading that, still can't get it. Manipulating front-end option is still too complicated for my ability right now, sigh... – matheorem Dec 12 '15 at 14:03
• So you want something like this, but for the commands of that palette? Do you really want to have all commands? The menu will get cluttered. To you want the same behavior as the palette has? Especially the in place evaluation is a questionable feature. – Karsten 7. Dec 12 '15 at 14:21

## Adding the functionality of the Algebraic Manipulate palette to the context menu ("right click menu") of Mathematica

The commands of the Algebraic Manipulation palette are converted into MenuItems, that will mainly use the FrontEnd, with

MenuItem[#[[1, 1]], FrontEndExecute[{
FrontEndNotebookApply[FrontEndInputNotebook[], #, All],
FrontEndToken["Evaluate"]}]] & /@
Import[FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "Palettes", "Other", "AlgebraicManipulation.nb"}]][[1, 1, 1, 1, 1, All, 1, 1]] // InputForm  One can switch to Full Screen by pressing F12 and back again with F12, to make sure the output is formated in a way that is convenient for the next steps. If, for example, ones monitor is to small, one can Copy As ► Plain Text the output and add the line breaks manually later. In both cases any ManuItem one doesn't want to have in the context menu should be removed from the outputted list. The content of the context menu is specified in the file FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources",


This file can be edited with an editor (e.g. Notepad++), but a backup copy should be created first.

To open this file from within Mathematica

SystemOpen@
FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources", "ContextMenus.tr"}]  can be used. The context for inputs starts with "Input" -> {. To add a new menu entry after the entries related to Evaluate Menu["&Algebraic Manipulate", { }], Delimiter,  can be copied into a new line created after the Delimiter of that section. Now one only has to replace the created empty list with the list of MenuItems constructed from the palette entries, save the ContextMenus.tr file and restart Mathematica. • But there seems an error in the column version, since directly copy as plain text have no commas between each MenuItem, if we pasted it directly into ContextMenus.tr, mathematica is unable to start – matheorem Dec 14 '15 at 5:23 • @matheorem Thanks for pointing that out. I removed the column version, as it is more error-prone and presumably not really helpful. – Karsten 7. Dec 14 '15 at 6:50 Converting the Algebraic Manipulation palette into a DockedCells: CurrentValue[EvaluationNotebook[], DockedCells] = Append[MapAt[Partition[Flatten[#], 9] &, Import[FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "Palettes",
"Other", "AlgebraicManipulation.nb"}]][[1, 1]], {1, 1, 1}],
ButtonBoxOptions -> {BaseStyle -> "Evaluate"}];


This DockedCells can be customized further. For example, if you only need two buttons Expand and Simplify, then Change Partition[Flatten[#], 9] & to {Flatten[#][[{1, 8}]]} & to select only the first and 8th button for the dock.

• You are awesome! This implementation is really great ! I accept your answer. BTW, would you like to add a right click menu version? I know you also have experience on this kind of implementation. That will make the answer complete. : ) – matheorem Dec 13 '15 at 1:57
• @matheorem I added a right click menu version as another answer, as I'm having some ideas on how to improve this DockedCells that I may add to this answer together with some explanations some time. – Karsten 7. Dec 13 '15 at 18:17
• As I said before, I wish I could accept both answer. But now I decided to accept your "right click" version, since it works great and is what I exactly asking for in the question. I hope you don't mind about this. Finally, I am really looking forward to your newer version of DockCells in the future : ) – matheorem Dec 14 '15 at 14:15