ver. 0.02

(the stack is empty) |

Source Preview |

This web-page-application provides an easy way to construct complicated LaTeX equations by entering numbers, commands, etc. in Reverse Polish Notation (RPN).

Try typing **1⏎-x⏎frac⏎** into the textbox at the top of this page. You will get \(\small\displaystyle\frac{1}{-x}\) in Level1 of the stack.

Continue typing as **3⏎-⏎** and now you have \(\small\displaystyle\frac{1}{-x}-3\) in Level 1.

Tick the "Source" button just under the textbox (or type **pop⏎**) to get the LaTeX source: **\frac{1}{-x}-3**.

The rule of this game is very simple:

(1) Any string or number you've entered in the textbox is pushed to the stack.

(2) If what you've entered is a command name, a certain number of levels are consumed from the stack and the result is pushed.

(3) Go to (1).

**a⏎b⏎join⏎**

**a⏎b⏎swap⏎join⏎**

**ab⏎ba⏎=⏎**

**@a⏎@b⏎+⏎()⏎sin⏎**

**1⏎2⏎frac⏎()⏎leftright⏎2⏎^⏎**

**x⏎sum⏎x=1⏎_⏎10⏎^⏎**

**1⏎2⏎3⏎4⏎5⏎6⏎array2x3⏎**

**f(x)⏎1⏎2@p@s^2⏎sqrt⏎frac⏎x-@m⏎()⏎2⏎^⏎
2@s^2⏎frac⏎+-⏎()⏎leftright⏎exp⏎join⏎=⏎**

Commands works only when they are entered by itself, otherwise they are treated as parts of ordinary strings. For example, **-** is a command, but **-x** is not.

Many commands have the same names as LaTeX commands without \. For example, **div** command joins the texts in Level 2 and Level 1 with **\div**. Commands are vary in numbers of levels they consume, but you would easily suppose them as "**sin** must consume 1 level" or "**times** must consume 2". We also have commands that are not for particular LaTeX commands. You can use them to operate the stack itself, to repeat a command, to make user definitions, etc.

**"**(double quotation mark) placed at the top of your input string is always removed when it is pushed to the stack. Using this you can escape command-names. For example, **frac** can be escaped as **"frac**. Note that strings which are not defined as commands need not to be escaped, especially ones which begin with \ are rarely commands, so you need not escape them.

In this document some command-names are printed in coloured lettes. They suggest that they are for LaTeX commands which can be used with AMS packages, or they are not for Plain TeX.

**undo** cancels the last operation to have the stack revert to the former state.

**drop\(N\)** drops \(N\) levels from level 1 to Level \(N\). (Default \(N\)=1.)

**pop** copy Level 1 to the input box and drop Level 1.

**clear** drops all levels.

**nip** drops all levels except Level 1.

**swap** swaps Level 1 and Level 2.

**dup\(N\)** duplicates the \(N\) levels from Level \(N\) to Level 1. (Default \(N\)=1)

**pick\(N\)** Copies Level \(N\) and push it. (Default \(N\)=3.)

**unpick\(N\)** Drops Level 1 and replace Level \(N\)+1 with it. (Default \(N\)=3.)

**roll\(N\)** moves what is in level \(N\) to Level1, moves what is in Level1 to Level2... ,and moves what is in Level\((N-1)\) to Level\(N\), in other words it is the cyclic permutation (Level1 Level2 ... LevelN).

**rolld\(N\)** moves what is in Level1 to Level\(N\), moves what is in Level2 to Level1,....,and what is in Level\(N\) moves to Level\((N-1)\), in other words it is the cyclic permutation (LevelN LevelN-1 ... Level1).

Commands in join Level 2 and Level 1 with each operator. For example, **1⏎2⏎+⏎** gives **1+2** i.e., \(1+2\). They are for binary operators; to change the sings of a number use **++,--,+-**. See

We have five commands to change the signs of the number in Level 1. They are unary operators. We have also "==" command, which inserts = at the top of the text in Level 1.

Commands in the followng table join Level 2 and Level 1 with each operator with \. For example, **1⏎2⏎pm⏎** gives **1\pm 2** i.e.,\(1\pm 2\).

Commands in the followng table join Level 2 and Level 1 with each operator. For example, **x⏎y⏎<⏎** gives **x<y** i.e.,x<y.

The Commands in the following table join Level 2 and Level 1 with each operator with \. For example, **1⏎2⏎le** gives **1\le 2** i.e., \(1\le 2\).

