Andre Kuzniarek
Pubs Production and Electronic Documents Manager

http://www.wolfram.com/~andre/Demos.html

Style Sheet Arcana

Concepts

Please note the new, detailed documentation for style sheets in the online help for Version 3.0.1 See Help:OtherInfo:Style Sheets

Best way to edit style sheets

Importing the style sheet allows you to see your changes to cells that use the styles being edited. If you do not import the style sheet, you have to reapply the shared style sheet to see style edits on actual cells in your template or test document.

Once you're happy with the edited styles, do Save As to save the styles out as a new, unique style sheet, or select all the cells, copy, and paste into a new notebook, which can be saved as the new stylesheet.

Style sheets are notebooks, like any other notebooks, except that all the active styles are cells with the StyleData option, with the style name and environament names as arguments.
StyleMenuListing is the boolean option that determines whether or not a style will appear int he the style menu. All styles listed int he menu are listed in the order they appear in the style sheet. Unlisted styles can be selected with the Other style menu: Alt|[0]. You must know the name in order to enter it.

Inheritance

Be aware of the concept of inheritance, where styles applied at different levels within a document defer to the other levels. This accounts for a lot of inscrutable behavior. Please refer to the online docs for a discussion of this concept. Note that:

There are some inheritance issues within the style sheet worth noting:

Options of Note

Cell Styles

Inline and Hyperlink Styles

Format Types Styles

These styles are defined in the Default stylesheet and usually nowhere else. That means an given stylesheet will have no listing for these. If you want to change them, you have to copy them out of the Default styles into your new stylesheet.

Placeholder and Palette Styles

Just some arcane stuff for the typesetting and button mechanisms, defined in the Default stylesheet and usually not redefined anywhere else. Best to leave these as they are.

Some Interesting Examples

Invisible Cell

It's possible to make cells dissappear, but it's dangerous, because you can't get at them easily once you do it. Handy for hiding things in print. Samples.

\(CellElementSpacings -> {"ClosedCellHeight" -> 0}, 

    CellOpen -> False\)

Cell Grouping Trickery

Hidden input with button access (Calc Wiz). Sample.

Autonumbering Demo

Autonumbering and references examples. Samples.

Self-indexing Runningheads

Pseudo self-indexing runningheads. Sample.

Authoring Tools: Definition Boxes

Here are samples of what can be done using the Definitions palette. See DefPaletteGuide.nb for a thorough discussion. To try these examples, select all the cells and apply buttons from the definitions palette.

Requires Formatting.m.  
Place it in /AddOns/ExtraPackages/Utilities.

Open Defintions Palette., open Table Palette.

Example : Simple

LeapYearQ[year]

return True if year is a leap year and False otherwise

DateQ[date]

return True if date represents a valid date and False otherwise

Calendar test functions.

Example : Spanning

InterpolationDiscountFactors[object,  timeintervals]

return the interpolated discount factors equivalent to the interest rates objects for the given list of time intervals

LeapYearQ[year]

return True if year is a leap year and False otherwise

DateQ[date]

return True if date represents a valid date and False otherwise

Calendar test functions.

Example : Extra Formatting in Text and Inert Cells

MeanVector[vectors]

give the mean vector of a list of vectors

CovarianceMatrix[vectors]

give the covariance matrix of a list of vectors

PortfolioMean[weights, means]

compute the portfolio mean given the weights and the list of mean returns

EfficientFrontier[meands, covariance, x]

You have to change the "x" below to italics by hand

return the parametric form of the Markowitz efficient frontier given the vector of mean returns and matrix of covariances of assets' returns using x as the parameter

Example : Improve Linebreaking (first row)

{(Subscript[f, 1]), (Subscript[f, 2]),  ... }

data points obtained when a single coordinate takes on values 1, 2, ...

{{(Subscript[x, 1]), (Subscript[y, 1]),  ... , (Subscript[f, 1])}, {(Subscript[x, 2]), (Subscript[y, 2]),  ... , (Subscript[f, 2])},  ... }

data points obtained with values (Subscript[x, i]), (Subscript[y, i]),  ... , of a sequence

{{(Subscript[x, 1]), (Subscript[y, 1]),  ... , (Subscript[f, 1])}, {(Subscript[x, 2]), (Subscript[y, 2]),  ... , (Subscript[f, 2])},  ... }

data points obtained with values (Subscript[x, i]), (Subscript[y, i]),  ... , of a sequence

Example : 3 Column Option Box, and Stretch

ImageSize

Automatic

absolute image size in printer's points

ImageRotated

False

