Publish/Styles

From J Wiki
Jump to navigation Jump to search
Publish | Overview | Markup Summary Markup Detail | Styles | Images Tables | Examples


Overview

Styles are used to customize the output. Styles can be set for the document as a whole, and also for specific tags.

Most styles are defined by J nouns. To distinguish them from other names in the report writer, all such nouns are uppercase. For example, FONTP is the normal paragraph font. A few styles are set by style tags, such as to set bold font. If a style is not given, a default value is used.

Document Styles

In a document, some styles can be given by applying a tag, such as <b>....</b> In this case, the styles defined for the tag are applied to the text within the tag.

Alternatively, styles may be given in tag parameters. Note that some tags take no parameters.

A style setting in a tag parameter is always made with a keyword, value pair, given as keyword=value. Keywords are lowercase, and have no blanks in the name. Values may have blanks, and if so, must be surrounded by double quotes. Some examples:

fontp="sans 10 bold"      set normal paragraph font
alignv=top                set vertical alignment
margin="10 20 10 15"      set margins

For example, the following displays a jpeg image centered in the page.

<image align=center>toucan.jpg</image>

The following is invalid, since in a PDF file, the Author property has no style:

<author align=center>Peter Simple</author>

Style Files

A style setting in a *.sty file is a normal J assignment, to corresponding uppercase names. A *.sty file is actually a normal J script. For example:

FONTP=: 'sans 10 bold'
ALIGNV=: 'top'
MARGIN=: 10 20 10 15

User-defined Styles

Style files can also include user-defined styles. A user-defined style is a text noun with style settings, for example:

BIGPARA=: 0 : 0
FONTP=: 'times 12 italic'
ALIGN=: 'just'
)

This can be selected with the style keyword as in:

<para style=bigpara>Some text follows.... </para>

Standard Styles

Alignment

align,alignv

Sets horizontal and vertical alignment.

tocalign

This applies only to the page numbers in Table of Contents, and may be left (default) or right.

Color

tcolor

Sets foreground and background color for tables, see section on tables.

Fonts

Font styles are set by defining values for specific report items.

fontp

Normal paragraph font

fontth, fonttc

table header and cell fonts

fonth0,fonth1,...,fonth6

Fonts for headers h0, h1, ... h6

fontc1,fontc2,...,fontc6

Fonts for corresponding table of contents entries.

Images

scale

This is a multiplier to scale an image horizontally and vertically, default 1.

Layout

margin

Sets the top,right,bottom,left margins of the tag. Either 4 numbers should be given, or a single number that applies to all.

pagesize

Sets the page size, in points. The following names can also be used:

PSletter US letter size
PSa4 A4 size
leading, paraspace

Leading is the distance between two lines of text, expressed as a decimal of the font size, default 1.2. Paraspace is the space between paragraphs, expressed as a decimal of the normal paragraph font, default 0.6

hyphen

This is the character used to suggest hypenation, default ~ (tilde).

Bookmark and Table of Contents

bmlevel, toclevel

The bmlevel style is the number of header levels to bookmark in the PDF document, default 3.

The toclevel style is the number of header levels to generate Table of Contents, default 3.