0
$\begingroup$

When I prepare a notebook to share with others, I like the numbering of the code cells to start from 0 and to increment predictably to make them more readable, but the only way I know to do this is by restarting the kernel and rerunning the notebook. However, my notebooks often take tens of minutes to run, so I was wondering if it was possible to get the numbers to look nice a different way?

$\endgroup$
2
$\begingroup$

Does it fit your needs?

MapIndexed[
 SetOptions[#, CellLabel -> StringTemplate["In[``]"][#2[[1]]]] &,
 Cells[EvaluationNotebook[], CellStyle -> {"Input"}]
]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.