Skip to main content

MathFlow toolbar definition language

Language constructs

Overview, language constructs

The MathFlow toolbar configuration language is an XML vocabulary for describing the arrangement of templates, symbols, and pull-down palettes. The language is very simple, with just six tags and five attributes. However, there are several hundred keywords for pre-defined palettes, symbols and templates. Note in most cases the toolbar configuration language expects names of characters rather than true entity references, i.e., <btn>alpha</btn> instead of <btn>α</btn>. The following sections describe the tags, their attributes, and examples of their usage.

Toolbar definition language attributes

tb element

The tb element is the top-level wrapper for a complete toolbar description. Every configuration description consists of a single tb element.

Attributes

name

permitted values

size

[s | l | w | ws] (default l)

Specifying size=s indicates that all buttons on the toolbar and pull-down palettes should be the small size, unless otherwise indicated. Similarly, size=l (lowercase L) indicates buttons should be large, size=w should be wide, and size=ws should be wide and small.

Examples

<tb><btn>alpha</btn><incl name='#toolbox'/></tb>
mathflow_sdk_tb_example1.gif
<tb size='s'><btn>alpha</btn><incl name='#toolbox'/></tb>
mathflow_sdk_tb_example2.gif

row element

The row element is the top-level wrapper for a toolbar row description. Every row description consists of a single row element, which may be inferred if the toolbar has only 1 row. Each row element is a child only of the tb element.

Attributes

name

permitted values

size

[s | l | w | ws] (default l)

Specifying size=s indicates that all buttons on the toolbar and pull-down palettes should be the small size, unless otherwise indicated. Similarly, size=l (lowercase L) indicates buttons should be large, size=w should be wide, and size=ws should be wide and small.

btn element

The btn element is used to place a button on the toolbar. The contents of the element determine the image that will appear on the button and what it does. The contents of a btn element can be:

  1. Any single Unicode character supported by MathFlow e.g., A, b, 3, etc.

  2. Any single MathML character name supported by MathFlow e.g., alpha, otimes, infin, etc.

  3. A quote delimited run of Unicode characters supported by MathFlow e.g. "sin", "Airy", etc.

  4. Any predefined template name.

  5. Any predefined icon name.

  6. A valid MathML string.

Consult the tables of predefined Templates, Palettes, Palette Labels, and MathFlow characters for a complete listing.

When a character or character name is given as the content of the btn element, a button is created displaying that character. When clicked, the button inserts the same character at the current cursor location.

  • When a pre-defined template name is given, a button is created displaying a graphic representation of the template, and clicking inserts the corresponding template at the current cursor location.

  • When an icon name is given, a button is placed on the toolbar displaying the named image. In the case of toolbox icons, the button is associated with the corresponding editor action, i.e., cut, paste, etc. However, when a non-toolbox icon name is given, i.e., "TRIGPALETTE," a button without any default action is created. Normally, one only uses these icons when creating a button to open a pull-down palette using the sub element (see below).

  • When MathML is given, an image of the corresponding typeset mathematical expression is generated and placed on the button. Unless the optional insertas element is used, the same MathML is inserted into the editor.

  • If a button name is not recognized, the toolbar parser will indicate the problem by creating a button displaying a red "X".

When the imagesrc attribute is present, the image indicated will be used for the button face, regardless of the element's content. The action for the button is identical to what it would be without the attribute. The image will be scaled and centered on the button.

Attributes

name

permitted values

type

[mi | mn | mo]

cue

text string

imagesrc

a path relative to the CLASSPATH

When creating a button to insert a character, there is an issue of what MathML code to generate. Some characters can be used as identifiers, numbers or operators, and thus should be tagged with the MI, MN, and MO MathML elements respectively. MathFlow tries to guess according to the following rules:

  • If the character is in the MathFlow operator dictionary, it tags it as an MO.

  • If it is a digit, it tags it as an MN.

  • Otherwise, characters are treated as MI.

By specifying a type attribute on a btn element, you can override this default behavior, and specify which element you would like to have generated.

Similarly, MathFlow displays a default status line message when a reader mouses over a button on the toolbar. For characters, this default message is just the character name. For other icons and templates, the default message varies. By giving a cue attribute, you can specify your own status line message to be displayed when mousing over the button.

Children

name

contents

insertas (optional)

MathML string

When using a MathML string for a button, you can differentiate the MathML used to display an image on the button from the MathML that is inserted into the editor. This allows you to "tweak" the MathML to appear correctly depending on where it is displayed. The content of the btn element indicates the MathML to be displayed on the button. The optional child element insertas indicates the MathML to be inserted into the editor.

