![]() |
TeXmacs primitives | ![]() |
In this chapter, we describe those built-in TeXmacs primitives which are intended to be used in normal documents. The additional primitives which are used for writing style files are described in a separate chapter.
This primitive is used for sequences of logical paragraphs. A simple, plain text document is made of a sequence of paragraphs. For instance,
A simple document.
Made of several paragraphs. The second paragraph
is very long, so that it is hyphenated across
several line.
is internally represented as a
<document|A
simple document.|Made of
several paragraphs. The second paragraph is very
long, so that it is hyphenated across several
line.>
From the visual point of view, different paragraphs are often
separated by some vertical whitespace. Alternatively, new
paragraphs are indicated through the use of an additional
indentation. The root of a TeXmacs document is usually a
The
This not yet implemented primitive is a variant of
This primitive is used for sequences of line items, also called “inline content”. For instance,
Some emphasized text.
is internally represented as:
<concat|Some
|<em|emphasized>| text.>
The
Multiple paragraphs.
Some emphasized text.
In this example, we need the
<document|A
simple document.|<concat|Some |<em|emphasized>| text.>>
Notice that block tags like
Although it is not possible in TeXmacs to use block content
inside horizontal concatenations, it is sometimes useful to add
some additional inline content before or after a block
environment. The
<document|<surround|↯ ||<document|<theorem|<document|Given
P∈T{F}
and
f<g∈T
with P(f)
P(g)<0, there exists an
h∈T with
P(h) = 0.>>>>>
produces
↯
In general, the
This primitive inserts an elastic vertical space after the current paragraph. All operands must be length values. The len argument specifies the default length and the min and max arguments the bounds to vertical stretching for page breaking and filling. If min and max are not specified, then they are determined implicitly from the length unit of len.
Notice that operands are not evaluated, so they must be literal strings.
This primitive is similar to
This primitive inserts an empty box whose width is len, and whose bottom and top sides are at distances bot and top from the baseline.
If bot and top are not specified, then an empty box is inserted whose bottom is on the baseline and whose height is the same as the lowercase letter x in the current font.
Notice that operands are not evaluated, so they must be literal strings.
This primitive inserts inserts a stretchable horizontal space of nominal width len, which must be a length value. The min and max arguments specify bounds to horizontal stretching for line breaking and filling. If min and max are not specified, then they are determined implicitly from the length unit of len.
Notice that operands are not evaluated, so they must be literal strings.
Springs are horizontal spaces which extend so the containing paragraph takes all the available horizontal space. When a paragraph is line wrapped, split in several visual lines, only springs in the last line are extended.
A spring has a minimal width and a weight. If the weight is 0, the spring is weak, otherwise it is strong. If a line contains mixed weak and strong springs, only the strong springs extend.
The fraction of the available horizontal space taken up by each strong spring is proportional to its weight. If there are only weak springs, they share the available space evenly.
<
<
<
Operands are not evaluated and must be literal strings.
Weak springs are useful in style-sheets. For example, tail weak springs are used to make the list environment extend to across the full paragraph, so vertical motion commands in nested lists behave as expected. In regular documents, springs are often used to place some text on the right side of the page and some other text on the left side.
A simple document is a sequence of logical paragraphs,
one for each subtree of a
This is a deprecated tag in order to split a logical paragraph into several logical paragraphs without creating explicit subtrees for all paragraphs.
We recall that logical paragraphs are important structures for the typesetting process. Many primitives and environment variables (vertical spacing, paragraph style, indentation, page breaking, etc.) operate on whole paragraphs or at the boundaries of the enclosing paragraph.
This is a tag which will become deprecated as soon as the
Currently, the
Print an invisible space with zero hyphenation penalty. The line
breaking algorithm searches for the set of hyphenation points
minimizing the total penalty, so line breaking is much more
likely to occur at a
Unlike
Set an hyphenation point with an infinite penalty. That is useful
when the hyphenation patterns for a language fall short of
preventing some forbidden patterns like “arse-nal” or
“con-genital”. An alternative way to prevent breaks is
to use the
There are two main ways to distinguish between successive paragraphs:
separate them by a small vertical space, or use an indentation for
each new paragraph. The indentation can be explicitly controlled using
the
Disable or enable indentation for the current paragraph. For instance, the code
<document|<no-indent>This
is a long paragraph which demonstrates the
disabling indentation using the <markup|no-indent>
primitive.|<yes-indent>This is a long paragraph which
demonstrates enabling indentation using the <markup|yes-indent> primitive.>
typically produces
This is a long paragraph which demonstrates
the disabling indentation using the
This is a long paragraph which demonstrates
enabling indentation using the
Disable or enable indentation for the next paragraph. For instance,
<document|A
first paragraph.<yes-indent*>|A second
paragraph.>
typically produces
A first paragraph.
A second paragraph.
Notice that
Currently, the
The physical lines in a document are broken into pages in a way similar to how paragraphs are hyphenated into lines. The page breaker performs page filling, it tries to distribute page items evenly so text runs to the bottom of every page. It also tries to avoid orphans and widows, which are single or pairs of soft lines separated from the rest of their paragraph by a page break, but these can be produced when there is no better solution.
Prevent the occurrence of an automatic page break after the
current line. Set an infinite page breaking penalty for the
current line, similarly to
Forbidden page breaking points are overridden by “new page” and “page break” primitives.
Similar to
Cause the next line to appear on a new page, without filling the current page. The page breaker will not try to position the current line at the bottom of the page.
Similar to
Force a page break after the current line. A forced page break is different from a new page, the page breaker will try to position the current line at the bottom of the page.
Use only to fine-tune the automatic page breaking. Ideally, this
should be a hint similar to
Similar to
When several “new page” and “page break”
directives apply to the same point in the document, only the first one
is effective. Any
This primitive moves the box with the specified content by delta-x to the right and delta-y upwards. It may be used for fine-grained positioning.
Resize the box for the content according to new left, bottom, right and top limits left-lim, bot-lim, right-lim and top-lim. The limits may be either be empty strings (in which case the old limit is taken), an absolute coordinate, or a limit computed as a function of the old limit.
In the last case, the limit string should be of the form <pos><op><len>. The first character <pos> indicates a position in the old box and should be either l (left), b (bottom), c (center), r (right) or t (top). The second character <op> indicates the operation which will be performed on this position and the remaining length string <len> in order to yield the new position. Possible operations are +, -, [ and ]. The brackets [ and ] stand for “minimum” and “maximum”. For instance, the code
(<resize|Hopsa|l-5mm||r+5mm||>)
widens the box for “Hopsa” by 5mm on each side:
(Hopsa)
The box with the content is displayed
as usual if the condition is satisfied
and displayed as whitespace otherwise. This primitive is used in
particular for the definition of the
This primitive can be used to decorate some content with a given pattern. For instance, when defining the macro
<assign|wipe-out|<macro|x|<repeat|x|<with|color|red|/>>>>
the code <wipe-out|obsolete> produces obsolete. The
These primitives are used to decorate a posteriori the lines of a paragraph, the lines of a page, or the pages of a document. Currently, only decorations of atoms on lines of a paragraph have been implemented.
The first argument foo is a macro which will be applied to all boxes in the line and the second argument content is the part of the paragraph to which the decoration will be applied. For instance, the construction
<\datoms|
<
macro
|
x
|
body
>
may be used in order to visualize the boxes in a given paragraph:
Here is a sufficiently long paragraph. Here is a sufficiently long paragraph. Here is a sufficiently long paragraph. Here is a sufficiently long paragraph. Here is a sufficiently long paragraph. Here is a sufficiently long paragraph.
When used in combination with the
<\assign|
toc-dots
<\macro|
<\datoms|
<macro|x|<repeat|x|<space|0.2fn>.<space|0.2fn>>>
<htab|5mm>
Notice that the
These primitives are used for producing large delimiters, like in the formula
| 1 |
| a1 |
| 1 |
| a2 |
| 1 |
| an |
Matching left and right delimiters are automatically sized so as contain the enclosed expression. Between matching left and right delimiters, the formula may contain an arbitrary number of middle delimiters, which are sized in a similar way. Contrary to TeX, the depth of a large delimiter is not necessarily equal to its height, so as to correctly render formulas like
| 1 | ||||
x +
|
The user may override the automatically determined size by specifying additional length parameters size or bottom and top. For instance,
f<left|(|-8mm|4mm>x<mid|||8mm>y<right|)|-4mm|8mm>
is rendered as
The size may also be a number n, in which case the n-th available size for the delimiter is taken. For instance,
g<left|(|0><left|(|1><left|(|2><left|(|3>z<right|)|3><right|)|2><right|)|1><right|)|0>
is rendered as
This primitive is used in order to produce big operators as in
∑
|
(1) |
The size of the operator depends on whether the formula is
rendered in “display style” or not. Formulas in
separate equations, like (?), are said to be
rendered in display style, contrary to formulas which occur in
the main text, like ∑
ai
zi. The user may use
∞
i = 0
Notice that the formula (?) is internally represented as
<big|sum><rsub|i=0><rsup|∞>a<rsub|i>*z<rsup|i><big|.>
The invisible big operator <big|.> is used to indicate the end of the scope of <big|sum>.
The
| x |
| y |
<frac|1|a<rsub|0>+<frac|1|a<rsub|1>+<frac|1|a<rsub|2>+⋱>>>
is rendered in display style as
| 1 | ||||
a0 +
|
The
| f(x) |
| y2 + z2 |
These primitives are used in order to attach a script to the preceeding box in a horizontal concatenation (in the case of right scripts) or the next one (in the case of left scripts). When there is no such box, then the script is attached to an empty box. Moreover, when both a subscript and a superscript are specified on the same side, then they are merged together. For instance, the expression
<rsub|a><rsup|b>+<lsub|1><lsup|2>x<rsub|3><rsup|4>=y<rsub|1>+<lsub|c>
is rendered as
| b |
| a |
| 4 |
| 3 |
When a right script is attached to an operator (or symbol) which accepts limits, then it is rendered below or above instead of beside the operator:
Scripts are rendered in a smaller font in non-display style. Nevertheless, in order to keep formulas readable, the size is not reduced below script-script-size.
Left and right primes are similar to left and right superscripts, except that they behave in a different way when being edited. For instance, when your cursor is behind the prime symbol in f' and you press backspace, then the prime is removed. If you are behind fn and you press backspace several times, then you first enter the superscript, next remove n and finally remove the superscript. Notice also that prime-symbols is necessarily a string of concatenated prime symbols. For instance, f'† is represented by f<rprime|'†>.
The
can be produced using
<above|<below|xor|i=1>|∞>
x<rsub|i>
These primitives can be used in order to produce wide accents above or below some mathematical content. For instance (x + y)¯ corresponds to the markup <wide|x+y|¯>.
This primitive is mainly used for producing negated symbols or expressions, such as not(↣) or not(a).
This primitive is used to produce a tree with a given root and children child-1 until child-n. The primitive should be used recursively in order to produce trees. For instance,
corresponds to the markup
<tree|+|x|y|<tree|×|2|y|z>>
In the future, we plan to provide further style parameters in order to control the rendering.
Tables are always present in documents inside evaluable tags which
take a
Every tabular structure in a document contains a
<
<
The formatting of the table as a whole is specified by a number of table variables, which are used internally and do not appear in the environment like regular typesetter variables.
The
The formatting of cells is specified by a number of cell
variables, which are used internally and do not appear in
the environment like regular typesetter variables. Rows,
columns, and generally any rectangular range of cells can
associated to a cell variable setting by a single
The
Range coordinates must be non-zero literal integers, positive values are counted left to right and top to bottom, negative values are counted right to left and bottom to top. For example, 2 means the second row or column and -1 means the last row or column.
Typical values for (top-row,bot-row,left-col,right-col) are
(r,r,1, - 1) for “row
r”, (1, - 1,c,c) for
“column c”, and
(r,r,c,c) for
“the cell at row r, column c”.
When new cells are inserted, it makes a difference whether the
rows are counted from the top or bottom, and the columns are
counted from the left or right. If m is the number of
rows and n the number of columns, then r
and r - m - 1 represent the same row
The only purpose of the