Demo TeX Editor

Demo Editor is an app demonstrating capabilities of a modern typesetter capable of handling math equations.

Download Demo Editor.

Demo Editor uses a TeX-like syntax for the input equation. The typesetter can render most equations describable with TeX. The input parser however is experimental and limited to a subset of TeX commands. The following describes the syntax of an input text for the editor.

General Syntax

The editor follows almost the same general rules for parsing as TeX. Specifically,

  • All whitespace and newline characters are ignored, except for when it's the name of a command (e.g. "\ ").
  • A group is defined when a text is surrounded by { and } characters. Commands respect the locality of parameters inside a group the same way TeX does.
  • Characters _ and ^ can be used for writing sub- and superscripts, respectively. Unlike TeX, multiple sub/superscripts are supported. An "empty" can be specified by an empty group, "{}", or by typing two consecutive script indicators. For example, this is a valid input: "{^{pre}f^{}^2_1_ _3}".
  • Commands have the same syntax as in TeX.
  • Direct use of unicode characters are supported. For example, greek letters can be input with their unicode characters instead of using macros.

Macros

All single-character macros defined by Plain TeX are supported. These include support to greek letters (e.g. \alpha), letter-like sumbols (e.g. \imath, math symbols (e.g. \mapsto) and more.

More macros can be defined using \def command. The syntax is similar to TeX.

Commands

The following TeX commands are supported, with their usual meaning: sqrt, frac, matrix, bf, it, rm, quad, sin, lim.
In addition command root is defined. This command takes two arguments. The first one is the radical's index, and the second one its base. For example, "\root3n" represents the third root of n (in TeX, this would be "\root3 \of n").

Examples

Quadratic Equation
x=\frac{-b\mp\sqrt{b^2-4ac}}{2a}
Matrices
{\bf A \times B}=[\matrix{3 & 5 \cr 4 & 1}]
Unicode characters
∫_0^ℏ{5α^4\rm dα} = {α^5}|_0^ℏ
Simultaneous Equations
\matrix{3x&+&2y&+&z&=&5x\prime&-&3y\prime\cr
 &&2y&+&z&=&2x\prime}}

Macros
\int_0^1{\frac{5y^2}{\sin(y)}dy}=
{\def\xvec{(x_1,\ldots,x_n)}
\lim_{n\rightarrow\infty}(\sum_{\xvec\ne(0,\ldots,0)} (f\xvec + g\xvec))}

Services Support

In text editors that support pdf files (like TextEdit, Mail, Pages and Word), you can convert texts to an equation using the service available from Services menu. (Note: this requires re-login after installing the app. Also, you might need to enable this from System Preferences/Keyboard Shortcuts/Services.)