Examples

<tb><btn>A</btn><btn>alpha</btn><btn>FRAC</btn><btn>CUT</btn></tb>
mathflow_sdk_btn_example1.gif
<tb><btn type='mn'>I</btn><btn type='mn'>V</btn>
    <btn type='mn'>X</btn><btn type='mn'>L</btn><btn type='mn'>C</btn></tb>
mathflow_sdk_btn_example2.gif
<tb><btn cue='force'>F</btn><btn cue='mass'>m</btn>
    <btn cue='velocity'>v</btn></tb>
mathflow_sdk_btn_example3.gif
<tb>
  <btn cue='Subscript (Ctrl+B)'>
    <math><msub><mi>&template;</mi><mi>&template;</mi></msub></math>
    <insertas>
      <math><msub><template/><template/></msub></math>
    </insertas>
  </btn>
</tb>
mathflow_sdk_btn_example4.gif

sub element

The sub element is used to create a pull-down palette. The sub tags enclose the buttons and sub-palettes which are to be placed on the palette.

The sub element binds the pull-down palette to the button immediately preceding it. Note that if there is no preceding button, the palette created won't be attached to anything and won't be accessible.

Attributes

name

permitted values

size

[s | w | ws]

cols

positive number

The sub element accepts the same size attribute as the tb element, with the same effect. Giving a value of "s" indicates that all the buttons on the pull-down palette should be small, "w" indicates they should all be wide, and "ws" indicates they should be wide and small.

Small buttons usually work well for symbol palettes, while wide buttons work better for templates. Note that all characters, templates and icons on a toolbar are drawn at a common scale. If you put a wide expression in a small button, the magnification factor will be so small that many of the other buttons images will be too small to read. Thus, it is usually best to try to pick appropriate button sizes for their contents.

The cols attribute specifies how many columns wide the created pull-down palette will be. MathFlow automatically places the buttons left to right and top to bottom on the palette regardless of the number of columns, and fills any empty space in the last row.

Examples

<tb><btn>A</btn><sub><btn>FRAC</btn></sub></tb>
mathflow_sdk_sub_example1.gif
<tb><btn>TRIGPALETTE</btn><sub size='w'><btn>COS</btn>
    <btn>SIN</btn><btn>theta</btn></sub></tb>
mathflow_sdk_sub_example2.gif
<tb><btn>TRIGPALETTE</btn><sub size='w' cols='2'><btn>COS</btn>
    <btn>SIN</btn><btn>theta</btn><btn>pi</btn></sub></tb>
mathflow_sdk_sub_example3.gif

sep element

The sep element is an empty element which creates a vertical separator on the toolbar or pull-down palette. This is useful for visually grouping similar items on a toolbar or palette.

Attributes

None.

Example

<tb><btn>FRAC</btn><btn>SUP</btn><btn>SQRT</btn><sep/>
    <btn>infin</btn><btn>angle</btn><btn>theta</btn></tb>
mathflow_sdk_sep_example.gif

incl Element

The incl element inserts a pre-defined toolbar component at that location in the configuration description. In effect, this element works like a bare-bones macro capability, with a collection of pre-defined macros that expand before processing.

Consult the table of pre-defined Templates and Palettes for a complete listing of pre-defined components. Most of them are complete pre-defined pull-down palettes, such as a trig palette, Greek letter palettes, and so on. Several complete toolbars are also pre-defined.

Pre-defined component names all begin with a "#" character.

Attributes

name

permitted values

name

pre-defined label

The incl is an empty element; the pre-defined component to insert is specified by the name attribute. If the value is unrecognized, the include is ignored by MathFlow

Example

<tb><btn>LCGREEKPALETTE</btn><sub size='s'><incl name='#greek'/></sub><sep/>
    <btn>TOOLBOX</btn><sub cols='3' size='s'><incl name='#toolbox'/></sub></tb>
mathflow_sdk_incl_example.gif

Palettes and templates

In this section:

Complete toolbars

Use these keywords with the incl element to insert pre-defined components in a toolbar. For an explanation of how to use the incl element, see the documentation on the toolbar definition language constructs.

#standard

mathflow_sdk_standard_toolbar.gif

#extrasymbols

mathflow_sdk_extrasymbols_toolbar.gif

#basic

mathflow_sdk_basic_toolbar.gif

#websafe

mathflow_sdk_websafe_toolbar.gif

Palettes

Use these keywords with the incl element to insert pre-defined components in a toolbar. For an explanation of how to use the incl element, see the documentation on the toolbar definition language constructs.

#layout

mathflow_sdk_layout_palette.gif

