7
$\begingroup$

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?

$\endgroup$
1
  • 1
    $\begingroup$ On windows: ctrl+n, then alt+space, x $\endgroup$
    – Coolwater
    Commented Feb 19, 2016 at 19:21

2 Answers 2

14
$\begingroup$

Try the option WindowSize -> Scaled[1]:

CreateDocument["text", WindowSize -> Scaled[1]]
$\endgroup$
2
  • $\begingroup$ If you want to make it full screen (i.e. without menu bars), then use WindowSize -> Full $\endgroup$
    – rm -rf
    Commented Sep 15, 2012 at 17:38
  • 1
    $\begingroup$ @R.M Yes, I wrote Full at first, but later thought what OP want might be a maximization with menu bar. $\endgroup$
    – Silvia
    Commented Sep 15, 2012 at 17:44
0
$\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$
2
  • $\begingroup$ I think you accidentally posted the same answer in two places $\endgroup$
    – rm -rf
    Commented Mar 14, 2015 at 12:03
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Mar 14, 2015 at 12:19

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.