whether to rotate the image (landscape mode)

ImageResolution

Automatic

resolution in dpi for the image

Example : Head style, Line, and Stretch

Get InlineStyles palette.

Option

Typical Default Value

PageWidth

WindowWidth

how wide to assume the page to be

TextAlignment

Left

how to align successive lines of text

TextJustification

0

how much to allow lines of text to be stretched to make them fit

ParagraphIndent

0

how many printer's points to indent the first line in each paragraph

Example : Book Example, with custom word style

In order to get "etc" in the right font in the left column evaluate the following cell:

DefineWordStyle["etc", "TR"]

Select the cells below here and hit the ToDefinitionBox button

Circle[{x, y}, r]

a circle with radius r centered at the point {x, y}

Circle[{x, y}, {(Subscript[r, x]), (Subscript[r, y])}]

an ellipse with semi-axes (Subscript[r, x]) and (Subscript[r, y])

Circle[{x, y}, r, {(Subscript[theta, 1]), (Subscript[theta, 2])}]

a circular arc

Circle[{x, y}, {(Subscript[r, x]), (Subscript[r, y])}, {(Subscript[theta, 1]), (Subscript[theta, 2])}]

an elliptical arc

Disk[{x,  y},  r],  etc .

filled disks

Stretch or condense as appropriate

Example : Book Example, with ContractSpanBoxes

With[{x = (Subscript[y, 0]), y = (Subscript[y, 0]),  ... }, body]

define local constants x, y, ...

Which can be tweaked with ContractSpanBoxes:

Example : Book Example, with ExpandToSpanBoxes

NotebookLocate["tag"]

go to the next cell with the specified tag in the current notebook

NotebookLocate[{"file", "tag"}]

open another notebook if necessary

Which can be tweaked with ExpandToSpanBoxes:

FormatAsFunction

This button formats functions and arguments in the style of the Mathematica book. Highlight the text of the following examples and apply the button:

MyFunction[(Subscript[x, 1]), (Subscript[x, 2]), …]

MyFunction[first,  second,  f[arg]]

Or, highlight the same examples within this paragraph and apply: MyFunction[x, y] and the other one is MyFunction[first, second, f[arg]]

Numbered and Bulleted Lists

Bulleted

One potato

Two potato

Three potato, adding vegetable stock and seasonings, celery, onion, bits of animal flesh (from the wallowing kind), and parsley makes soup

Four.

Numbered

One potato

Two potato

Three potato, adding vegetable stock and seasonings, celery, onion, bits of animal flesh (from the wallowing kind), and parsley makes soup

Four.

Extra Copies

One potato

Two potato

Three potato, adding vegetable stock and seasonings, celery, onion, bits of animal flesh (from the wallowing kind), and parsley makes soup

Four.

One potato

Two potato

Three potato, adding vegetable stock and seasonings, celery, onion, bits of animal flesh (from the wallowing kind), and parsley makes soup

Four.

One potato

Two potato

Three potato, adding vegetable stock and seasonings, celery, onion, bits of animal flesh (from the wallowing kind), and parsley makes soup

Four.

Authoring Tools: Styles Palettes

Palettes: CellStyles, InlineTextStyles, ItemMaker

Authoring Tools: Indexing

An indexing tool is being developed, which will make it easy to enter indexing tags as well as generate the resulting index. It's a work in progress and should be accessed from my web site listed at the top of this document.

Help Browser Files

Look at a quick little sample

Sample help file. This is a notebook we'll place in the help browser.
Sample BrowserCategories. This is the description of the items within the notebook, as they should appear in the help browser. This file is required to be at the same level within a directory as the notebooks going into the help. Each "BrowserCategory" refers to a column of the browser. Each "Item" is the actual entry in the final column. The options for Item are: Item, Notebook, IndexTag (Item is default argument), CopyTag.

You can add your own index entries for your document to the Master Index, using a BrowserIndex.nb which must also be at the same level within a directory as the notebooks it references. See the notes within this example for how to apply the appropriate style sheet and cell settings.

Where and how

See the directory called TESTDOC for a demonstration of the layout requirements for online documentation. You must follow the same tree of directories as in this example for your docs to load properly. Place it within AddOns/Autoload or AddOns/Applications, then select Rebuild Help Index in the Help menu to see the results. Go to AddOns:Sample or MasterIndex:Last Thing.

Authoring Tool: Browser Categories

An browser categories generating tool is being developed, which will make it easy to produce brow cats automatically from any heirarchical notebook or collection of notebooks. It's a work in progress and should be accessed from my web site listed at the top of this document.