#accents

mathflow_sdk_accents_palette.gif

#combiningCommon

mathflow_sdk_combiningcommon_palette.gif

#combiningOther

mathflow_sdk_combiningother_palette.gif

#fences

mathflow_sdk_fences_palette.gif

#matrix

mathflow_sdk_matrix_palette.gif

#trig

mathflow_sdk_trig_palette.gif

#calculus

mathflow_sdk_calculus_palette.gif

#arrows

mathflow_sdk_arrows_palette.gif

#operators

mathflow_sdk_operators_palette.gif

#relations

mathflow_sdk_relations_palette.gif

#settheory

mathflow_sdk_settheory_palette.gif

#greek

mathflow_sdk_greek_palette.gif

#Greek

mathflow_sdk_ucgreek_palette.gif

#logic

mathflow_sdk_logic_palette.gif

#dots

mathflow_sdk_dots_palette.gif

#variants

mathflow_sdk_variants_palette.gif

#exarr

mathflow_sdk_exarr_palette.gif

#exrel

mathflow_sdk_exrel_palette.gif

#equiv

mathflow_sdk_equiv_palette.gif

#exop

mathflow_sdk_exop_palette.gif

#triangles

mathflow_sdk_triangles_palette.gif

#boxes

mathflow_sdk_boxes_palette.gif

#dashes

mathflow_sdk_dashes_palette.gif

#basicops

mathflow_sdk_basicops_palette.gif

#basicrelns

mathflow_sdk_basicrelns_palette.gif

#mixedsym

mathflow_sdk_mixedsym_palette.gif

#mixedops

mathflow_sdk_mixedops_palette.gif

#intcalc

mathflow_sdk_intcalc_palette.gif

#diffcalc

mathflow_sdk_diffcalc_palette.gif

#veccalc

mathflow_sdk_veccalc_palette.gif

#invisiblechars

mathflow_sdk_invisiblechars_palette.gif

#toolbox

mathflow_sdk_toolbox_palette.gif

Palette labels

LAYOUTPALETTE

mathflow_sdk_layoutpalette.gif

FENCEPALETTE

mathflow_sdk_fencepalette.gif

COMMONCOMBININGPALETTE

mathflow_sdk_commoncombiningpalette.gif

OTHERCOMBININGPALETTE

mathflow_sdk_othercombiningpalette.gif

ACCENTPALETTE

mathflow_sdk_accentpalette.gif

TRIGPALETTE

mathflow_sdk_trigpalette.gif

MATRIXPALETTE

mathflow_sdk_matrixpalette.gif

CALCPALETTE

mathflow_sdk_calcpalette.gif

DERIVATIVEPALETTE

mathflow_sdk_derivativepalette.gif

INTEGRALPALETTE

mathflow_sdk_integralpalette.gif

VECTORCALCPALETTE

mathflow_sdk_vectorcalcpalette.gif

LOGICPALETTE

mathflow_sdk_logicpalette.gif

RELATIONPALETTE

mathflow_sdk_relationpalette.gif

OPERATORPALETTE

mathflow_sdk_operatorpalette.gif

SYMBOLPALETTE

mathflow_sdk_symbolpalette.gif

LCGREEKPALETTE

mathflow_sdk_lcgreekpalette.gif

UCGREEKPALETTE

mathflow_sdk_ucgreekpalette.gif

ARROWPALETTE

mathflow_sdk_arrowpalette.gif

SETTHEORYPALETTE

mathflow_sdk_settheorypalette.gif

DOTPALETTE

mathflow_sdk_dotpalette.gif

VARIANTPALETTE

mathflow_sdk_variantpalette.gif

EXARRPALETTE

mathflow_sdk_exarrpalette.gif

EQUIVPALETTE

mathflow_sdk_equivpalette.gif

EXRELPALETTE

mathflow_sdk_exrelpalette.gif

EXOPPALETTE

mathflow_sdk_exoppalette.gif

TRIANGLEPALETTE

mathflow_sdk_trianglepalette.gif

BOXPALETTE

mathflow_sdk_boxpalette.gif

DASHPALETTE

mathflow_sdk_dashpalette.gif

INVISIBLECHARSPALETTE

mathflow_sdk_invisiblecharspalette.gif

Templates

FRAC

mathflow_sdk_frac_template.gif

SQRT

mathflow_sdk_sqrt_template.gif

ROOT

mathflow_sdk_root_template.gif

SUB

mathflow_sdk_sub_template.gif

SUP

mathflow_sdk_sup_template.gif

SUBSUP

mathflow_sdk_subsup_template.gif

PRESUB

