Developing Notebooks in Version 4.0

Speaker

Richard Mercer
Wright State University

richard.mercer@wright.edu
http://www.math.wright.edu/People/Richard_Mercer/

Notebooks

What NOT to do when developing notebooks.

Do NOT directly specify fonts without a very good reason!

Use style sheets instead.

Do NOT specify font sizes, even WITH a very good reason!

Cells with "hard-coded" font sizes will not be adapted for presentation or printout.

MINIMIZE the use of pasted external graphics.

They are not platform independent.

MINIMIZE the use of ad hoc stylistic variations,
e.g. underlined, outlined, or shadowed fonts, colored text and background

Do NOT use private style sheets for your notebooks. 
Use a shared style sheet or sheets.

What to DO when developing notebooks.

({{1., \(DO\ create\ your\ own\ custom\ style\ sheet \((s)\), 
          and\ create\ as\ many\ new\ styles\ 

          
          as\ you\ need\ to\ cover\ recurring\ stylistic\ \(\(variations\)\(.\)\)\)}, {2., \(DO\ use\ inline\ cells\ as\ often\ as\ desired\ for\ typographic\ convenience\ \(\((see\ below)\)\(.\)\)\)}, {3., \(DO\ use\ gridboxes\ to\ organize\ and\ layout\ text\ \(\((and\ graphics\ in\ version\ \(4.0!\))\)\(.\)\)\)}})

But also ask for true tabs!

"Show Expression" Form: How to clean up a notebook.

A notebook that has been "upgraded" from a pre-3.0 version, or developed without proper care, can contain a lot of "junk" under the surface. Although mostly harmless, this junk can inflate the size of the notebook or occasionally cause strange behavior.

General

Use Kernel/Delete All Output menu item.

Use Format/Remove All Options... menu item. Click on OK (NOT on Recursive).

Specific

Select All and use Format/Show Expression menu item. Search for

FontSize: remove all or unneeded options of the form FontSize->_

FontColor: remove unneeded options of the form FontColor->_

FontFamily: remove all or unneeded options of the form FontFamily->_

FontVariations: Repair instances of options such as FontVariations->{"CompatibilityType"->"Superscript"} by deleting the old superscript or subscript and creating a proper superscript or subscript using 3.0 features.

FormBox or StyleBox: delete unneeded instances of the FormBox and StyleBox constructions. (This requires some experience and/or experimentation.)

While in "Show Expression" format, scan for obvious redundancies.

Select All and use Format/Show Expression menu item again to return notebook to proper format.

Example: Before

x = cos(t)     y = sin(t)      x2 + y2 = cos2(t) + sin2(t) = 1

Example: After

({{({{x =  cos (t), y = 
                    sin (t), (x^2) + 
                      (y^2) = (cos^2) (t) + (sin^2) (t) = 
                      1}}),   }})

Preparing Notebooks for Printing

Should you maintain different notebooks for screen use and for printing?

I have still found it necessary to do this, although it is only in the very last step that I create a separate printing notebook. 
The issues that lead me to do this are:

I want to have output (esp. graphics) in the printed version but not in the on-screen version

I want to change color body text to black and white for printing.

Steps to Take

Remove .nb extension from filename (Mac only?)

Set Format/Screen Style Environment menu item to "Printout".

Scan for color text and reset to black.

Hide In/Out Names

Execute commands to create output (optional)

Resize graphics as needed.

In Printing Settings/Headers and Footers, set the starting page number and left/right printing.

Select Format/Show Page Breaks menu item

Repair poorly placed page breaks.

Scan one last time for visually obvious problems.

Proofread the result before sending it to the printer!

Resetting color text to black.

This is not always so easy. Here are three ways to do it:

Select the cell containing the color text and use the Format/Remove All Options menu item. Click on Recursive. This will often remove color text but may have undesired side effects. However it also often fails to clear text color; apparently there is some sort of bug in the "recursive" aspect.

Select the color text, and use the Format/Text Color menu item to select Black. Believe it or not this doesn't always work either. But it works most of the time and is safest.

Select the cell and use the Format/Show Expression menu item. Manually remove all FontColor options. This always works but is labor intensive.

Preparing Notebooks for Distribution

Make the following option changes at the Notebook level.

Check ScriptSizeMultipliers option.

Set to 0.86 or your preference. Default value of 0.71 does not work well for on-screen display.

Set ShortBoxForm to False. (Now default in 4.0)

Example of what could happen.

Set ShowGroupOpenCloseIcon to True.

Makes the little triangles on the left. A no-brainer -- nothing to lose.

Formulas

Inline Cells

Use Inline Cells for everything!

Example

The point on the unit circle corresponding to angle -θ has coordinates (cos(-θ), sin(-θ)) = (cos(θ),-sin(θ)).

The point on the unit circle corresponding to angle -θ has coordinates (cos (-θ),  
          sin (-θ))= (cos (θ), -sin (θ)).

More Formulas!

The Options Browser: Learn to Love It!

Setting Page Breaks

Useful Options

Use a different default style notebook.

Global Options/File Locations/DefaultStyleDefinitions->"MyStyles.nb"

Use text cells by default

Cell Options/New Cell Defaults/DefaultNewCellStyle->"Text"

Stupid Options Inspector Tricks

Turn off the startup sound!

GlobalOptions/SystemConfiguration/StartupSound->False

Remember those ugly rectangles that showed the size of a cell group? Now you can have them back again!

CellOptions/DisplayOptions/ShowClosedCellArea->True

How can I permanently turn off the In/Out labels, instead of having to turn them off in each notebook?

CellOptions/CellLabels/ShowCellLabel->False

Some Needed Improvements

Please give us True Tabs!

Automatic word wrap in gridbox elements.

Improved display of functional notation in StandardForm.

Create a FractionSizeMultiplier option instead of using ScriptSizeMultipliers for fractions.

Allow separate values of ScriptSizeMultipliers for screen display and for printing.