The commands in the table below join Level 2 and Level 1 with the LaTeX symbols that each Commad name suggests. For example, **A⏎B⏎rightarrow⏎** gives **A\rightarrow B** i.e.,\(A\rightarrow B\). Some of the commands have their abbreveations, that is ->, -->, =>... in the table below; you can type as **A⏎B⏎->⏎** for **A⏎B⏎rightarrow⏎**.

Commands in are for LaTeX's "large operators". All these commands consume one level from the stack, although some large operators are often used with supscripts and/or superscripts, as \(\sum\limits_{k=1}^{10}\) or \(\lim\limits_{x\to \infty}\). For example **x⏎sum⏎**, which give **\sum x**. Subscripts and superscripts must be added by other commands, **_** and **^**, as **x⏎sum⏎x=1⏎_⏎10⏎^⏎**, which gives **\sum_{x=1}^{10} x**. This is the exceptional behaviour of **_** and **^**, of which usual behaviour is to put subscripts or superscript to the last character (or last group) in level 1. The Commands that leads **_** and/or **^** to this exceptional behaviour are **sin, cos, tan, int, oint, sum, prod, coprod, lim,** **varliminf, varlimsup**, and **log**.

Commands in are for LaTeX's "large operators" as , but these commands consume 2 levels from the stack as their smaller versions in .

There are two commands for LaTeX's **\sqrt**. One is **sqrt**, which consumes 1 level. For example **7⏎sqrt⏎** gives **\sqrt{7}**. The other is **sqrtn**, which consumes twol levels. For example, **7⏎3⏎sqrtn** gives **\sqrt[3]7** i.e., \(\sqrt[3]{7}\)

The commands in join Level 2 and Level 1 with each delimiter. For example, **a⏎b⏎|⏎** gives **a|b**.

[Note] Although 24 symbols including opening and closing parenthesis are defined as delimiters in The TeX Book,p.359, this application treats delimiters and opening/closing parentheses in different way.

The commands in search the last delimiter from end to top in the text in Level 1, and insert the respective LaTeX control sqeuence (command) just before it. If the delimiter is preceeded by the commands in and , the next delimiter receives it. In this process grouped sub formulae are ignored.

For example, if Level 1 is **a | b | c** and you type as **bigm⏎**, then you get **a | b \bigm| c** i.e., \(a | b \bigm| c\).

Commands in put the text that is in Level1 into each parentheses. For example **a⏎()⏎** gives **(a)**. Any pair of opening/closing parenthis can be used as a command, too. For example, as **\{.** **(]** **[\}** ...etc.

The commands in change the size of a pair of parentheses (defined in ) between which all the rest of the text in Level 1 is placed.

For example **(\sqrt{x})⏎leftright⏎** gives **\left(\sqrt{x}\right)** i.e., \(\left(\sqrt{x}\right)\).

[Note] "The plain TEX macros \bigl, \bigr, \bigm, and \big all produce identical delimiters; the only difference between them is that they may lead to different spacing, because they make the delimiter into different types of atoms: \bigl produces an Open atom, \bigr a Close, \bigm a Rel, and \big an Ord. " p.171)

The commands in insert each symbols before the text in Level 1. For example, **x⏎forall** gives **\forall x** i.e., \(\forall x\).

[Note] Inside LaTeX, control sequences (commands) in and are belong to different classes (class 1 and 0 respectively).

The commands in get the text from Level 1 to put it on the text in Level 2 as a subscripts/superscripts. For example **x⏎1⏎_⏎** gives **x_{1}**, i.e, \(x_{1}\), or **x⏎2⏎^⏎** gives **x^{2}**, i.e, \(x^{2}\)

Although what these commands do is to add _xxx or ^xxx to the end of the text in Level2, in particular cases they work differently as :

and

The commands in put the text in Level 1 on to the text in Level 2 as a left-side-subscripts/left-side-superscripts. For example **x⏎1⏎left_⏎** gives **{}_{1}x**, i.e, \({}_{1}x\), or **x⏎2⏎left^⏎** gives **{}^{2}x**, i.e, \({}^{2}x\)

These commands work differently if the text in Level 2 begins with **\sideset**.

**\sideset** is an AMS command to put sub/superscripts on the left or right side of symbols. We have **sideset** command for it. For example **a⏎sideset⏎** gives **\sideset{}{}{a}**.

