How to Autonumber Cell Tags in Mathematica Notebooks?

后端 未结 2 1702
时光取名叫无心
时光取名叫无心 2021-01-06 11:06

I tried to follow the directions on autonumbering cells in a Mathematica-8 notebook, here

http://reference.wolfram.com/mathematica/tutorial/AutomaticNumbering.html

2条回答
  •  無奈伤痛
    2021-01-06 11:55

    I think you are trying to use cell tags in the wrong way
    (and I just noticed that you said as much in a comment above)!

    The counters only count how many cells of a certain style have already occurred (although the counters can be automatically or manually reset/changed). The cell tags are so that you can refer to a specific cell later on, such as a specific equation or code block etc...

    At the moment, your cells tagged "test" us the following counter CounterBox["Code", "test"]. This counter will look for the first code style cell tagged with "test" and print its number. Since you have no code blocks tagged "test", it returns zero.

    If you want a text-like cell that uses a different counter from the normal text cells, then you need to make up a new text style. Go to Format > Edit Stylesheet. Then click on the default.nb and copy the Text style cell into your notebook's stylesheet. Then you can modify it to have a different name (e.g., "Text2") and different counter. Then you can reference these cells numbers using CounterBox["Text2"], just like you did with the normal text cells.

    You can also have them automatically numbered by adding the CounterBox to the CellDingbat or CellFrameLabels. See, for example: Extending cell definition to CellFrameLabels definition and CounterIncrements for individual cells

提交回复
热议问题