# Customizing the numbers used by DisplayFormulaNumbered cells

I was typesetting some formulas and I encountered a formula number marked with a prime.

I am using the DisplayFormulaNumbered cell style. How can I add a cell with numbered with $7'$? Here is an excerpt from one of my notebooks marked to show how I want a formula numbered.

-
That isn't going to work as an automatic cell counter. You would need to set 4' manually or perhaps create a separate style –  Mike Honeychurch Jul 11 at 23:04
Are you aware that a DisplayFormulaNumbered cell doesn't contain any reference to the number it displays? That makes it a bit hard to get control over the displayed number. –  m_goldberg Jul 11 at 23:16

I have created a new style to implement this. The first screen grab is the finished product:

Here is a pic with the underlying expression shown. Note the new style "DisplayFormulaNumberedPrimed":

The new style was added to the private stylesheet for this notebook:

The underlying box code for this style is:

Cell[StyleData["DisplayFormulaNumberedPrimed", StyleDefinitions>StyleData["DisplayFormulaNumbered"]],
CellFrameLabels->{{None,
Cell[TextData[Cell[BoxData[RowBox[{"(",SuperscriptBox[ CounterBox["DisplayFormulaNumbered"], \[Prime]], ")"}]],
FontFamily->"Times",FontSize->Inherited]],
"DisplayFormulaEquationNumber"]}, {None, None}},
CounterIncrements->""
]


Note that aesthetically you will probably want to tweek this because the parenthesis size rescale due to the prime.

Edit

This is a bit cleaner:

Cell[StyleData["DisplayFormulaNumberedPrimed", StyleDefinitions->StyleData["DisplayFormulaNumbered"]],
CellFrameLabels->{{None,
Cell[TextData[{
Cell[BoxData[
RowBox[{Cell["("], "\[NegativeThinSpace]",
SuperscriptBox[ CounterBox["DisplayFormulaNumbered"], \[Prime]], "\[NegativeThinSpace]",Cell[")"]}]],FontFamily->"Times",FontSize->Inherited]
}], "DisplayFormulaEquationNumber"]}, {None, None}},
CounterIncrements->""
]


Note that the way this works is that CounterIncrements->"" prevents any incremental increase in the counter -- since you want to use the same counter number as the "DisplayFormulaNumbered"` cell immediately prior to the primed number.

-