Tutorial 02
Enhancing a Mathematica Notebook

Copyright © 2003 by Bill Titus, Carleton College,
Department of Physics and Astronomy, Northfield, MN  55057-4025
March 01, 2003

Part 1 - Getting Started

Topics and Skills

1.  Opening a new Mathematica notebook
2.  Saving a new Mathematica notebook

Step 1.  Start up Mathematica and open the notebook  Tutorial02.nb.  Remember, this notebook is located in the workshop folder.

Step 2.  OPTIONAL.  Since you are going to edit this notebook, you need to make a copy of this notebook and work with that copy.  To do so, select  File / SaveAs  from the Mathematica menu and save the workshop notebook in the folder under the name  myTutorial02.nb.

Step 3.  Create a new Mathematica notebook by going to the Mathematica menu and selecting  File / New.  Move windows around until both  Tutorial02.nb  and your new notebook are visible.  Alternately, if you find it difficult working with two notebooks on the screen, use the hard copy of   Tutorial02.nb   in your workshop binder instead of the screen version.

Comment 3

1.  Note that the name of the new notebook is  Untitled-1.

Step 4.  Use  File / Save  from the Mathematica menu to save your new notebook under the name  myNotebook1.nb  in the workshop folder.

Comment 4

1.  The first time you save a new notebook,  Save  prompts you for a notebook name.  After that, when you select  Save,  the notebook is automatically saved under its old name.

Part 2 - Enhancing the Notebook

Topics and Skills

1.  Cell styles using the menu item  Style  and its submenus
2.  Editing and closing cells
3.  Inserting page breaks
4.  Printing a notebook or a notebook selection

Step 1.  Add the title "My Mathematica Notebook for Tutorial 02"  to your new notebook.  To do so, produce a new cell and type in  "My Mathematica Notebook for Tutorial 02".  Then highlight the cell bracket, go to  Format / Style  on the menu bar, and select  Title.

Comment 1

1.  The popup menu under  Format / Style  contains a number of choices for different types of cells.  The important cell types are  Input,  Output,  and various documentation cells like  Title,  Subtitle, ...,  Subsection,  and  Text.  The default cell is an  Input  one.
2.  Different types of cells have different styles (font, alignment, margins, ...)  and allow you to structure your Mathematica notebook so that it's well organized and easy to follow, not only for yourself, but for others who might be reading your notebook.
3.  Note that when you typed in the word  "Mathematica",  it was immediately italicized.  That's Wolfram's way of reminding you that Mathematica is a trade name.

Step 2.  Add a  Subtitle  cell that contains your name to your notebook.  You'll need to first type your name in a cell and then make the cell  a  Subtitle  cell.

Step 3.  Add a  Subsubtitle  cell that contains the date.

Step 4.  Add a  Section  cell to your notebook containing the title  "Arithmetic Examples".

Step 5.  In the next two cells in your new notebook, type in  "Addition"  and  "Multiplication", respectively.  Select both cells simultaneously by clicking and dragging the mouse over the cell brackets.  Then convert the cells to the  Subsection  type.

Step 6.  Add some descriptive text to a new cell just below the  "Addition"  subsection, for example, "Here's an example that illustrates addition.".  Transform the cell into a  Text  cell.   Then highlight the contents of the cell with the mouse and make the font size larger by selecting the menu item  Format / Size  and choosing font size 12.

Step 7.  Add in addition and multiplication examples below the respective subsections.  Evaluate the input by sending results to the Mathematica kernel.

Step 8.  Use the items under  Format  to make your title cell have red text and a cyan background.

Step 9.  Go to your first output cell, center the text, and add a light yellow background to the cell.  Finally change the font size of the text in this cell to 16 points.

Step 10.  Mathematica is usually good at putting page breaks at appropriate places.  But at times, you may want to force a page break before or after a particular cell.  To do so, go to the cell in question and put the cursor someplace in the cell.  Then use the key combination  (apple)(shift)(E).  The cell will magically open up with lots of text.  Don't worry now about what all this text notation means.  Go to the end of the opened cell, type a comma sign before the last bracket, and then the words  PageBreakAbove->True  or  PageBreakBelow->True  if you want the page break to be above or below the cell, respectively.   Finally use the key combination  (apple)(shift)(E)  to restore the cell to its original appearance.  Go to your first output cell and put a page break below it.  Then go to the main menu bar, select  Format / Show Page Breaks  and see if the page break occurs where you thought it would be located.

Comment 10

Step 11.  Restore your notebook to its usual view by unchecking  Format / Show Page Breaks.

Step 12.  For readability, you can collapse groupings of cells by double-clicking the cell bracket surrounding the group.  Try this out for the cell containing "Addition" and its associated input/output cells.  Do the same with the "Multiplication" section.  Finally collapse the cell bracket surrounding "Arithmetic Examples".

Step 13.  Double-click on the collapsed cell bracket surrounding "Arithmetic Examples".   This should open the collapsed cells.

Step 14.  Now you're going to print your new notebook.  To do so, simply select  File / Print  from the Mathematica menu and then press the  Print  button in the print panel that appears.  This notebook will be printed out to the printer indicated in the print panel.

Comment 14

1.  Check out the print formatting possibilities under the menu item  File / Print Selection.
2.  To save on paper, you can usually read two pages of your Mathematica notebook on a single sheet of paper.  You can access this feature by using the appropriate popup menu in the print panel.
3.  If you only want to print a consecutive groups of cell, highlight the appropriate cell brackets with the mouse, go to the main menu bar and choose  File / Print Selection,  and then proceed as before.

Part 3 - Save Your New Notebook

Step 1.   Delete your output cells by selecting  Kernel / Delete All Output  from the main menu bar.

Step 2.   Select  File / Save  from the Mathematica menu to do one final save of your new notebook before you quit Mathematica.