mathflow_sdk_presub_template.gif

PRESUP

mathflow_sdk_presup_template.gif

PRESUBSUP

mathflow_sdk_presubsup_template.gif

UNDER

mathflow_sdk_under_template.gif

OVER

mathflow_sdk_over_template.gif

UNDEROVER

mathflow_sdk_underover_template.gif

MAKEMROW

mathflow_sdk_makemrow_template.gif

MAKEMSTYLE

mathflow_sdk_makemstyle_template.gif

MAKEMTEXT

mathflow_sdk_makemtext_template.gif

PARENS

mathflow_sdk_parens_template.gif

BRACKETS

mathflow_sdk_brackets_template.gif

BRACES

mathflow_sdk_braces_template.gif

ANGLES

mathflow_sdk_angles_template.gif

ABSBARS

mathflow_sdk_absbars_template.gif

CEILS

mathflow_sdk_ceils_template.gif

FLOORS

mathflow_sdk_floors_template.gif

NORMBARS

mathflow_sdk_normbars_template.gif

BAR

mathflow_sdk_bar_template.gif

RAY

mathflow_sdk_ray_template.gif

VEC

mathflow_sdk_vec_template.gif

PRIME

mathflow_sdk_prime_template.gif

DOT

mathflow_sdk_dot_template.gif

DDOT

mathflow_sdk_ddot_template.gif

TILDE

mathflow_sdk_tilde_template.gif

HAT

mathflow_sdk_hat_template.gif

LINE

mathflow_sdk_line_template.gif

CUB

mathflow_sdk_cub_template.gif

CLB

mathflow_sdk_clb_template.gif

UBAR

mathflow_sdk_ubar_template.gif

TBRK

mathflow_sdk_tbrk_template.gif

BBRK

mathflow_sdk_bbrk_template.gif

SIN

mathflow_sdk_sin_template.gif

COS

mathflow_sdk_cos_template.gif

TAN

mathflow_sdk_tan_template.gif

SEC

mathflow_sdk_sec_template.gif

CSC

mathflow_sdk_csc_template.gif

COT

mathflow_sdk_cot_template.gif

ARCCOS

mathflow_sdk_arccos_template.gif

ARCSIN

mathflow_sdk_arcsin_template.gif

ARCTAN

mathflow_sdk_arctan_template.gif

LOGBASE

mathflow_sdk_logbase_template.gif

MATRIX1X2

mathflow_sdk_matrix1x2_template.gif

MATRIX2X1

mathflow_sdk_matrix2x1_template.gif

MATRIX2X2

mathflow_sdk_matrix2x2_template.gif

MATRIX3X3

mathflow_sdk_matrix3x3_template.gif

MATRIXNXM

mathflow_sdk_matrixnxm_template.gif

DDX

mathflow_sdk_ddx_template.gif

DELDELX

mathflow_sdk_deldelx_template.gif

INDEFINT

mathflow_sdk_indefint_template.gif

DEFINT

mathflow_sdk_defint_template.gif

SUM

mathflow_sdk_sum_template.gif

LOWSUM

mathflow_sdk_lowsum_template.gif

PROD

mathflow_sdk_prod_template.gif

LOWPROD

mathflow_sdk_lowprod_template.gif

LIMIT

mathflow_sdk_limit_template.gif

DIV

mathflow_sdk_div_template.gif

GRAD

mathflow_sdk_grad_template.gif

CURL

mathflow_sdk_curl_template.gif

THINSPACE

mathflow_sdk_thinspace_template.gif

THINNEGSPACE

mathflow_sdk_thinnegspace_template.gif

INVISIBLETIMES

mathflow_sdk_invisibletimes_template.gif

APPLYFUNCTION

mathflow_sdk_applyfunction_template.gif

CUT

mathflow_sdk_cut_template.gif

COPY

mathflow_sdk_copy_template.gif

PASTE

mathflow_sdk_paste_template.gif

UNDO

mathflow_sdk_undo_template.gif

BIGGER

mathflow_sdk_bigger_template.gif

SMALLER

mathflow_sdk_smaller_template.gif

HELP

mathflow_sdk_help_template.gif

CHECKSYNTAX

mathflow_sdk_checksyntax_template.gif

TOOLBOX

mathflow_sdk_toolbox_template.gif

Advanced toolbar configuration

Palettes toolbar

mathflow_sdk_palettes_toolbar.gif

The Palettes toolbar has the following qualities:

  • Allows multiple toolbars with various button sizes, which can be configured with the configuration files.

  • A user can load a custom Palettes toolbar.

  • The Palettes toolbar can be hidden or shown via a View menu.

  • The top level <tb> element contains one or more <row> elements which define each row of the toolbar.

    • Vertical position is defined by the order of <row> elements.

    • If your toolbar has only one row, you can omit the <row> element since it is inferred.

