6
$\begingroup$

I have a stylesheet that has inherited some base definitions from another, but would like to "prune" the list of available styles, by removing or disabling1 some. Is there a way to do this?


1. This is not a question about how to delete I style I've defined from my stylesheet, but how to disable a style that my stylesheet has inherited.

$\endgroup$
8
  • $\begingroup$ I haven't counted but if there are probably over a hundred styles going up the inheritance hierarchy. Why do you want to disable a style? If you are not using that style then what does it matter? If you are using that style then do you really mean "disable" it or do you mean alter it? $\endgroup$ Nov 12, 2012 at 1:55
  • $\begingroup$ @MikeHoneychurch: For usability. It's a style that we don't use, and is not customized to fit with the other styles, so using it would be an error. It should be absent from list of available styles, to prevent that error. $\endgroup$
    – orome
    Nov 12, 2012 at 2:11
  • $\begingroup$ Sorry but I do not understand. If you do not use a style then so what. There is no need to remove it if it is not being used. Can you explain in your question why you think having a style that you do not use causes an error -- please give an example. I (and mostly likely all users) probably never use 100+ built in styles that inherit in my stylesheets. So what -- I do not need to disable them simply because I am not using them. $\endgroup$ Nov 12, 2012 at 2:34
  • $\begingroup$ Additionally I'm not sure you could "disable" a style -- you haven't defined what you mean by "disable" but I would think the only way to make a style not able to be used would probably be to delete it. Above all else you do NOT want to be editing or otherwise modifying the built in stylesheets that are bundled with Mma. In your comment you make it sound like you may want to edit the list displayed in Format > Style. Is that what you mean? If so you still need to define those "disabled" styles in your custom stylesheet. $\endgroup$ Nov 12, 2012 at 2:43
  • $\begingroup$ @MikeHoneychurch: For the same reason you'd disable or deprecate an API, the use of which you want to discourage; or that you'd use encapsulation. I have a team producing documents that should have particular formatting that has been specified in my stylesheet, but because that stylesheet has inherited from another (Default), it has styles in it that no one should use (and that have not been customized to follow standards). I just want to yank those from the list of styles they can apply. $\endgroup$
    – orome
    Nov 12, 2012 at 2:43

1 Answer 1

5
$\begingroup$

If you don't want a style to be available from the menu then edit your stylesheet and add all the styles that you want removed from the style listing.

For example if you don't want the Text style to appear then add this cell to your stylesheet:

Cell[StyleData["Text"],
StyleMenuListing->None]

Do this for all styles that you want to remove from the style listing.

Cell[StyleData["Style#1ThatIWantRemoved"],
StyleMenuListing->None]


Cell[StyleData["Style#2ThatIWantRemoved"],
StyleMenuListing->None]

etc.

Or alternatively just add empty cells for each of your unwanted styles (you can do this from "Choose A Style" pull down menu in the Edit Stylesheet notebook) and then select all of those styles you just added and make the change via the Options Inspector

enter image description here

$\endgroup$
2
  • $\begingroup$ Could I go the other way: StyleMenuListing->None for the whole stylesheet and then just StyleMenuListing->Automatic for the ones I redefine and want to use? $\endgroup$
    – orome
    Nov 12, 2012 at 3:01
  • $\begingroup$ No because styles are inherited upwards. So at the cell level they are still defined as Automatic even if at the notebook level you set it to None, so you need to set it as each cell level. $\endgroup$ Nov 12, 2012 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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