LaTeX's **\limits** command and **\nolimits** command change the position of subscripts and superscripts of large operators (see ). We have **limits** command and **nolimits** command for them. For example **a⏎sum⏎nolimits⏎b⏎^⏎** gives **\sum\nolimits^{b} a** which is \(\sum\nolimits^{b} a).

Commands in put each associated LaTeX commands before the symbol in Level 1 to change the classes it belongs.

For example, **abc⏎mathop⏎** gives **\mathop{abc}**. More practical example is **"=⏎mathop⏎limits⏎def⏎rm⏎^⏎** which produces \(\mathop=\limits^{\rm def}\). Mind that **\limits** is only available for class 1 characters althoug = is originally a class 2 character.

gives the available commands for making arrays and matrices. To make a matrix the first thing you have to do is to push each member of the matrix one by one into the stack. Then type the command name after replacing "R" and "C" in it with the number of "R"ows and "C"olumns.

For example, **1⏎2⏎3⏎4⏎5⏎6⏎matrix3x2⏎** gives **\begin{matrix} 1&2&3\\ 4&5&6 \end{matrix}** i.e. \(\begin{matrix} 1&2&3\\ 4&5&6 \end{matrix}\).

The following table shows typical usages of the Commands that make math/mathdisplay environments.

**$$**, **\(\)**, **$$$$**, and **\[\]** give **$ Level 1$**,

In the table above, as a general rule, commands having no *N* or no *RxC* at the end of their names consume 1 level. For example **x=1⏎displaymath⏎** gives **\begin{displaymath}x+1\end{displaymath}**.

[Note] Realtime preview of this page doesn't works with **$$**,**\(\)**,**$$$$**,**math** and **displaymath**.

Another rule is that Commands having *N* at the end of their names consume *N* levels. (And if the optional *N* is omitted, 2 will be used.)

Example 1:

**a=bbb⏎cccc⏎dddd⏎multline3⏎**

gives

**\begin{multline}a=bbb\\
cccc\\
dddd\end{multline}**

i.e.,

\begin{multline}a=bbb\\

cccc\\

dddd\end{multline}

Example 2:

**x=x⏎y=yyy⏎z=zzzzzz⏎gather3⏎**

gives

**\begin{gather}x=xx\\
y=yyy\\
z=zzzzzz\end{gather}**

i.e.,

\[\begin{gather}x=x\\y=yyy\\z=zzzzzz\end{gather}\]

[Note] equation numbers are not displayed by realtime preview of this page.

**shoveleft**, **shoveright** Commands can be used with **multline N** and

When **eqnarray &N** or

**aaaaa=bbbbb⏎=cc⏎ddddddddddddddd⏎eqnarray&⏎**

gives

**\begin{eqnarray}aaaaa&=&bbbbb\\
&=&cc\\
&&ddddddddddddddd
\end{eqnarray}**

i.e.,

\begin{eqnarray}aaaaa&=&bbbbb\\&=&cc\\&&ddddddddddddddd\end{eqnarray}

**split &N** Command is not in the table above. Because it is to be used in other environment, so to say it dosen't make math/matndisplay environment (See p.5).

When **split &N** command used with "&" option, &s are automatically inserted before the first = in the text in each line to be collected. If "&" option is used and there is no = in the text in a line to be collected, one & is inserted at the top of the text. In the next example, two

**a=bbb⏎cccccc⏎split&⏎ddd=e⏎fff⏎split&⏎gather⏎**

gives

**\begin{gather}\begin{split}a&=bbb\\
&cccccc\end{split}\\
\begin{split}ddd&=e\\
&fff\end{split}\end{gather}**

i.e.,

\begin{gather}\begin{split}a&=bbb\\&cccccc\end{split}\\

\begin{split}ddd&=e\\&fff\end{split}\end{gather}

In , commands of wihch names end with *RxC* comsume \(R \times C\) levels form the stack. (*R* stands for the number of "R"ows and *C* stands for the number of "C"olums).

If "&" is not omitted as **align&CxR**, &s are automatically inserted before the first = in the texts in each level to be collected. If "&" is not omitted and there is no = in the text in a line, one & is insertd before the text. After that this Command collects \(R\) levels from the stack and join them with &s. This process is repeated \(C\) times and the collections are joined with \\.

For example,

**a=b⏎c=d⏎e=f⏎g=h⏎xxxxxx⏎yyyyyy⏎align&3x2⏎**

gives

**\begin{align}a&=b&c&=d\\
e&=f&g&=h\\
&xxxxxx&&yyyyyy\end{align}**

i.e.,

