Lurch web app user interface

Class

ExpositoryMath

An Atom that represents a piece of mathematical notation used only for exposition

Constructor

new ExpositoryMath()

Source

Methods

edit() → {Promise}

Shows a dialog for editing an expository math atom, but it may style the dialog differently, depending on whether the user has chosen beginner, intermediate, or advanced mode for the expository math editor.

In beginner mode, the dialog contains only a MathLive editor, which the user uses to create their expository math content.

In any other mode, the dialog has two portions, a text input that accepts LaTeX input and a MathLive editor that allows editing of WYSIWYG math content. These two stay in sync, in that if the user edits either one, the other is updated automatically.

Advanced mode differs from intermediate mode in two ways. First, the header, footer, and labels in the dialog are removed to style it like the advanced mode editor for Expression atoms. Second, the MathLive editor is read-only, also to imitate the advanced mode behavior of the dialog for Expression atoms.

Returns

Source

toEmbed() → {string}

When embedding a copy of the Lurch app in a larger page, users will want to write simple HTML describing a Lurch document, then have a script create a copy of the Lurch app and put that document into it. We allow for representing expository math using <latex>...</latex> elements, which contain LaTeX notation. This function can convert any expository math atom into the corresponding latex element, as a string.

Returns

  • string

    the representation of the atom as a lurch element

Source

toLatex() → {string}

All atoms must be able to represent themselves in LaTeX form, so that the document (or a portion of it) can be exporeted for use in a LaTeX editor, such as Overleaf. This function overrides the default implementation with a representation suitable to expository math atoms, which is just to enclose their LaTeX content in dollar signs.

Returns

  • string

    LaTeX representation of an expository math atom

Source

update()

Render the LaTeX from the dialog as HTML and place that HTML into the body of the atom. No check is done to be sure that the LaTeX is valid; the user can type invalid LaTeX and get erroneous typeset results.

Source