9
$\begingroup$

When I installed the mathStatica application, it seems to have made some kind of change deep in my Mathematica 8.0.4 system files. That change causes the mathStatica palette to appear out of alphabetical order in the Palettes menu. And the palette notebook does not set any value for MenuPosition.

In $UserBaseDirectory/Autoload/PacletManager/Configuration/FrontEnd/init.m I see:

SetOptions[$FrontEndSession,
PalettePath -> {ParentList, FrontEnd`FileName[{$UserBaseDirectory,
  "Applications", "mathStatica", "FrontEnd", "Palettes"},
"PacletManager" -> True]} ....

(Note that on my Mac OS X 10.7.3 system, $UserBaseDirectory is the same as $BaseDirectory.)

However, if I delete the PalettePath option there, quit Mathematica, and restart it with clean preferences and clean cache, nonetheless:

  • that same PalettePath option reappears in the same init.m; and then of course

  • the mathStatica palette appears again out of order in the menu Palettes list.

Question: what changes to some system file might cause this annoying and persistent behavior.

I've looked at all the init.m files I could find inside the Mathematica.app package (which is how the Mac bundles the entire $InstallationDirectory) but don't see anything suspicious.

$\endgroup$
2
  • $\begingroup$ Maybe you will find something in Options Inspector. $\endgroup$ Mar 5, 2012 at 23:22
  • $\begingroup$ @Chris Degnen: I wouldn't know what sort of thing to search for in Options Inspector for the palette's notebook. (There's no MenuPosition item, e.g., that I see.) $\endgroup$
    – murray
    Mar 6, 2012 at 0:50

2 Answers 2

9
$\begingroup$

mathStatica does not alter, nor seek to alter, the MenuSortingValue. In fact, mathStatica does not alter or seek to alter, in any way, how or where the mathStatica palette is listed in the palette menu... this is left entirely to default Mathematica behaviour.

The reason the mathStatica palette appears out of alphabetical order in the Palettes menu seems to be simply because all the other palettes start with an Upper case letter, whereas the mathStatica palette starts with a lower case 'm'. Stated simply: this appears to be a bug in Mathematica's menu sorting algorithm.

The mathStatica palette name is set under:

  Preferences --> Notebook options  -->  Window properties -->  WindowTitle -> "mathStatica"

If this setting is changed from lower case "mathStatica" to upper case "MathStatica", and no other change is made, then the "MathStatica" palette appears alphabetically in the palette menu, as Prof Murray Eisenberg desires it to appear, rather than at the end of the palette list. If Wolfram 'update' their menu sorting algorithm, the desired menu appearance should be attained automatically.

(If anyone wants an adjusted palette with upper case WindowTitle MathStatica, just let me know, and I can send you a copy.)

$\endgroup$
1
  • 1
    $\begingroup$ I'm not sure I'd call it a bug, unless it is explicitly stated somewhere that the sorting is alphabetical. Indeed, from the stated behaviour I conclude that the sorting is simply by the ASCII (or Unicode/ISO 10646) value of the character (in that sorting, uppercase letters and lowercase letters among themselves are sorted alphabetically, but lowercase letters are strictly sorted after the uppercase ones). $\endgroup$
    – celtschk
    Apr 1, 2012 at 18:23
12
$\begingroup$

I don't know anything about mathStatica, so I can't comment on specifically what it's doing. But I can comment on the various moving parts of the system.

The init.m file is created by the paclet manager. It must be that the mathStatica palette is part of a paclet which is under active management by the paclet manager. The paclet manager, as part of its regular duties, ensures that init.m files are placed where the FE can read them for any front end resources under its management, which includes palettes and stylesheets.

But, and let me be super-clear here...this fiddling with init.m files has absolutely no effect on menu ordering. It can only possibly affect whether or not a given notebook file is in the palette path or not.

The sequence in which things are sorted is documented in ref/MenuSortingValue (what MenuPosition was renamed to in v8), although there is one thing not stated here. If no explicit MenuSortingValue is specified, then its effective MenuSortingValue is the largest possible value, which means that the entry will always be in the final alphabetized group. The palettes which are bundled with Mathematica have an explicitly specified MenuSortingValue, so that means that any palette which doesn't specify this will always go in the bottom-most group of palettes.

You could use the following code to change the palette's MenuSortingValue to be whatever you wish:

nb=NotebookOpen["mathStatica.nb"];
CurrentValue[nb,MenuSortingValue] = n (* use the value you want here *);
NotebookSave[nb];
NotebookClose[nb]
FrontEndExecute[FrontEnd`ResetMenusPacket[{Automatic}]]

The built-in value of n for the various palettes in v8 are:

  • Assistant palettes - 1000
  • Slideshow palette - 1050
  • All other palettes - 1100

These values might change in future versions, but the documentation guarantees that they will always be in the 1000-2000 range.

Of course, if the palette is ever updated by the paclet manager, it will blow your changes away, but I think they should persist between sessions until an update comes.

$\endgroup$
1
  • 1
    $\begingroup$ I was wondering, what exactly is a paclet, and in particular: is it possible to use this functionality to automatically update a package (or in my case: palette) from the internet? Is there any documentation on this? I can see that in the docs browser, guide/InstalledAddOns, there is an 'Update' button for all packages, but it's greyed out. I would like to implement automatic updating for a palette, and I was wondering if there's something that I can re-use, or I should start from scratch. $\endgroup$
    – Szabolcs
    Jul 21, 2012 at 15:17

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.