Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I use

CreateDocument[cells, opts] 

to create a notebook. When the notebook is open, it has a small default windows size and I need to manually maximize it every time. Is there a good way to have it maximized by default?

share|improve this question

2 Answers 2

up vote 11 down vote accepted

Try the option WindowSize -> Scaled[1]:

CreateDocument["text", WindowSize -> Scaled[1]]
share|improve this answer
    
If you want to make it full screen (i.e. without menu bars), then use WindowSize -> Full –  The Toad Sep 15 '12 at 17:38
    
@R.M Yes, I wrote Full at first, but later thought what OP want might be a maximization with menu bar. –  Silvia Sep 15 '12 at 17:44

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.

share|improve this answer
    
I think you accidentally posted the same answer in two places –  The Toad Mar 14 at 12:03
    
Yes, actually in three, this question as well as here and here. I wasn't quite sure how to deal with this as all the related questions are two to three years old. If you have suggestions for cleaning this up yet preserving my intention to share (and adhere to civil best practice), please do let me know. –  zentient Mar 14 at 12:19

Your Answer

 
discard

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.