|  |  | 6 Style sheets

# 6 Style sheets

The symbolic attributes appearing in an Ipe document are translated to absolute values for rending by a style sheet that is attached to the document. Documents can have multiple "cascaded" style sheets, the sheets form a stack, and symbols are looked up from top to bottom. At the bottom of any style sheet cascade is always the standard style sheet, which is built into Ipe. When you create a new empty document, it automatically gets a copy of this standard style sheet.

Style sheets can also contain templates, such as background patterns, or logos to be displayed on each page. These are named Ipe objects that can be reused in documents.

There is not yet a decent user interface for style sheets, as we are still experimenting with the system. For example, it's not yet possible to define or use templates (except by editing your XML file).

What you can do is to look at the standard style sheet: create a new document and save its style sheet using Save style sheet from the Edit menu. You can use this as a basis for making your own style sheets, which you can then add to your documents using Add style sheet. The new symbolic attributes appear in the user interface, and will be applied when rendering or saving to PDF/Postscript.

There is not yet a way to remove or replace the stylesheet used (but you can save to XML and delete it by hand).

Here is the style sheet presentation.xml that I use for my presentations. It enlarges all standard sizes by a factor 3:

    <ipestyle name="presentation">
    <linewidth name="normal" value="1.2"/>
    <linewidth name="heavier" value="2.4"/>
    <linewidth name="fat" value="3.6"/>
    <linewidth name="ultrafat" value="6"/>
    <marksize name="normal" value="9"/>
    <marksize name="large" value="15"/>
    <marksize name="small" value="6"/>
    <marksize name="tiny" value="3.3"/>
    <arrowsize name="normal" value="21"/>
    <arrowsize name="large" value="30"/>
    <arrowsize name="small" value="15"/>
    <arrowsize name="tiny" value="9"/>
    <textmatrix name="normal" value="3 0 0 3 0 0"/>
    <textmatrix name="large" value="3 0 0 3 0 0"/>
    <textmatrix name="Large" value="3 0 0 3 0 0"/>
    <textmatrix name="LARGE" value="3 0 0 3 0 0"/>
    <textmatrix name="huge" value="3 0 0 3 0 0"/>
    <textmatrix name="Huge" value="3 0 0 3 0 0"/>
    <textmatrix name="small" value="3 0 0 3 0 0"/>
    <textmatrix name="footnote" value="3 0 0 3 0 0"/>
    <textmatrix name="tiny" value="3 0 0 3 0 0"/>
    </ipestyle>

Note the use of the `<textmatrix>` element to magnify text. The text size you choose from the Ipe user interface ("large", for instance) is in fact used for two symbolic attributes, namely `textsize` (where large maps to `\large`) and `textmatrix` (where it maps to the identity matrix in the standard style sheet). By setting the text matrix, you can magnify fonts (independently for height and width). One other use of the text matrix is to typeset vertical text (as in Japanese and Chinese): using the tools from the CJK package, define a font with glyphs rotated by 90 degrees, and set the text matrix to rotate the whole text object back. There may be other tricks one can play with the text matrix, such as to generate a slanted version of fonts (this would work for one-line text labels only).

As an example for defining a style sheet with new colors, here is a style sheet that defines all the colors of the X11 color database.

|  |  | 6 Style sheets