18
$\begingroup$

Since every single time I start Mathematica, my first action is aligning the windows properly (Notebook on the left for $2/3$ of the screen, help on the right for the other $1/3$), I was wondering whether this could be done automatically. This is what it looks like:

enter image description here

How could I make Mathematica to use these window positions and sizes by default?

$\endgroup$
3
  • $\begingroup$ On Windows I use "Tile Windows Tall" from the Window menu. I don't know if it's available on Linux. $\endgroup$
    – Szabolcs
    Commented Feb 11, 2012 at 23:18
  • 2
    $\begingroup$ You can do this by setting (SetOptions) the WindowSize option on all Notebooks[] but the documentation one for window size, WindowMargins for window positions. Get the usable screen size (sans Gnome panel) with ScreenRectangle /. Options[$FrontEnd, ScreenRectangle]. Sorry, no time for a proper answer, but you should be able to work out the details going from here. $\endgroup$
    – Szabolcs
    Commented Feb 11, 2012 at 23:29
  • $\begingroup$ I cannot seem to position the "Documentation Center" even if I directly edit System/Guides/Mathematica.nb so it seems the position of that is controlled elsewhere. $\endgroup$
    – Mr.Wizard
    Commented Feb 11, 2012 at 23:53

2 Answers 2

16
$\begingroup$

The help window position can be set to be remembered from the Options Inspector: open it, select Global preferences, go to Global Options -> Dialog Settings -> Help Viewer Settings and set Enabled to True.

$\endgroup$
7
  • 5
    $\begingroup$ Confirmed to work. It does not work after positioning only the Documentation Center page, but after position another window, that one also comes up in the new location. $\endgroup$
    – Mr.Wizard
    Commented Feb 12, 2012 at 4:03
  • $\begingroup$ Thank you, that's very helpful already. All that's left is now doing this for a new notebook as well. Would there be some way of having some autorun commands for each new nb created? $\endgroup$
    – David
    Commented Feb 12, 2012 at 6:46
  • 1
    $\begingroup$ Unfortunately it is not possible to set a global default size and position for each new notebook that is created. So the 1/3 screen for the help browser is possible but not the 2/3 screen for the notebook. $\endgroup$ Commented Feb 12, 2012 at 11:44
  • $\begingroup$ @David I don't know. I tried to change things like DefaultNotebook in the past but could not get it to work. I would very much like to know, too, for the same reason as you. $\endgroup$
    – acl
    Commented Feb 12, 2012 at 13:38
  • $\begingroup$ @acl I actually asked Tech Support about this a week or so ago after I couldn't figure out how to answer a question re: default size and positioning of notebooks. They advised it is not possible to globally set default size and position for new notebooks. (whereas you can for various dialogs as above) $\endgroup$ Commented Feb 12, 2012 at 23:59
10
$\begingroup$

From what I've read here on MSE, it is not possible to create a default WindowSize for new notebooks. To cope with this efficiently, I've created the following Palette which others might find handy as well.

The result looks like this:

enter image description here

And the full code is:

(* Screen sizing buttons *)

fullscreen = 
 Button[Text[Style["Full Screen", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Full}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

autosize = Button[Text[Style["Auto Size", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Automatic}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

medsize = Button[Text[Style["Med size", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Medium}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

windowTwoThirds = 
 Button[Text[Style["2/3 width", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Scaled[2/3], Scaled[.98]},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

windowOneHalf = 
 Button[Text[Style["1/2 width", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Scaled[1/2], Scaled[.98]},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

windowOneThird = 
 Button[Text[Style["1/3 width", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Scaled[1/3], Scaled[.98]},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

maxwindow = Button[Text[Style["Max size", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Scaled[1], Scaled[1]},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

maxwidth = Button["\[LeftRightArrow]",
  SetOptions[SelectedNotebook[], 
   WindowSize -> {Scaled[1], Automatic}(*WindowMargins\[Rule]{{0,
   Automatic},{Automatic,0}}*)], BaseStyle -> {"GenericButton", 10}, 
  ImageSize -> Medium]

maxheight = 
 Button[Text[Style["\[UpDownArrow]", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], WindowSize -> {Automatic, Scaled[1]}
   (*WindowMargins\[Rule]{{0,Automatic},{Automatic,0}}*)], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

(* Screen movement buttons *)

movetopleft = 
 Button[Text[
   Style["\[UpperLeftArrow] Move", Small, FontFamily -> "Helvetica"]],
  SetOptions[SelectedNotebook[], 
   WindowMargins -> {{0, Automatic}, {Automatic, 0}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

movetopright = 
 Button[Text[
   Style["Move \[UpperRightArrow]", Small, FontFamily -> "Helvetica"]], 
  SetOptions[SelectedNotebook[], 
   WindowMargins -> {{Automatic, 0}, {Automatic, 0}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

movebottomright = 
 Button[Text[
   Style["Move \[LowerRightArrow]", Small, FontFamily -> "Helvetica"]], 
  SetOptions[SelectedNotebook[], 
   WindowMargins -> {{Automatic, 0}, {0, Automatic}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

movebottomleft = 
 Button[Text[
   Style["\[LowerLeftArrow] Move", Small, FontFamily -> "Helvetica"]], 
  SetOptions[SelectedNotebook[], 
   WindowMargins -> {{0, Automatic}, {0, Automatic}}], 
  BaseStyle -> {"GenericButton", 10}, ImageSize -> Medium]

(* Create palette *)

CreatePalette[Row@{
   (*Grid@{{unlockCell,quitKernel,redColor},{lockCell, "",clearColor}},*)

   Grid@{{fullscreen, maxwindow, autosize}, {windowTwoThirds, windowOneHalf, 
      windowOneThird}},
   Grid@{{maxheight}, {maxwidth}},
   Grid@{{movetopleft,
      movetopright},
     {movebottomleft,
      movebottomright}}
   },
 WindowTitle -> "Screen management"
 ]

Once the palette has shown up as a dialog window in Mathematica, you should use (menu) > Palettes > Install palette... to ensure it is always available under the Palettes menu.

$\endgroup$
4
  • $\begingroup$ Wow. This is extremely useful. Thanks!! $\endgroup$
    – Edmund
    Commented Mar 14, 2015 at 10:57
  • $\begingroup$ Very helpful indeed! However, I notice that this palette only couples to one specific notebook, and that if I have multiple notebooks open, the palette is only visible when the notebook it was opened from is in focus. This is not the case for Basic Math Assistant for instance. Is there a way to change this so that the palette applies to whichever notebook is currently in focus? $\endgroup$ Commented Mar 25, 2015 at 8:01
  • $\begingroup$ Nevermind, I just needed to close Mathematica with the palette open, now it applies to all open Notebooks. Cheers! $\endgroup$ Commented Mar 25, 2015 at 8:26
  • $\begingroup$ Strange, it works for me: the palette works on whichever window is in focus, even including the Help window (a.k.a. Wolfram Documentation). Have you installed the palette so that it appears in the Palette menu? $\endgroup$ Commented Mar 25, 2015 at 8:26

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.