Skip to main content

Source editing

The editor interface includes two input/display modes: Design view and Source view. Design view is the standard mode for creating and editing your equations discussed in other sections of this documentation. In this view the input is displayed as it will be seen in your document. Source view is an alternate mode which displays the exact MathML syntax and structure, and operates just like a text editor, allowing you to directly edit equation content within the MathML source itself. Source view also includes commands for checking the syntax of the MathML and formatting the text itself. The Editor will always open into the view used in the last editing session.

Click on the 'Source view' tab just below the editor window to edit the MathML source. Changes made to equation content in Source view are immediately reflected in Design view.

Editing the MathML in Source view is just like working in any text editor. All standard text, space, and line break characters are recognized. In addition, pressing Shift+Tab will tab blocks of text. This can be useful for isolating or formatting sections of the MathML to aid with editing.

The Source view toolbar is fixed (non-configurable) and includes commands for Cut, Copy, Paste, Undo, Redo, Format Source, Validate, and Help.

Edit menu, Source view

This menu contains the actions for exporting to and importing data from the system clipboard, as well as undoing actions, selecting content, and performing a find & replace.

The Source view editor acts as a standard text editor, therefore selection, cut/copy, and paste operations only utilize text data and add no special formatting.

The clipboard can be used in two ways. First, the clipboard is useful for cutting and pasting within the Editor. Second, the clipboard is useful for pasting data into other applications. Equation data targeted for other applications in general requires additional formatting. For example, some XML applications may require a namespace prefix for MathML markup.

There are several commands in the Edit menu. Details follow, including shortcut keys:

Undo ( Ctrl+Z )

This command reverses the last cut, paste, or text editing operation. You can undo the last 100 operations.

Redo ( Ctrl+Y )

This command reapplies the last cut, paste, or text editing operation that was undone. You can redo operations up to the point of the first undo.

Cut ( Ctrl+X )

This deletes the selected MathML or text from the editor, and places it in the system clipboard (so it can be pasted into other applications).

Copy ( Ctrl+C )

This copies the selected MathML or text from the editor, and places it in the system clipboard (so it can be pasted into other applications) without removing the selection from the current equation.

Paste ( Ctrl+V )

This command pastes the contents of the system clipboard into the editor window at the current cursor location. Only text content will be accepted.

If the MathML on the clipboard was placed there by the MathFlow Editor, it can always be pasted back into the Editor regardless of how it is formatted. Although Source view will allow any text to be placed into the editor, the data/equation must be in valid MathML format, and it MUST be enclosed by ‹math› tags. It will not paste clipboard data as MathML unless it begins and ends with ‹math› tags. It is recommended to use the Validate command after a paste to check for any MathML errors (see the next section, Source menu, for details). Also, the editor will ignore any data on the clipboard before the opening math tag, and after the ending math tag.

Select All ( Ctrl+A )

This selects the entire MathML source currently in the editor.

Find/Replace ( Ctrl+F )

This option operates just like most any text editor Find & Replace feature. The command will find instances of the specified text in the selection or entire document and if needed, replace any or all instances with specified text.

Source menu

This menu contains the actions for formatting and validating the MathML source; it is only available in Source view.

There are two commands in the Source menu:

Format

This command will format the MathML, nicely positioning the syntax into an easily readable form. Format affects the entire document (equation), whether any or all MathML text is selected or not. Format can also be accessed via a right-click in the editing window itself or by clicking the Format Source toolbar button (document icon).

Validate

This command (also known as the syntax checker) will check the MathML for proper syntax and structure. If the MathML passes validation, 'Validation completed successfully' will appear. If there are problems, the first error found will display in the status bar and the offending syntax will display as red text; a warning that reads 'The MathML is invalid, please see the status line for details' will also appear. As long as there are errors, the editor will be prevented from closing or switching to Design view. Validate can also be accessed by clicking the Validate toolbar button (checkmark icon).

Context highlighting

Source view is designed with some clear visual cues to assist in viewing and editing the structure. To this end, the Editor uses four colors to differentiate the major components:

  • MathML data and regular text is displayed black, such as the number 355, the entity β or the function sin.

  • MathML tags and edited data before re-formatting are displayed blue, such as

    <span><tt></mo></tt></span>

    or

    <span><tt><mfrac></tt></span>

    .

  • MathML attribute values display in purple, such as the 2 mathcolor and linebreak attribute values

    <span><tt>red</tt></span>

    ,

    <span><tt>yellow</tt></span>

    , and

    <span><tt>badbreak</tt></span>

    , respectively.

  • MathML syntax errors reported after running the Validate command display in red, such as

    <span><tt></row></tt></span>

    when

    <span><tt></mrow></tt></span>

    is expected