GNU TeXmacsUser manualReferenceAboutEnglish·Deutsch·中文
Arithmetic operations

<plus|expr-1|\(\cdots\)|expr-n>

<minus|expr-1|\(\cdots\)|expr-n>
(addition and subtraction)

Add or subtract numbers or lengths. For instance, <plus|1|2.3|5> yields 8.3 and <plus|1cm|5mm> produces . In the case of subtractions, the last argument is subtracted from the sum of the preceding arguments. For instance, <minus|1> produces -1 and <minus|1|2|3|4> yields 2.

<times|expr-1|\(\cdots\)|expr-n>
(multiplication)

Multiply the numbers expr-1 until expr-n. One of the arguments is also allowed to be a length, in which case a length is returned. Percentages such as 50% are also accepted as factors. For instance, <times|3|3> evaluates to 9 and <times|3|2cm> to .

<over|expr-1|\(\cdots\)|expr-n>
(division)

Divide the product of all but the last argument by the last argument. For instance, <over|1|2|3|4|5|6|7> evaluates to 102.857, <over|3spc|7> to , and <over|1cm|1pt> to 28.4528.

<div|expr-1|expr-2>

<mod|expr-1|expr-2>
(division with remainder)

Compute the result of the division of an integer expr-1 by an integer expr-2, or its remainder. For instance, <div|18|7>=2 and <mod|18|7>=4. The arguments may also be real numbers (in which case the quotient is rounded downwards) or two lengths (in which case div returns the number of times expr-2 fits into expr-1, and mod the remaining length).

<minimum|expr-1|\(\cdots\)|expr-n>

<maximum|expr-1|\(\cdots\)|expr-n>
(minimum and maximum)

Return the minimum or maximum of several numbers or several lengths. For instance, <maximum|1cm|5mm|2cm> yields .

<math-sqrt|expr>

<exp|expr>

<log|expr>

<pow|expr-1|expr-2>

<cos|expr>

<sin|expr>

<tan|expr>
(elementary functions)

Compute the square root, the exponential, the natural logarithm, the power \({\color{brown}{\text{{\itshape{expr-1}}}}}^{{\color{brown}{\text{{\itshape{expr-2}}}}}}\), the cosine, the sine and the tangent (with angles in radians) of real numbers. For instance, <pow|2|10> yields 1024. Notice that math-sqrt should not be confused with the sqrt primitive for typesetting roots.

<equal|expr-1|expr-2>

<unequal|expr-1|expr-2>

<less|expr-1|expr-2>

<lesseq|expr-1|expr-2>

<greater|expr-1|expr-2>

<greatereq|expr-1|expr-2>
(comparing numbers or lengths)

Return the result of the comparison between two numbers or lengths. For instance, <less|123|45> yields false and <less|123mm|45cm> yields true. The equal and unequal primitives actually accept arbitrary expressions, which are compared as trees (except for two lengths, which are compared by value).

<blend|color-1|color-2>

<rgb-color|red|green|blue>

<rgb-color|red|green|blue|alpha>

<rgb-access|color|component>
(operations on colors)

The blend primitive returns the color obtained by painting the (possibly transparent) color color-1 on top of color-2. The rgb-color primitive builds a color from its red, green, blue and optional alpha components, which are integers between 0 and 255. Conversely, rgb-access returns a component of a color, where component is one of r, g, b, a (or 0 until 3). Colors are returned in hexadecimal notation, such as #ff8000.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".