Next: Section 6
Up: WebEQ 2.5 Documentation
Prev: Sections 1-4

WebTeX: A Markup Language for WebEQ


5. Mathematical expressions

5.1 Superscripts and Subscripts

As in LaTeX, the carat (^) is used for superscripts and the underscore (_) is used for subscripts. In general, braces should be put around the raised or lowered expression.

\TeX $e^{i\pi}$    e^{i\pi}

If the superscript or subscript consists only of a single character, the braces are not necessary.

\TeX $y_0 = x_0^2$ y_0 = x_0^2

WebTeX can display tensor notation with the \tensor{}{} command. The first argument is the base, and the second argument contains a series of subscripts and superscripts marked with _ and ^. Pairs of ^ and _ are matched from left to right and aligned in the same column, regardless of order within the pair. If a ^ does not pair up with a _ when the pairs are made, then the missing subscript is left blank. In the example \tensor{R}{_i_k^j^m} below, the first subscript can not be paired up with a superscript, so the superscript's spot above the 'i' is blank. The same thing happens with the last superscript, 'm'.

\TeX $R_i^j{}_k^{}$ \tensor{R}{_i^j_k}
\TeX $R^j_i{}_k^{}$ \tensor{R}{^j_i_k}
\TeX $R_i^{}{}_k^j{}^m_{}$ \tensor{R}{_i_k^j^m}

The WebEQ Examples include examples of superscripts and subscripts, as well as an example of tensor notation.

5.2. Prescripts

Superscripts and subscripts (called prescripts) may also be placed before an expression. These can be created with the \multiscripts{}{}{} command, a generalization of \tensor. Here, the second argument is the base, while the first argument contains the prescripts and the third argument contains the postscripts. These scripts are defined (by pairing up ^ and _) in the same way as they are for \tensor.

\TeX ${}_0^2{}_1^{}R_i^j{}_k^{}$ \multiscripts{_0^2_1}{R}{_i^j_k}
\TeX ${}^2_0{}_1^{}R^j_i{}_k^{}$ \multiscripts{^2_0_1}{R}{^j_i_k}
\TeX ${}_0^{}{}_1^2{}^3_{}R^{}_i{}_k^j{}^m_{}$ \multiscripts{_0_1^2^3}{R}{_i_k^j^m}

5.3. Fractions and Binomial coefficients

Fractions may be created with \frac by placing the numerator in the first argument and the denominator in the second argument.

