2

Is there a way to change the headings on NumberedItem style?

Instead of it going

1.

2.

3.

I am looking for it to go

A.

B.

C.

with the auto increment. I can't find a style that has headings as letters.

  • What after Z? – Kuba Dec 08 '17 at 07:30
  • @Kuba internally they actually handle this problem via CharacterRange. I think this question is a dupe of one I answered a few weeks back, but I'll need to look it up. – b3m2a1 Dec 08 '17 at 07:31
  • @Kuba I only need it up to D so I hadn't considered that yet. @b3m2a1 I tried searching but I don't know how to phrase it. I looked for 'numbereditem string header' and similar but had no results. I just look through your answers for 'itemnumbered' and 'item', didn't find anything. – I should change my Username Dec 08 '17 at 07:32
  • @b3m2a1 Not sure I understand, where do they handle what? I know we can refer to character codes but what if user expects excel like convention, AA,AB,.... – Kuba Dec 08 '17 at 07:35
  • @Kuba if you look at the standard CounterFunction definitions they all look like Function[CharacterRange[n1, n2][[#]]] when not defined by string. I know the user might expect something else. That's just what Mathematica provides. – b3m2a1 Dec 08 '17 at 07:36
  • @b3m2a1 thanks, I wasn't expecting CharacterRange in stylesheets. – Kuba Dec 08 '17 at 07:38
  • 2
    @Kuba neither was I. Here's where I dug this up: https://mathematica.stackexchange.com/a/159829/38205 – b3m2a1 Dec 08 '17 at 07:39
  • That worked. Thanks. Can I also change the delimiter in CounterBoxOption from ending in . to ending in ) or -? – I should change my Username Dec 08 '17 at 07:43

2 Answers2

4

From @b3m2a1's linked post mathematica.stackexchange.com/a/159829/38205

Cell["a", "ItemNumbered",
 CellChangeTimes->{{3.72170647675723*^9, 3.7217064817685165`*^9}},
 CounterBoxOptions -> {
    CounterFunction -> Function[CharacterRange["A", "Z"][[#]]]
    }]
3

You should do this in the style sheet. So:

SetOptions[
    EvaluationNotebook[],
    StyleDefinitions -> Notebook[
        {
        Cell[StyleData[StyleDefinitions->"Default.nb"]],
        Cell[StyleData["ItemNumbered"],
            CellDingbat->Cell[TextData[{CounterBox["ItemNumbered"], ")"}],FontWeight->Bold],
            CounterBoxOptions->{CounterFunction->(CharacterRange["A","Z"][[#1]]&)}
        ]
        },
        StyleDefinitions->"PrivateStylesheetFormatting.nb"
    ]
]

where I used ")" instead of "." as requested in a comment.

Carl Woll
  • 130,679
  • 6
  • 243
  • 355