3

I’ve noticed that when I make changes to a notebook’s stylesheet, whether it’s manually or programmatically, often the changes are not applied immediately to the notebook.

Usually all it takes is opening or closing a cellgroup within the notebooks to trigger a refresh which is ok, but I’m wondering if there is a way to do this programmatically? I suppose I could program opening and closing a cellgroup but wondering if there a specific trigger I can use that doesn’t I involve manipulating the notebook.

I often apply stylesheets programmatically to notebooks and I would like to see the update applied immediately (in real time) and without having to touch the notebook at all.

Ideas?

Edit: I've narrowed down the issue I think, it appears to be an issue with making a change in an inherited stylesheet. After making the change, there is no immediate trigger that updates the Notebook. To recreate the problem:

  1. Open a new Notebook. Type some info in a text cell.
  2. Open the notebook's stylesheet (stylesheet 1)
  3. At the top of this stylesheet inherit another one (stylesheet 2)
  4. Open up stylesheet 2 and make a change to text cells(for example, change text color to green).
  5. Notice the notebook does not update upon making the change in stylesheet 2. However, you can force an update in a number of different ways. One way is to open or close a group of cells in the Notebook. This triggers the update.
Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
B flat
  • 5,523
  • 2
  • 14
  • 36
  • Can you add a quick example of code you might run? – N.J.Evans Aug 09 '21 at 19:03
  • Hi @N.J.Evans. I thought it would easier to explain how to recreate issue manually. I edited the post above. It seems to be a problem with triggering an update when there is stylesheet inheritance. I could have sworn I had this issue even without inheritance but I could not recreate the issue. Still the issue with triggering inherited stylesheets remains. – B flat Aug 09 '21 at 20:40
  • Yes that's it! Thank you! – B flat Aug 10 '21 at 10:48

0 Answers0