Next: Chapter 4  Drawings Up: Part I  User's Guide Previous: Chapter 2  Editing Basics


Chapter 3
Equation Editor

The RichDoc framework contains an embedded equation editor, which can be used to insert equations and other mathematical structures into the document. You may insert either an inline equation using the [inline] toolbar button, which does not interrupt the flow of words in a paragraph, such as eiπ + 1 = 0, or a displayed equation using the [inline] toolbar button, that is placed on its own line, separated from its neighborhood by a vertical space, such as

=

For more information about displayed equations, see Section 3.7.

3.1 Mathematic Text

The most simple material that can be inserted into an equation is text. Text may denote variables, constants, numbers, functions etc. The text is classified into several semantic categories, described in Table 3.1. Each category gets some default typographic style, which can be overridden if necessary. See Chapter 5 for managing visual styles of elements.

Table 3.1 Categories of Mathematical Text

Category Description Default Style Example
mtext generic text normal text
var variable italic x
const constant normal e
num number normal 10
dim dimension normal kg
vec vector bold a
mat matrix bold A
dom domain (e.g. real numbers) blackboard Z
mathSf sans-serif sans-serif A

If you need to use category that is not listed in the table, you may use the generic category “Generic Text”. Then you may assign it a class using the generic class mechanism, see Chapter 5.

Note that when you start typing text, the class is selected automatically. If you type a letter, the class is set to variable, if you type a digit, the class is set to number. Other classes must be set manually.

It is also possible to insert regular paragraph text into the equation, using [inline] toolbar button. You may apply all properties applicable to normal paragraphs, such as formatting, adding inline graphics, or even inline math. You cannot, however, insert line breaks into the paragraph.

3.2 Operators and Symbols

The equation editor can insert a variety of operators and symbols. The [inline] and [inline] button groups may be used to insert lowercase and uppercase Greek letters, respectively. Note that Greek letters are in fact normal mathematic text. The lowercase Greek letters get the variable class by default, while the uppercase letters get the dimension class by default. The [inline] and [inline] button groups may be used to insert mathematical operators and symbols, respectively.

TeX/LaTeX users, that are familiar with macro names for symbols and operators, may insert these by typing the macro names. For example, after typing ‘\equiv’ on the keyboard, the symbol [inline math] is inserted at the cursor position. The Table 3.2, Table 3.3, Table 3.4 and Table 3.5 summarize the Greek letters, operators and symbols supported by the Equation Editor.

The Table 3.5 shows only special operators that do not have a corresponding key on a regular English keyboard. Operators that do have such key, such as ‘ < ’, ‘ = ’, ‘+’, etc., as well as punctuation symbols like ‘,’, ‘;’, ‘!’ etc., can be inserted just by typing their corresponding key.

Table 3.2 Lowercase Greek Letters

Operator Shortcut Operator Shortcut
α \alpha β \beta
γ \gama δ \delta
ε \epsilon ζ \zeta
η \eta θ \theta
ι \iota κ \kappa
λ \lambda μ \mu
ν \nu ξ \xi
π \pi ρ \rho
ς \varsigma σ \sigma
τ \tau υ \upsilon
φ \varphi χ \chi
ψ \psi ω \omega

Table 3.3 Uppercase Greek Letters

Operator Shortcut Operator Shortcut
Γ \Gama Δ \Delta
Θ \Theta Λ \Lambda
Ξ \Xi Π \Pi
Σ \Sigma Φ \Phi
Χ \Chi Ψ \Psi
Ω \Omega    

Table 3.4 Symbols

Operator Shortcut Operator Shortcut
[inline math] \infty [inline math] \partial
[inline math] \vartheta [inline math] \varrho
[inline math] \phi [inline math] \Re
[inline math] \Im [inline math] \prime
[inline math] \blacksquare [inline math] \Box
[inline math] \nabla [inline math] \backslash
[inline math] \ell [inline math] \surd
[inline math] \schwellL [inline math] \copyright
[inline math] \crlf    

Table 3.5 Operators

