Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know it's possible to programmatically change options on the selection in a notebook. I'd like to create a button that lets me change the style of a cell. It's a style that doesn't have a keyboard shortcut, "ItemParagraph"

Something like

SetOptions[NotebookSelection[SelectedNotebook[]], CellStyle->"ItemParagraph"]

but CellStyle is for NotebookFind. Is there some way to do this? I just couldn't find the cell option I needed. I checked the Options for Cell but there are hundreds and I couldn't see anything that looked right...

share|improve this question
Yes, I have a palette open onscreen so a button on that palette would be much faster than going through the Format --> Style --> Item Paragraph menu. – Tom De Vries Sep 24 '13 at 15:28
Maybe useful : – Chris Degnen Sep 24 '13 at 15:28
I believe that post shows how to set the default for NEW cells... I am wondering how to select a cell and change whatever option would be to "ItemParagraph" – Tom De Vries Sep 24 '13 at 15:43
up vote 6 down vote accepted

Maybe this button may help you:

Button["ItemParagraph", FrontEndExecute@FrontEndToken[SelectedNotebook[], "Style", "ItemParagraph"]]

The whole cell may be selected with:

SelectionMove[SelectedNotebook[], All, Cell]
share|improve this answer
Thank you so much, exactly what I was looking for, does just what I need, and helps me to see ways to use that for other things. – Tom De Vries Sep 25 '13 at 21:59

I don't know if any of them can be callled documented but I know three ways to do this:

mentioned above:

FrontEndToken way:

 SelectionMove[#, All, Cell]; 
 FrontEndTokenExecute[EvaluationNotebook[], "Style", "Title"]
) & /@ Cells[CellStyle -> "Section"]


SelectionSetStyle way:

 SelectionMove[#, All, Cell];
 MathLink`CallFrontEnd[FrontEnd`SelectionSetStyle[#, "Title"]]
   ) & /@ Cells[CellStyle -> "Section"]

or (which is implemented with code from above)

CellStyleNames way:

 SelectionMove[#, All, Cell];
 Experimental`CellStyleNames[#] = "Title";
) & /@ Cells[CellStyle -> "Section"]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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