# DisplayFormula not working as expected

How do I use the styles "DisplayFormula" and "DisplayFormulaNumbered"?

Why is there no margin (or empty space) around the formula? Why does the latter not display numbers?

How to set those styles to do what one expects?

-
I agree that there is no extra margin on the left, but when using DisplayFormulaNumbered I get a number on the extreme right side. What exactly do you expect? –  VLC Oct 28 '12 at 10:51
I do not get a number on the right side. I expect a certain margin, offsetting the formula from the plain text. The problem arises - as I now realize - from the cell being inline. –  NoEscape Oct 28 '12 at 11:29

Here is a walk-through with some of the shortcuts that I like to use.

Normally, you'd enter text and inline formulas using the cell style "Text", and when you're ready to enter a displayed equation you have to start a new cell. At that point, you would go to the menu and select, e.g., the style "DisplayFormulaNumbered" with the mouse. Having to take your hands off the keyboard for this purpose inevitably slows you down. But this can be avoided if you make use of the CMD-0 shortcut for Format > Style > Other...:

At this point, I select DisplayFormulaNumbered, and this selection will be remembered next time you do CMD-0 to insert further displayed equations, so you can dismiss the dialog without using the mouse by pressing Return. It's even remembered across Mathematica sessions. This is the fastest way to get into the DisplayFormulaNumbered environment in a new cell.

Usually I now enter the equation in TraditionalForm. The default format type for displayed equations is not TraditionalForm, but you get that format either by converting an existing inline equation to DisplayFormulaNumbered (as mentioned by the OP), or by pasting a TraditionalForm expression, or by doing Cmd-Shift-T on whatever you type in the new DisplayFormulaNumbered cell.

Another useful trick for numbered equations is the shortcut for entering equation references described in Albert Retey's answer to "Creating a cross referencing shortcut."

If you now want to change the margins or alignment of the DisplayFormulaNumbered cell, that can be done by selecting Format > Edit Stylesheet... and choosing the style DisplayFormulaNumbered from the popup menu. Then you can highlight the template cell that appears, and change (e.g.) Format > Text Alignment > Align Center.

-

You must NOT use inline math cells. A DisplayFormula must be a cell on its own. If you want to turn an inline math cell into a DisplayFormula, first select the line containing it and choose "Divide Cells", then apply the DisplayFormula style to the new cell!

-