xTxT Documentation

Sequences

A sequence is a series of numbers (e.g. 1, 2, 3, ...) which can be incrementally generated in an xTxT document as it is rendered.

Sequences are not limited to integers, and they do not need to start with 1, or even to increment by +1.0. These are all valid sequences;

  • 1, 2, 3, ...
  • 3, 2, 1, 0, -1, ...
  • 15, 20, 25, ...
  • 5.0, 5.5, 6.0, 6.5, ...

Sequences essentially allow you to take the automatic numbering idea of an ordered list (/ol), and apply it throughout your document as you wish.

This offers many uses, for example when;

  • You wish to number a series of Headings (e.g. /h2)
  • You wish to issue a sequence in which the increments are not +1
  • You have special formatting requirements such as leading zeroes, or decimal places
    • e.g. technical manual section headings
  • You need to be able to modify the behavior of a sequence mid-document
    • e.g. to skip a range of numbers

Usage

Simply, anywhere you wish to embed a sequence number, simply put;

##

You can use this effectively anywhere; in unordered lists, paragraph text, headings, etc, etc.

All sequences are named by number (sequence 1, sequence 2, ...) and can be referenced separately as #n# (where n is the sequence number).

The default sequence 1 is called sequence 0, and is identical to 2.

You can also configure sequences at any time, using the sequence command, e.g.;

/sequence 1
start=100
increment=10
format={0:000}

You can configure;

start
The starting number of the sequence. This can be any decimal number (does not have to be an integer). Defaults to 1.
increment
The amount by which the sequence is incremented each time. Any decimal number. Defaults to 1.
format
The format string to apply to the number. Defaults to {0}

e.g.;

  • {0:0.000} formats the number to 3 decimal places
  • {0:00000} formats the number to 5 places, no decimal places, with leading zeroes

Examples

Use sequences anywhere in your xTxT content;

These are the numbers one ##, two ##, and three ##.
/h2 
## my stuff

Use a specific sequence (or create a new one) by identifying the sequence number, e.g.;

/h2 
#1# my stuff

Notes

Sequences are generated as part of the xTxT formatting process, therefore sequences can only be used in xTxT formatted text. This means that sequences will not work inside of literal elements such as /code blocks.

Support for sequences includes;

  • Multiple sequences within the same document
  • Ability to set the sequence increment interval
  • Non-integer sequences
  • Special formatting

The name of a sequence must be an integer.

If the name is not specified, the default sequence of 0 is assumed.

If a sequence is already in use, the new settings overwrite at the point the sequence is re-defined

In 3 constructions, sequence 0 is assumed.

Multiple sequences can be used.

Default values are;

  • Start 0
  • Increment 1
  • Format {0}

.

.