Operator Shortcut Operator Shortcut
[inline math] \ge [inline math] \le
[inline math] \gg [inline math] \ll
[inline math] \geqslant [inline math] \leqslant
[inline math] \ne [inline math] \times
[inline math] \pm [inline math] \mp
[inline math] \cup [inline math] \cap
[inline math] \vee [inline math] \wedge
[inline math] \forall [inline math] \exists
[inline math] \in [inline math] \approx
[inline math] \simeq [inline math] \sim
[inline math] \cdot [inline math] \equiv
[inline math] \propto [inline math] \perp
[inline math] \odot [inline math] \oplus
[inline math] \leftarrow [inline math] \gets
[inline math] \rightarrow [inline math] \leftrightarrow
[inline math] \to [inline math] \Leftarrow
[inline math] \Rightarrow [inline math] \Leftrightarrow
[inline math] \dots [inline math] \vdots
[inline math] \ddots [inline math] \rddots
[inline math] \cdots [inline math] \circ
[inline math] \bullet [inline math] \star
[inline math] \leadsto    

3.3 Structures

Mathematical formulas may contain, besides simple structures like variables, operators and symbols, more complex structures like fractions, radicals, integrals etc. These can be inserted using the mathematical toolbar, or by typing their LaTeX equivalent. When a structure is inserted, a number of empty boxes appear, which serve as placeholders for material to be inserted into the structure. You may use arrow keys or mouse to navigate between the components of the structure. It is, of course, possible to nest structures into each other. The Table 3.6 summarizes the variety of mathematical structures supported by the Equation Editor.

Table 3.6 Mathematical Structures

  Shortcut Description Example
[inline] _ or ^ script x1 , 2n
[inline] \frac fraction [inline math]
[inline] \sqrt radical [inline math]
[inline] \sum sum [inline math]
[inline] \prod product [inline math]
[inline] \int integral [inline math]
[inline] \oint circular integral [inline math]
[inline] \iint double integral [inline math]
[inline] \iiint triple integral [inline math]
[inline] \iiiint quadruple integral [inline math]
[inline] \idotsint integral group [inline math]

Some structures are rendered in a different way depending on whether they are displayed or not. In the displayed state, they are bigger and take more vertical space. Compare [inline math] and [inline math], or [inline math] and [inline math]. The displayed state is enabled when the structure is in an displayed rather than inline equation. Nesting structures also disables the displayed state, i.e. structures nested in other structures are no longer displayed. If you need to set the displayed state manually, check the Displayed box in the Structure toolbar. The unchecked state ([inline]) indicates that the displayed state is always disabled, the checked state ([inline]) indicates that the state displayed is always enabled, and the intermediate state ([inline]) indicates that the displayed state is inherited from the outer context.

The Limits state determines whether indexes of structures, which denote its limits, are above and below the structure symbol like [inline math], or right to the structure symbol, like [inline math].

3.4 Fences

We call fences mathematical structures like parentheses, brackets, curly brackets etc. Types of fences are summarized in Table 3.7. You can insert the empty fence box either by a toolbar button under the fence button group [inline], or by typing its shortcut. By default, the fence box is automatically completed so that the left symbol matches the right symbol.

Table 3.7 Fences

  Shortcut Description Example