Tabbed toolbar

mathflow_sdk_tabbed_toolbar.gif

The Tabbed toolbar has the following qualities:

  • A user can select an expression and drag onto the current tabbed toolbar to add a new custom button. To delete a button, you can choose Delete from the contextual menu, or edit the toolbar configuration file.

  • To insert the button content at the insertion point, either click the button or right-click and choose Insert.

  • In order to save a toolbar on which you've added custom expressions, choose:

    <strong>Toolbar > Tabbed Toolbar > Save Current Toolbar As</strong>

    .

  • A user can save a Tabbed toolbar under a different name.

  • A user can load a custom Tabbed toolbar.

  • To return to factory default settings, choose

    <strong>Toolbar > Tabbed Toolbar > Standard</strong>

    .

  • To save a separate copy of the Standard toolbar, save a new copy of it:

    <strong>Toolbar > Tabbed Toolbar > Save Current Toolbar As</strong>

    .

  • The Tabbed toolbar can be hidden or shown via the View menu.

  • The toolbar Configuration Language has been extended to allow the definition of multiple tabs for the tabbed toolbar:

    • The top level element <tb> contains one or more <tab> elements.

    • Horizontal position is defined by the order of <tab> elements.

  • There are 7 pre-defined tabs and 2 undefined tabs, all of which can be customized:

    • Algebra

    • Derivs

    • Statistics

    • Matrices

    • Sets

    • Trig

    • Geometry

    • Tab8

    • Tab9

  • To change the tab names, first save the toolbar, then edit the toolbar configuration file.

Mini toolbar

mathflow_sdk_mini_toolbar.png

The mini toolbar is combined on the same line as the MathML ancestry. Included on the mini toolbar are:

  • Style selector. Choose between MathFlow 12 pre-defined logical styles, such as sans-serif and script. If you've defined a custom style, you may choose this style from the style selector as well. Default is inherited, which inherits the style from the parent node on the expression tree.

  • Nine "utility" command buttons. Included are:

    • Configure Styles

    • Undo

    • Cut

    • Copy

    • Paste

    • Verify (check syntax)

    • Magnify (zoom in)

    • Shrink (zoom out)

    • Help

An extended example

Here's an extended example showing a toolbar customized for calculus…

mathflow_sdk_extended_example_custom_toolbar.gif

Here's the configuration string for the toolbar:

<tb>
   <btn>LAYOUTPALETTE</btn>
   <sub>
      <btn>FRAC</btn>
      <btn>SUP</btn>
      <btn>SQRT</btn>
      <btn>ROOT</btn><btn>PARENS</btn><btn>ABSBARS</btn>
      <btn>NORMBARS</btn><btn>BAR</btn>
   </sub>
   <btn>SYMBOLPALETTE</btn>
   <sub><incl name="#mixedsym"/></sub>
   <btn>OPERATORPALETTE</btn>
   <sub cols=3>
      <btn>plus</btn><btn>minus</btn><btn>times</btn><btn>divide</btn>
      <btn>plusmn</btn><btn>lt</btn><btn>gt</btn><btn>leq</btn>
      <btn>geq</btn><btn>cup</btn><btn>cap</btn><btn>in</btn>
      <btn>rarr</btn><btn>subset</btn><btn>compfn</btn>
   </sub>
   <sep/>
   <btn>DERIVATIVEPALETTE</btn>
   <sub cols=3>
      <btn>DDX</btn><btn>DELDELX</btn><btn>LIMIT</btn>
      <btn>PRIME</btn><btn>DOT</btn><btn>DDOT</btn>
   </sub>
   <btn>INTEGRALPALETTE</btn>
   <sub cols="3">
      <btn>INDEFINT</btn><btn>DEFINT</btn><btn>SUM</btn>
      <btn>LOWSUM</btn><btn>PROD</btn><btn>LOWPROD</btn>
   </sub>
   <btn>VECTORCALCPALETTE</btn>
   <sub cols="3">
      <btn>VEC</btn><btn>times</btn><btn>middot</btn>
      <btn>DIV</btn><btn>GRAD</btn><btn>CURL</btn>
   </sub>
   <sep/>
   <btn>CUT</btn><btn>COPY</btn><btn>PASTE</btn>
   <btn>UNDO</btn><btn>BIGGER</btn><btn>SMALLER</btn>
   <sep/>
   <btn>HELP</btn>
</tb>