# Is there a keyboard shortcut for Centered Math Cell?

I've been typesetting in mathematica and would like to know if it is possible to use a keyboard shortcut to place a centered math cell or equation symbol aligned math cell in my document without having to use the writing assistant.

-
It may be possible like this: mathematica.stackexchange.com/questions/19135/… – Szabolcs Apr 24 '13 at 0:08
@Szabolcs thank you. I'll have to tinker with this, but this seems like a good place to start. – Black Milk Apr 25 '13 at 2:00
The basic steps would be: in the style editor, choose the style that you want to add as shortcut to from the dropdown. It'll insert a cell. Select the cell and press Control-Shift-E to show its structure. Add MenuCommandKey -> "8" to the end to make it possible to insert it with Alt-8 (Command-8 on Mac). Note that 8 is taken by code style cells, so you'll need to edit those too and put MenuCommandKey -> None in their definition. Ask if you need more help. I haven't played with your specific example, but I did do this for other styles. – Szabolcs Apr 25 '13 at 2:41
@Szabolcs I've tried your method with other styles and it works perfectly. However, I don't know how to pull up the style definitions for a centered math cell. Is there a way to find this? – Black Milk Apr 25 '13 at 3:20
If you choose the JournalArticle StyleSheet for your typesetting, you will have such a hot key automatically: Alt+5 for a centered equation line style and Alt+6 for a numbered equation. – Alexei Boulbitch Apr 25 '13 at 7:04

Yes...just figured this out. Place this in an init.m file in any path called my Mathematica. This is for a center lined math cell, but you can also do the same for Marker Aligned, Equal Aligned or whatever you want. In my code below, the first column aligns to the center and next aligns in the left. You can change this however you want. Just replace "center" or "left" with the appropriate value. Hope this helps. To use the shortcut press control+c or defined it how you please below. It also lists the shortcut in the insert menu with the appropriate shortcut labeled in case you forget. Hope this helps.

FrontEndExecute[FrontEndAddMenuCommands["DuplicatePreviousOutput",{Delimiter,MenuItem["Centered Math Cell",FrontEndKernelExecute[nb=SelectedNotebook[]; SelectionMove[nb,After,Cell]; NotebookWrite[nb,

],MenuKey["c",Modifiers->{"Control"}],SystemMenuEvaluator->Automatic]}]];
You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ?` is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful – Michael E2 Sep 28 '15 at 3:02