[inline] ( Round Brackets (x)
[inline] [ Square Brackets [x]
[inline] { Curly Brackets {x}
[inline] | Pipes |x|
[inline] \langle Angle Brackets [inline math]
[inline] \lfloor Floor Brackets [inline math]
[inline] \lceil Ceil Brackets [inline math]

If you place the text cursor inside the fence, the Fence toolbar shows up in the toolbar window. Here you can set the type of each fence side separately. This allows you to create asymmetric fences, such as [inline math].

By default, the fence scales automatically with the size of its content. You may, however, set the fence size manually, by selecting a Size value in the Fence toolbar. This allows you to create equations like this: ((x + 1)(x + 2))^2. Normally, the outer fence would have the same size as the inner fences.

3.5 Arrays

Arrays are one or two-dimensional structures similar to tables. The process of creating arrays is thus similar to the process of creating tables, described in Section 2.7. You may use arrays to create matrices and vectors, or just to visually structure mathematical material. For instance, you may easily create equations like this:

()() = ()

To insert a new array containing single empty cell to the cursor position, either use the [inline] toolbar button, or type \array from the keyboard. If you want to create an array with more cells, drag the toolbar button with mouse as if creating a table. To change the structure of an array, use the toolbar buttons as described in Section 2.7. The borders of arrays are also specified in the same way as borders of tables.

Note that it is not possible to specify the vertical alignment of array cells. The alignment is always according to the mathematical typographic style, i.e. the cells in the same row are aligned to the mathematical axis, running mostly through the vertical center of the cells. It is, however, possible to specify the horizontal alignment of the cells.

3.6 Spacing

The equation editor tries to insert appropriate spacing between elements of equations, according to typographical conventions for typesetting mathematic material. However, you may sometimes want to insert explicit horizontal spacing between elements, either positive, i.e. to extend the existing space, or negative, to reduce the existing space. To insert a space to the cursor position, use a toolbar from the [inline] button group, or type the corresponding shortcut. To insert several spaces at once, click the toolbar button, and drag to the right. Types of spaces are summarized in Table 3.8. The space width value is relative to the font height. That is, the largest space, \quad, is as wide as a character cell height.

Table 3.8 Horizontal Spaces

Width Button Shortcut Example Width Button Shortcut Example
1/16 [inline] \, or \thinspace [inline math] 1/16 [inline] \negthinspace [inline math]
1/8 [inline] \: or \medspace [inline math] 1/8 [inline] \! or \negmedspace [inline math]
1/4 [inline] \; or \thickspace [inline math] 1/4 [inline] \negthickspace [inline math]
1 [inline] \quad [inline math]        

3.7 Displayed Equations

This section describes options that can be used only with displayed equations.

A displayed equation may be numbered. To toggle a numbered/unnumbered state of a displayed equation, right-click the equation with mouse, and select Has number from the popup menu. You may also insert equation that is numbered by default, using the [inline] toolbar button.

Displayed equation may be split into several rows. Equation rows are inserted and removed much the same way as the table rows, i.e. using the toolbar buttons [inline] (add row), [inline] (insert row) and [inline] (delete row), but from the Displayed Equation toolbar. If the equation is numbered, you may decide whether the whole equation has a number, or whether each of its rows gets its own number, using the Number per Row command from the popup menu.

The equation rows may be split into separately aligned groups using tabs. You may insert either right-aligning tab or left-aligning tab using the toolbar buttons [inline] and [inline], respectively. A right-aligning tab aligns the group before it to the right, while the left-aligning tab aligns to the left. You must put a tab into each row to take effect – the group of corresponding tabs get aligned on the same horizontal position. A row may contain several tabs, but all the rows should contain the same number of tabs. For example, the following equations use right-aligning tabs before the equality signs:

x + 1 = 10
x - y + 2 = 2
y = 6

Note that you may use arrays (see Section 3.5) to achieve a similar effect. However, aligned rows are more appropriate for specifying independent equations, that are only mutually aligned. With arrays, it is also not possible to assign numbers to rows.

Besides rows corresponding to equations, you may also insert rows containing paragraphs, using buttons [inline] and [inline], for adding and inserting paragraph rows, respectively. This is useful if you need to insert paragraph material in the middle of a displayed equation without interrupting it, to preserve numbering or alignment of the equation rows. For instance, you may create displayed equations like this:

A1 = N0(λ ; Ω) - null(λ ; Ω'),
A2 = null(λ ; Ω') - null(λ ; Ω),
and
Anull = null(λ ; ω).

Note that the equations are properly aligned, which wouldn't be possible without putting the interrupting paragraph inside the displayed equation.

3.8 Editing Equations

The Equation Editor supports moving and copying objects, as described in Section 2.2. Both methods are supported, that is, you can move or copy objects either using the clipboard, or using the Local Document Structure tree. You must, however, switch the Local Document Structure to the finest resolution, using the [inline] button. The pane is also useful for displaying the structure of complex equations in a hierarchical way. For instance, the equation below is displayed as shown in Figure 3.1.

=
[picture]
[end of picture]

Figure 3.1 Hierarchical View of a Portion of an Equation

Sometimes the equation editor displays more empty boxes that you might think is necessary. For instance, in the example in Figure 3.2, there are two empty boxes at the very left part of the formula. Although it is not obvious, there is a difference: the first box is outside the script box, whereas the second is inside the script box. The Equation Editor distinguishes these two positions, although the distinction has no effect on the final appearance of the formula. In this particular example, you should put material in the former box, i.e. outside the script box, because the reader of the formula would understand the material this way. That is, you should always use fences to give visual guidance to the priority of operations, even if the Equation Editor allows you to explicitly specify the priorities without giving that visual guidance.

[picture]
[end of picture]

Figure 3.2 Empty Boxes of Complex Formula


Next: Chapter 4  Drawings Up: Part I  User's Guide Previous: Chapter 2  Editing Basics