# Notebooks as Wolfram Language Expressions

Notebook[{cell_{1},cell_{2},…}] | a notebook containing a sequence of cells |

Notebook[cells,options] | a notebook with options specified |

Expressions corresponding to notebooks.

Notebook[{

Cell["Section heading", "Section"],

Cell["Some text.", "Text"],

Cell["More text.", "Text"]}]

Just like individual cells, notebooks in the Wolfram System can also have options. You can look at and modify these options using the Option Inspector in the standard notebook front end.

option | default value | |

WindowSize | {nx,ny} | the size in pixels of the window used to display the notebook |

WindowFloating | False | whether the window should float on top of others |

WindowToolbars | {} | what toolbars to include at the top of the window |

ShowPageBreaks | False | whether to show where page breaks would occur if the notebook were printed |

CellGrouping | Automatic | how to group cells in the notebook |

Evaluator | "Local" | what kernel should be used to do evaluations in the notebook |

Saveable | True | whether a notebook can be saved |

A few of the large number of possible options for notebooks.

A notebook with the option setting Saveable->False can always be saved using the Save As menu item, but does not respond to Save and does not prompt for saving when it is closed.

In addition to notebook options, you can also set any cell option at the notebook level. Doing this tells the Wolfram System to use that option setting as the default for all the cells in the notebook. You can override the default by explicitly setting the options within a particular cell or by using a named style which explicitly overrides the option.

Notebook[{

Cell["Section heading", "Section"],

Cell["Some text.", "Text"]},

WindowToolbars->{"RulerBar"}]

Notebook[{

Cell["Section heading", "Section"],

Cell["Some text.", "Text"]},

Background->GrayLevel[.7]]

If you go outside of the Wolfram System and look at the raw text of the file that corresponds to a Wolfram System notebook, you will find that what is in the file is just the textual form of the expression that represents the notebook. One way to create a Wolfram System notebook is therefore to construct an appropriate expression and put it in a file.

In notebook files that are written out by the Wolfram System, some additional information is typically included to make it faster for the Wolfram System to read the file in again. The information is enclosed in Wolfram Language comments indicated by (*…*) so that it does not affect the actual expression stored in the file.

NotebookOpen["file.nb"] | open a notebook file in the front end |

NotebookPut[expr] | create a notebook corresponding to expr in the front end |

NotebookGet[obj] | get the expression corresponding to an open notebook in the front end |

Setting up notebooks in the front end from the kernel.

In[1]:= |

In[2]:= |

Out[2]= |

Once you have set up a notebook in the front end using NotebookOpen, you can then manipulate the notebook interactively just as you would any other notebook. But in order to use NotebookOpen, you have to explicitly have a notebook expression in a file. With NotebookPut, however, you can take a notebook expression that you have created in the kernel, and immediately display it as a notebook in the front end.

In[4]:= |

Out[4]= |

In[6]:= |

Out[6]= |