`One over x' is created with

\TeX $\frac{1}{x}$ \frac{1}{x}

The command \binom is similar to \frac. It places the first argument over the second argument, without drawing the horizontal fraction bar. To create a binomial coefficient, you will need to add parentheses with the \left ( and \right ) commands.

\TeX $\left ( \begin{array}{c}5\\2\end{array} \right )$ \left ( \binom{5}{2} \right )

See the section on delimiters for further discussion of \left and \right.

5.4. Square roots and n-th roots

The command \sqrt displays the square root of its argument.

For the n-th root, use the command \root with n as the first argument and the expression under the radical as the second argument.

\TeX $\sqrt{3}$ \sqrt{3}
\TeX $\sqrt{x^2+2x+3}$ \sqrt{x^2+2x+3}
\TeX $\sqrt[5]{x+1}$ \root{5}{x+1}
The WebEQ Examples include more examples of roots.

5.5. Integrals, Sums, and other variable size operators

Some symbols will be larger in display style than they are in text style. These are

\TeX \begin{tabular}{cclcclccl} $\int$ & ${\displaystyle \int}$ & \htmlBackslash int & $\int\!\!\int$ & ${\displaystyle \int\!\!\int}$ & \htmlBackslash iint & $\int\!\!\int\!\!\int$ & ${\displaystyle \int\!\!\int\!\!\int}$ & \htmlBackslash iiint \\ $\sum$ & ${\displaystyle \sum}$ & \htmlBackslash sum & $\coprod$ & ${\displaystyle \coprod}$ & \htmlBackslash coprod & $\prod$ & ${\displaystyle \prod}$ & \htmlBackslash prod \\ $\oint$ & ${\displaystyle \oint}$ & \htmlBackslash oint & $\bigotimes$ & ${\displaystyle \bigotimes}$ & \htmlBackslash otimes & $\bigoplus$ & ${\displaystyle \bigoplus}$ & \htmlBackslash oplus \\ $\bigcup$ & ${\displaystyle \bigcup}$ & \htmlBackslash cup & $\bigcap$ & ${\displaystyle \bigcap}$ & \htmlBackslash cap & $\bigwedge$ & ${\displaystyle \bigwedge}$ & \htmlBackslash wedge \end{tabular}

Upper and lower limits for integrals or other variable size symbols can be specified with ^ and _ respectively. In display mode, these limits will be above and below the integral symbol. In text mode, the limits will be placed to the right of the symbol.

\TeX  $\sum_{k=0}^{\infty} c_k x^k$ \textstyle{ \sum_{k=0}^{\infty} c_k x^k }
\TeX ${\displaystyle \sum_{k=0}^{\infty} c_k x^k }$ \displaystyle{ \sum_{k=0}^{\infty} c_k x^k }
The symbol \iint draws a double integral, and \iiint draws a triple integral. These draw the integral symbols closer together than they normally would get with

\int \int or \int \int \int.

Use \displaystyle {\cup} to force the cup symbol to be large when the surrounding expressions are otherwise in text style.

The following five symbols will be large, regardless of the current style:

\TeX \begin{tabular}{clclcl} ${\displaystyle \bigcap}$ & \htmlBackslash bigcap & ${\displaystyle \bigcup}$ & \htmlBackslash bigcup & ${\displaystyle \bigwedge}$ & \htmlBackslash bigwedge \\ ${\displaystyle \bigotimes}$ & \htmlBackslash bigotimes & ${\displaystyle \bigoplus}$ & \htmlBackslash bigoplus & & \end{tabular}

The WebEQ Examples include examples of a displayed integral and the difference between display style and text style.

5.6. Logarithms and other functions

Many functions are traditionally typeset in an upright font. The following WebTeX commands automatically have this property.

\arccos   \cos   \csc   \exp   \ker     \limsup   \min   \sinh
\arcsin   \cosh  \deg   \gcd   \lg      \ln       \Pr    \sup
\arctan   \cot   \det   \hom   \lim     \log      \sec   \tan
\arg      \coth  \dim   \inf   \liminf  \max      \sin   \tanh

The limit functions will deal with subscripts and superscripts in a manner similar to the operators in the previous section. In display style, \lim_{x \to 0} f(x) will place the subscript underneath the limit symbol.
\TeX $\lim_{x \to 0} f(x)$ \textstyle{\lim_{x \to 0} f(x)}
\TeX ${\displaystyle\lim_{x \to 0} f(x)}$ \displaystyle{\lim_{x \to 0} f(x)}

If you have a function that is not on the list above, you may force any identifier to behave as an operator using the

\mathop{function}

command. For instance, the cosine function would normally be used this way:

\cos x

However, if the cosine function wasn't already on the list above, the command

\mathop{cos} x
would produce the same effect. That is, the "cos" would appear in an upright font, extra space would be included before the "x" and subscripts and superscripts would be treated as limits.

The WebEQ Examples include examples of a few of the functions mentioned above.

5.7. Delimiters

Delimiters are the symbols such as parentheses and brackets which enclose a mathematical expression. These symbols, when used with the \left and \right commands, will grow to fit the size of the expression they enclose. The delimiters which WebTeX recognizes are:

\TeX \begin{tabular}{clcl} \{ & \htmlBackslash {\tt \}} & \} & \htmlBackslash {\tt \}} \\ $\lfloor$ & \htmlBackslash lfloor & $\rfloor$ & \htmlBackslash rfloor\\ $\lceil$ & \htmlBackslash lceil & $\rceil$ & \htmlBackslash rceil\\ $[$ & {\tt [} & $]$ & {\tt ]} \\ $($ & {\tt (} & $)$ & {\tt )} \\ $\langle$ & \htmlBackslash langle & $\rangle$ & \htmlBackslash rangle\\ $|$ & {\tt | }& & \\ $\|$ &  \htmlBackslash {\tt |} & & \end{tabular}

Note that the curly braces must be specified with \{ and \} since braces alone are interpreted by WebEQ as part of the commands. A simple example is

\TeX $\left ( \frac{2}{4+x} \right )^3$ \left ( \frac{2}{4+x} \right )^3

The \left and \right commands must be used in pairs, since WebTeX expects the expression that determines the height of the delimiters to be surrounded by a pair of \left and \right commands. However, only the \left and \right keywords must appear in pairs; either delimiter may be omitted:

\TeX $\left. \frac{x}{y} \right|_{x=0}$ \left \frac{x}{y} \right|_{x=0}

Caution: This is a significant difference between WebTeX and TeX. In TeX, some delimiter is required after the \right or \left command, and uses a special invisible delimiter in situations like the one illustrated above.

By default, delimiters grow symmetrically around the horizontal axis of the equation. When enclosing a matrix that is aligned at its top or bottom, for example, one needs the delimiters to "float" to match the alignment of the enclosed expression. To accomplish this, use the \floatleft and \floatright commands instead. For matching purposes, a \floatleft will match a plain \right and vice versa.

The WebEQ Examples include examples of delimiters.

5.8. Accents

There are seven accents which place a one-character wide accent above their arguments:

\TeX \begin{tabular}{clclcl} $\bar{x}$ & \htmlBackslash bar\{x\} & $\check{x}$ & \htmlBackslash check\{x\} & $\dot{x}$ & \htmlBackslash dot\{x\} \\ $\hat{x}$ & \htmlBackslash hat\{x\} & $\tilde{x}$ & \htmlBackslash tilde\{x\} & $\ddot{x}$ & \htmlBackslash ddot\{x\} \\ $\vec{x}$ & \htmlBackslash vec\{x\} & & & & \end{tabular}

The wide versions of these five accents stretch to the width of the enclosed expression.

\TeX $\widehat{a+b}$ \widehat{a+b}
\TeX \begin{picture}(26,14)(0,-10) \put(0,2){\line(4,-1){13}}\put(26,2){\line(-4,-1){13}} \put(0,-10){$a+b$} \end{picture} \widecheck{a+b}
\TeX $\overline{a+b}$ \widebar{a+b}
\TeX $\overrightarrow{a+b}$ \widevec{a+b}
\TeX $\widetilde{a+b}$ \widetilde{a+b}
The WebEQ Examples include examples of these accents.

5.9. Placing symbols over or under an expression

The command \overbrace places a horizontal brace that stretches over its argument, and \underbrace stretches a brace underneath its argument.

Besides braces, any symbol may be placed above or below an expression with the commands \overset or \underset. These are generalizations of \overbrace and \underbrace. Instead of a brace, any symbols that are in the first argument will be typeset above or below the main expression in the second argument.

\TeX \begin{tabular}{c} $n$ terms \\           $\overbrace{1+2+\cdots+n}$ \end{tabular}

\overset{\text{$n$ terms}}{\overbrace{1+2+\cdots+n}}

The WebEQ Examples include examples of the overbrace and overset commands.

5.10. Mathematical symbols and extended characters

There are many other mathematical symbols which are supported by WebTeX.

Greek letters

Both capital and lower-case Greek letters are available. The capital letters that are not listed on the table below are the same as the Roman capitals.

Capital letters:

\TeX \begin{tabular}{clclclcl} $\Delta  $ & \htmlBackslash Delta  & $\Omega  $ & \htmlBackslash Omega  & $\Psi    $ & \htmlBackslash Psi     & $\Xi     $ & \htmlBackslash Xi     \\ $\Gamma  $ & \htmlBackslash Gamma  & $\Phi    $ & \htmlBackslash Phi    & $\Sigma  $ & \htmlBackslash Sigma   & $\Upsilon$ & \htmlBackslash Upsilon \\ $\Lambda $ & \htmlBackslash Lambda & $\Pi     $ & \htmlBackslash Pi     & $\Theta  $ & \htmlBackslash Theta  & & \end{tabular}

Lower-case letters:

\TeX \begin{tabular}{clclclcl} $\alpha     $ & \htmlBackslash alpha      & $\theta     $ & \htmlBackslash theta      & $\xi        $ & \htmlBackslash xi          & $\tau       $ & \htmlBackslash tau        \\  $\beta      $ & \htmlBackslash beta       & $\vartheta  $ & \htmlBackslash vartheta   & $o          $ & o (omicron)           & $\upsilon   $ & \htmlBackslash upsilon    \\  $\gamma     $ & \htmlBackslash gamma      & $\iota      $ & \htmlBackslash iota       & $\pi        $ & \htmlBackslash pi         & $\phi       $ & \htmlBackslash phi        \\  $\delta     $ & \htmlBackslash delta      & $\kappa     $ & \htmlBackslash kappa      & $\varpi     $ & \htmlBackslash varpi       & $\varphi    $ & \htmlBackslash varphi     \\  $\epsilon   $ & \htmlBackslash epsilon    & $\lambda    $ & \htmlBackslash lambda     & $\rho       $ & \htmlBackslash rho         & $\chi       $ & \htmlBackslash chi         \\  $\varepsilon$ & \htmlBackslash varepsilon & $\mu        $ & \htmlBackslash mu         & $\varrho    $ & \htmlBackslash varrho     & $\psi       $ & \htmlBackslash psi         \\  $\zeta      $ & \htmlBackslash zeta      & $\nu       $ & \htmlBackslash nu        & $\sigma    $ & \htmlBackslash sigma     & $\omega    $ & \htmlBackslash omega      \\  $\eta      $ & \htmlBackslash eta       & 		&			 & 		&			 & 		&  \end{tabular}

Arrows:

\TeX \begin{tabular}{cllcl} $\Longleftrightarrow$&\htmlBackslash Longleftrightarrow & \htmlBackslash iff&  & \\ $\Leftrightarrow$ & \htmlBackslash Leftrightarrow &  &                    & \\ $\Rightarrow     $ & \htmlBackslash Rightarrow     & \htmlBackslash implies& $\nearrow        $ & \htmlBackslash nearrow          \\ $\Leftarrow$ & \htmlBackslash Leftarrow &  & $\nwarrow        $ & \htmlBackslash nwarrow         \\ $\hookleftarrow  $ & \htmlBackslash hookleftarrow   &          & $\swarrow        $ & \htmlBackslash swarrow          \\ $\hookrightarrow $ & \htmlBackslash hookrightarrow  &\htmlBackslash hkarrow& $\searrow        $ & \htmlBackslash searrow          \\ $\longleftarrow  $ & \htmlBackslash longleftarrow  & \htmlBackslash llarrow & $\downarrow      $ & \htmlBackslash downarrow       \\ $\longrightarrow $ & \htmlBackslash longrightarrow & \htmlBackslash lrarrow & $\uparrow        $ & \htmlBackslash uparrow         \\ $\leftarrow      $ & \htmlBackslash leftarrow      &  & $\updownarrow    $ & \htmlBackslash updownarrow     \\ $\rightarrow     $ & \htmlBackslash rightarrow     & \htmlBackslash to  & $\Downarrow      $ & \htmlBackslash Downarrow  \\ $\leftrightarrow $ & \htmlBackslash leftrightarrow  & & $\Uparrow        $ & \htmlBackslash Uparrow \\ $\mapsto         $ & \htmlBackslash mapsto          & & $\Updownarrow    $ & \htmlBackslash Updownarrow \end{tabular}

Relations:

\TeX \begin{tabular}{clclclcl} $\neq       $ & \htmlBackslash neq       & $\gg        $ & \htmlBackslash gg        & $\ll        $ & \htmlBackslash ll        & $           $ &                          \\ $\gt        $ & \htmlBackslash gt        & $\geq       $ & \htmlBackslash geq       & $\not\geq   $ & \htmlBackslash ngeq      & $\not\gt    $ & \htmlBackslash ngtr      \\ $\lt        $ & \htmlBackslash lt        & $\leq       $ & \htmlBackslash leq       & $\not\leq   $ & \htmlBackslash nleq      & $\not\lt    $ & \htmlBackslash nless     \\ $\not\subset$ & \htmlBackslash subset    & $\not\subset$ & \htmlBackslash nsubset   & $\supset    $ & \htmlBackslash supset    & $\not\supset$ & \htmlBackslash nsupset   \\ $\subseteq  $ & \htmlBackslash subseteq  & $\not\subseteq $ & \htmlBackslash nsubseteq & $\supseteq  $ & \htmlBackslash supseteq  & $\not\supseteq $ & \htmlBackslash nsupseteq \\ $\parallel  $ & \htmlBackslash parallel  & $\in        $ & \htmlBackslash in        & $\approx    $ & \htmlBackslash approx    & $\propto    $ & \htmlBackslash propto    \\ $\not\,\parallel $ & \htmlBackslash nparallel & $\notin     $ & \htmlBackslash notin     & $\sim       $ & \htmlBackslash sim       & $\equiv     $ & \htmlBackslash equiv     \\ $\perp      $ & \htmlBackslash perp      & $\ni        $ & \htmlBackslash ni        & $\triangleleft$ &\htmlBackslash triangleleft   & $\triangleright$ & \htmlBackslash triangleright\\ $\mid       $ & \htmlBackslash mid       & $\not\:\mid $ & \htmlBackslash nmid      & $\cong      $ & \htmlBackslash cong      & $\ncong     $ & \htmlBackslash ncong \\ $\prec  $ & \htmlBackslash prec   & $\preceq$ & \htmlBackslash preceq & $\succ  $ & \htmlBackslash succ   & $\succeq$ & \htmlBackslash succeq \\ $\nprec  $ & \htmlBackslash nprec   & $\npreceq$ & \htmlBackslash npreceq & $\nsucc  $ & \htmlBackslash nsucc   & $\nsucceq$ & \htmlBackslash nsucceq \end{tabular}

Binary operations:

\TeX \begin{tabular}{clclcl} $\amalg        $ & \htmlBackslash amalg   & $\pm           $ & \htmlBackslash pm      & $\times        $ & \htmlBackslash times                   \\ $\setminus     $ & \htmlBackslash setminus & $\circ         $ & \htmlBackslash circ     & $\div          $ & \htmlBackslash div                  \\ $\raisebox{.5ex}{$\scriptscriptstyle \setminus$}$ & \htmlBackslash smallsetminus& $\ltimes       $ & \htmlBackslash ltimes   & $\rtimes       $ & \htmlBackslash rtimes \end{tabular}

Dots:

\TeX \begin{tabular}{clcl} $a \cdot b$ & a \htmlBackslash cdot b       & $a \cdot b$ & a \htmlBackslash centerdot b \\ $a \cdots b$ & a \htmlBackslash cdots b  & $a \ddots b$ & a \htmlBackslash ddots b  \\ $a \ldots b$ & a \htmlBackslash ldots b  & $a \vdots b$ & a \htmlBackslash vdots b \end{tabular}

Miscellaneous Symbols:

\TeX \begin{tabular}{clclclcl} $\Im      $ & \htmlBackslash Im      & $\Re      $ & \htmlBackslash Re      & $\aleph   $ & \htmlBackslash aleph    & $\angle   $ & \htmlBackslash angle     \\ $\bot     $ & \htmlBackslash bot     & $\exists  $ & \htmlBackslash exists  & $\nexists $ & \htmlBackslash nexists & $\forall  $ & \htmlBackslash forall   \\ $\emptyset$ & \htmlBackslash emptyset & $\hbar    $ & \htmlBackslash hbar     & $\imath   $ & \htmlBackslash imath   & $\jmath   $ & \htmlBackslash jmath   \\ $\infty   $ & \htmlBackslash infty    & $\nabla   $ & \htmlBackslash nabla    & $\neg     $ & \htmlBackslash neg     & $\partial $ & \htmlBackslash partial \\ $\prime   $ & \htmlBackslash prime    & $x'      $ &  x' & $\top     $ & \htmlBackslash top & $\ell     $ & \htmlBackslash ell \\ $\therefore      $     & \htmlBackslash therefore      & $\because        $     & \htmlBackslash because         & $\wp             $     & \htmlBackslash wp              & $\bigtriangleup  $     & \htmlBackslash bigtriangleup  \\  $\flat           $     & \htmlBackslash flat           & $\sharp          $     & \htmlBackslash sharp           & $\natural        $     & \htmlBackslash natural        & $\bigtriangledown$     & \htmlBackslash bigtriangledown \\  $\vee            $     & \htmlBackslash vee             & $\bullet         $     & \htmlBackslash bullet         & $\square         $     & \htmlBackslash square          & & \end{tabular}


[HOME] WebEQ 2.5 Documentation Table of Contents

Created: Dec 18 1997 --- Last modified: Sat Mar 04 12:36:24 2000
Copyright © 1997-2000 Design Science, Inc. All rights reserved.