\begin{align}a&=b&c&=d\\ e&=f&g&=h\\ &xxxxxx&&yyyyyy\end{align}

If you omit "&" as **alignCxR**, &s that are used for column delimiters are inserted automatically, but &s that indicate alignment points are not inserted.

**gathered** and **aligned** are same as **gather** and **align** except that they make math/mathdisplay environment.

**nonumber⏎** puts **\nonumber** at the end of the text in Level 1, or if possible just before **\\** at the end of the text.

**a⏎tag⏎** puts **\tag{a}** at the end of the text in Level 1, or if possible just before **\\** at the end of the text.

**a⏎lefteqn30pt⏎** puts **\lefteqn{a}\hspace{30pt}** at the end of the text in Level 1, or if possible just before **\\** at the end of the text.

[Note] Realtime-preview of this page cannot handle this command, because Mathjax don't support it.

Commands in are not for any particular LaTeX command, so to say they are commands for commands. For example, if you want to insert the text in level 1 between **\begin{xxx}** and **\end{xxx}**, it's sufficient to type **xxx⏎env⏎**; or if you want **\xxx{ the text in Level 1}**,

Commands in are generally used for editing texts. In the command names *N* denotes 1,2,3,...

** Ntimes:other-command** command repeats

Example 1: **2times:a⏎** pushes **a** 2 times.

Example 2: **1⏎2⏎3⏎2times:+⏎** gives **1+2+3**.

Example 3: **1⏎2⏎3⏎2times:<<<swap%join>>>⏎** gives **321**. (See .)

Example 4: **2times:3times:a⏎** push **a** 6 times.

Abbreviations have prefix @. If they are in a [ENTER]ed text, they are expanded before pushed. The expansion occurs even if they are not [ENTER]ed by itself.

For example, **@a+@b⏎** is expanded as **\alpha +\beta**.

shows the abbreviations for Greek letters. We have also the abbreviations for arrows. They are exceptional ones in terms of naming; they don't begin with @. See .

A macro is an object that has the form of **<<<sequence of commands or other strings separated by % >>>**. White spaces in it have no special meaning.

A macro can be used as an anonymous command.

Example 1:

**<<<\triangle %swap%join>>>**
(There is one white space after "\triangle")

is a macro which puts \(\triangle\) before the text in Level 1. This can be used as
anonyumous commands.

**ABC⏎<<<\triangle% swap join>>>⏎**

will gives **\triangle ABC** i.e.,\(\triangle ABC\)

It would be a nice idea to assign a macro to the name you like and to invoke them by the name. See .

**collectfrom MtoN** command collects a certain number of levels from level

For example, **a⏎b⏎c⏎d⏎collectfrom3to1⏎** gives **<<<b%c%d>>>**.

You can assign any text (which can be an ordinary string, a command, or a macro) to any name you like by typing ** name⏎sto⏎** when the text to be assigned is in Level2 and the

To purge a particular assignment use **purge** command as **" name⏎purge⏎**, or to purge all assignments type

Example 1: Once you have typed **3.14⏎pi⏎sto⏎**, after that **pi⏎R^2⏎tims⏎** gives **3.14\times R^2** i.e., \(3.14\times R^2\).

Example 2: once you have typed **"overrightarrow⏎ora⏎sto⏎**, thereafter **AB⏎ora** gives **\overrightarrow{AB}** i.e., \(\overrightarrow{AB}\).

Example 3: **"<<<\triangle %swap%join>>>⏎tri⏎sto⏎** assigns the macro which puts \(\triangle\) before the text in Level 1 to the name **tri**. Thereafter typing **ABC⏎tri⏎** gives **\triangle ABC** i.e., \(\triangle ABC\). Note that macros must be escaped with **"** in this context. (See .)

If you want to get what is assigned to a neme, use **getdef**. The command gets the name from Level 1 and pushes what is assigned to the name. For example, when you have ever typed **"<<<swap%join>>>⏎sj⏎sto⏎**, by typing **"sj⏎getdef⏎** you get **<<<swap%join>>>** in Level1 without having the macro worked.

You can save the whole stack using **savestack** command. For example, ** oldstack⏎savestack⏎** makes a macro by which you can restore the stack, and assigns it to the name "oldstack". To restore the saved stack type

- The TeX Book, Donald E. Knuth, 1986 (the final corrections made in 1996)
- User’s Guide for the amsmath Package (Version 2.0), American Mathematical Society, 1999-12-13 (revised 2002-02-25)
- LaTeX: A Document Preparation System, Leslie Lamport, 1986