Skip to main content
deleted 10 characters in body
Source Link
M.R.
  • 31.9k
  • 9
  • 102
  • 299

Wasn't sure where to put this and couldn't connect with you on chat so here goes: this is the behavior I'm seeing (mentioned in the comments), noteAs Kuba's comment fixes the problematic raggedness:

enter image description here

and this is my code for the counter cell dingbat:

SetOptions[EvaluationNotebook[],   NotebookEventActions -> {{"MenuCommand",   "Save"} :> (Scan[   Module[{nr},   SelectionMove[#, All, CellGroup, AutoScroll -> False];     nr = Length@   Select[SelectedCells[],   Experimental`CellStyleNames[#] ===   "ItemNumbered" & (*1*)];     SetOptions[#,   CellDingbat ->   Cell[BoxData[   PaneBox[  StyleBox[ToString[nr] <> " ",   RGBColor[0.5, 0.5, 0.67, 0.81],   FontFamily -> "Continuum Light", 15]]15], Alignment -> Right, ImageSize -> 40]],    Background -> White]];] &,   Cells[CellStyle -> "Subsection"] (*2*)]),   PassEventsDown -> True}] 

enter image description here

Wasn't sure where to put this and couldn't connect with you on chat so here goes: this is the behavior I'm seeing (mentioned in the comments), note the problematic raggedness:

enter image description here

and this is my code for the counter cell dingbat:

SetOptions[EvaluationNotebook[], NotebookEventActions -> {{"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length@ Select[SelectedCells[], Experimental`CellStyleNames[#] === "ItemNumbered" & (*1*)]; SetOptions[#, CellDingbat -> Cell[BoxData[ StyleBox[ToString[nr] <> " ", RGBColor[0.5, 0.5, 0.67, 0.81], FontFamily -> "Continuum Light", 15]], Background -> White]];] &, Cells[CellStyle -> "Subsection"] (*2*)]), PassEventsDown -> True}] 

As Kuba's comment fixes the raggedness:

SetOptions[EvaluationNotebook[],   NotebookEventActions -> {{"MenuCommand",   "Save"} :> (Scan[   Module[{nr},   SelectionMove[#, All, CellGroup, AutoScroll -> False];     nr = Length@   Select[SelectedCells[],   Experimental`CellStyleNames[#] ===   "ItemNumbered" & (*1*)];     SetOptions[#,   CellDingbat ->   Cell[BoxData[   PaneBox[  StyleBox[ToString[nr] <> " ",   RGBColor[0.5, 0.5, 0.67, 0.81],   FontFamily -> "Continuum Light", 15], Alignment -> Right, ImageSize -> 40]],    Background -> White]];] &,   Cells[CellStyle -> "Subsection"] (*2*)]),   PassEventsDown -> True}] 

enter image description here

added a picture of the remaining problem
Source Link
M.R.
  • 31.9k
  • 9
  • 102
  • 299

I think when it's done each time you save the notebook it should be nice enough :)

SetOptions[ EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length @ Select[ SelectedCells[], Experimental`CellStyleNames[#] === "Input" & (*1*) ]; SetOptions[#, CellDingbat -> "(" <> ToString[nr] <> ")"]; ] & , Cells[CellStyle -> "Section"] (*2*) ]), PassEventsDown -> True } ] 

Ad 1. Cell style to count

Ad 2. Cell style whose parent group end "resets the counter"

You can use it in stylesheets too.

enter image description here


Update from Question's Author:

Wasn't sure where to put this and couldn't connect with you on chat so here goes: this is the behavior I'm seeing (mentioned in the comments), note the problematic raggedness:

enter image description here

and this is my code for the counter cell dingbat:

SetOptions[EvaluationNotebook[], NotebookEventActions -> {{"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length@ Select[SelectedCells[], Experimental`CellStyleNames[#] === "ItemNumbered" & (*1*)]; SetOptions[#, CellDingbat -> Cell[BoxData[ StyleBox[ToString[nr] <> " ", RGBColor[0.5, 0.5, 0.67, 0.81], FontFamily -> "Continuum Light", 15]], Background -> White]];] &, Cells[CellStyle -> "Subsection"] (*2*)]), PassEventsDown -> True}] 

I think when it's done each time you save the notebook it should be nice enough :)

SetOptions[ EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length @ Select[ SelectedCells[], Experimental`CellStyleNames[#] === "Input" & (*1*) ]; SetOptions[#, CellDingbat -> "(" <> ToString[nr] <> ")"]; ] & , Cells[CellStyle -> "Section"] (*2*) ]), PassEventsDown -> True } ] 

Ad 1. Cell style to count

Ad 2. Cell style whose parent group end "resets the counter"

You can use it in stylesheets too.

enter image description here

I think when it's done each time you save the notebook it should be nice enough :)

SetOptions[ EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length @ Select[ SelectedCells[], Experimental`CellStyleNames[#] === "Input" & (*1*) ]; SetOptions[#, CellDingbat -> "(" <> ToString[nr] <> ")"]; ] & , Cells[CellStyle -> "Section"] (*2*) ]), PassEventsDown -> True } ] 

Ad 1. Cell style to count

Ad 2. Cell style whose parent group end "resets the counter"

You can use it in stylesheets too.

enter image description here


Update from Question's Author:

Wasn't sure where to put this and couldn't connect with you on chat so here goes: this is the behavior I'm seeing (mentioned in the comments), note the problematic raggedness:

enter image description here

and this is my code for the counter cell dingbat:

SetOptions[EvaluationNotebook[], NotebookEventActions -> {{"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length@ Select[SelectedCells[], Experimental`CellStyleNames[#] === "ItemNumbered" & (*1*)]; SetOptions[#, CellDingbat -> Cell[BoxData[ StyleBox[ToString[nr] <> " ", RGBColor[0.5, 0.5, 0.67, 0.81], FontFamily -> "Continuum Light", 15]], Background -> White]];] &, Cells[CellStyle -> "Subsection"] (*2*)]), PassEventsDown -> True}] 
better wording?
Source Link
Kuba
  • 138.9k
  • 13
  • 297
  • 803

I think when it's done each time you save the notebook it should be nice enough :)

SetOptions[ EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length @ Select[ SelectedCells[], Experimental`CellStyleNames[#] === "Input" & (*1*) ]; SetOptions[#, CellDingbat -> "(" <> ToString[nr] <> ")"]; ] & , Cells[CellStyle -> "Section"] (*2*) ]), PassEventsDown -> True } ] 

Ad 1. Cell style to count

Ad 2. Cell style whose parent groups are summarizedgroup end "resets the counter"

You can use it in stylesheets too.

enter image description here

I think when it's done each time you save the notebook it should be nice enough :)

SetOptions[ EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length @ Select[ SelectedCells[], Experimental`CellStyleNames[#] === "Input" & (*1*) ]; SetOptions[#, CellDingbat -> "(" <> ToString[nr] <> ")"]; ] & , Cells[CellStyle -> "Section"] (*2*) ]), PassEventsDown -> True } ] 

Ad 1. Cell style to count

Ad 2. Cell style whose parent groups are summarized

You can use it in stylesheets too.

enter image description here

I think when it's done each time you save the notebook it should be nice enough :)

SetOptions[ EvaluationNotebook[], NotebookEventActions -> { {"MenuCommand", "Save"} :> (Scan[ Module[{nr}, SelectionMove[#, All, CellGroup, AutoScroll -> False]; nr = Length @ Select[ SelectedCells[], Experimental`CellStyleNames[#] === "Input" & (*1*) ]; SetOptions[#, CellDingbat -> "(" <> ToString[nr] <> ")"]; ] & , Cells[CellStyle -> "Section"] (*2*) ]), PassEventsDown -> True } ] 

Ad 1. Cell style to count

Ad 2. Cell style whose parent group end "resets the counter"

You can use it in stylesheets too.

enter image description here

better english?
Source Link
Kuba
  • 138.9k
  • 13
  • 297
  • 803
Loading
Source Link
Kuba
  • 138.9k
  • 13
  • 297
  • 803
Loading