After some googling about cell numbering, I ended up being able to number inline formula, text, output, but not input cells.
Of course, there is already the In[_] numbering or the possibility of numbering the corresponding output cell (if it exists), so that input cell numbering may not be necessary after all.
However, when input is reevaluated, the In[_] numbering changes and the output cell numbering is lost so input cell numbering is really important.
According to CounterTutorial.nb by P. J. Hinton, 1998:
However, when trying to reference a tagged input cell (with Insert > Automatic Numbering), the reference number is zero. The counter is not incremented. Thus the "low level trickery" must be inspected.
Format > Edit style sheet.
The private style definition notebook (or style sheet) opens.
Click the link to PublicationDefault.nb.
Find the style definition for EquationNumbered.
Copy it into the private style sheet.
Edit the metadata with Input instead of Equation, save, then referencing works.
Moreover, in order to share the same style sheet with other notebooks, it can be installed, which means exported. Enter the new style sheet name, InputNumberedPublication.nb, click install. It is indeed copied in $BaseDirectory or $UserBaseDirectory.
Of course, there is already the In[_] numbering or the possibility of numbering the corresponding output cell (if it exists), so that input cell numbering may not be necessary after all.
However, when input is reevaluated, the In[_] numbering changes and the output cell numbering is lost so input cell numbering is really important.
According to CounterTutorial.nb by P. J. Hinton, 1998:
A CounterBox[ ] can appear only in a TextData[ ] expression of a cell, so that means you can use them only [in] cell styles associated with headings and body text. They cannot be used in the contents of typeset math cells.Therefore, input cell numbering may not be so easy. However:
You can inspect the low level trickery that is used by opening up the notebook's style sheet and unformatting the prototype cell for NumberedEquation. I won't go into too much more detail except to say that frame labels for a cell are set with the option CellFrameLabels, which is somewhat similar to the FrameLabel option for graphics objects.Here is the idea of CellFrameLabels:
CellPrint[
Cell[BoxData["1+1"], "Input",
CellFrameLabels -> {{None,
Cell[TextData[CounterBox["InputNumbered"]], "Input",
Brown]}, {None, None}}]]
Actually, the InputNumbered cell style happens to be already in the shared style sheet PublicationDefault.nb (a Mathematica system file). Choose this style sheet. Although InputNumbered is not in the Format > Style menu, it can be found with Format > Style > Other and the search box. As expected, InputNumbered cells are numbered.However, when trying to reference a tagged input cell (with Insert > Automatic Numbering), the reference number is zero. The counter is not incremented. Thus the "low level trickery" must be inspected.
Format > Edit style sheet.
The private style definition notebook (or style sheet) opens.
Click the link to PublicationDefault.nb.
Find the style definition for EquationNumbered.
Copy it into the private style sheet.
Edit the metadata with Input instead of Equation, save, then referencing works.
Moreover, in order to share the same style sheet with other notebooks, it can be installed, which means exported. Enter the new style sheet name, InputNumberedPublication.nb, click install. It is indeed copied in $BaseDirectory or $UserBaseDirectory.
Comments
Post a Comment