Mathematical Expressions (Equations) in TRichView Documents [VCL]

<< Click to display table of contents >>

Mathematical Expressions (Equations) in TRichView Documents [VCL]

Items of this type display mathematical expressions.

Class for this item type is TRVMathItemInfo  (see for detailed information).

Style of this item type: rvsMathEquation (-210)

This item requires RAD Studio XE4 or newer. This item type is not available in Lazarus and FireMonkey versions.

License

This item uses Adit Math Engine by Adit Software: aditmath.com

There are two version of Adit Math Engine: free version and commercial version.

Free version

Units of the free version of Adit Math Engine are included in TRichView installation (in Math folder). They are covered by MPL 2.0 with the following addition restrictions:

Adit Math Engine cannot be used in any E-learning/Assessment/Testing/Math software (Freeware or Shareware) or outside TRichView engine without our [Adit Software] written permission.

You can contact Adit Software if you want to use Adit Math Engine under a different license or to request an exception from the restrictions above.

The free version cannot load equations from DocX and HTML, and saves them as images.

Commercial version

To use the commercial version, include RVAdvMathWrapper.pas in your project (for example, add in in "uses" of the main form unit).

Advantages: the commercial version allows saving and loading equations in HTML and DocX files.

Methods of TCustomRichView

The following viewer-style method adds item of this type to the end of the document:

AddItem (create TRVMathItemInfo object, add it using AddItem)

The following method returns TRVMathItemInfo object

GetItem

Methods of TCustomRichViewEdit

The following editor-style method inserts item of this type at the position of caret:

InsertItem (create TRVMathItemInfo object, insert it using InsertItem)

The following method returns TRVMathItemInfo object at the position of caret:

GetCurrentItem.

The following methods change properties of items as editing operations:

SetCurrentItemExtraIntPropertyEx;

SetItemExtraIntPropertyExEd;

SetCurrentItemExtraStrPropertyEx;

SetItemExtraStrPropertyExEd.

Properties

Main properties:

Text – mathematical expression in LaTeX-like format,

DisplayInline – switches between the inline mode and the display mode.

These properties are also accessible as rveipcDisplayInline and rvespcText properties. Accessing them in this way allows changing them in editing operations.

Layout and appearance

This item type has the following integer properties related to layout and appearance:

rvepSpacing – padding (spacing between the expression image and its border);

rvepBorderWidth, rvepBorderColor – width and color of a border;

rvepOuterHSpacing, rvepOuterVSpacing – horizontal and vertical spacing around the border

rvepColor – background color.

Additionally, it has the properties:

FontSizeDouble – font size in half-points,

FontName – font name (only mathematical fonts can be used),

TextColor – text color.

These properties are also accessible as rveipcTextColor, rveipcFontSizeDouble and rvespcFontName properties. Accessing them in this way allows changing them in editing operations. If values of these properties are default, the item uses global settings specified in TRVMathDocObject object.

Saving and Loading

HTML

Free version of AME: equations are saved as images (PNG, if possible). Equations cannot be loaded.

Commercial version of AME: equations are saved as MathML objects (can be turned off by RVMathEquationManager.SaveMathMLInHTML property). Equations can be loaded from HTML.

DocX

Free version of AME: equations are saved as images. Equations cannot be loaded.

Commercial version of AME: equations are saved as OMML objects (can be turned off by RVMathEquationManager.SaveOMMLInDocX property). Equations can be loaded from DocX.

RTF

Equations are saved as images. Equations cannot be loaded.

Export to text

Text property is saved.