WaTeX Notation

The code listed in this table is valid in the <watex> tag. Unless specified otherwise, all of the examples in the following table are shown as they are displayed when using math mode.

Note As in HTML, successive whitespace characters in WaTeX are ignored. To add multiple spaces, you can use <s:space>.

Expression

Code

Example

Display

Perl variables

$variable
${variable}
<EQN $variable>

Use braces when the Perl variable is followed by other text.

Use <EQN> to display the variable in black.

$a
${a}x
<EQN $a>

35

35x

35

Roman text, WebAssign tags, or HTML

\pre{text}

Not needed unless using math mode.

Not needed for answer placeholder string <_>.

2x\pre{ km}

2x km

Answer placeholder strings

<_>

This cannot be done with <symimage> or LaTeX.

\frac{6}{8} = \frac{<_>}{4}
image of equation: 6 divided by 8 = answer box divided by 4

Line breaks

\\

Use \\ instead of <br \>.

Consecutive line breaks are treated as a single line break. To add more vertical spacing, use \vspace.

3x \\ 4y

3x

4y

Line breaks with vertical spacing

\vspace{nem}
\vspace{npx}

Adds a line break with the specified amount of space between the lines.

Do not add a space between the number and the unit.

For on-screen display, ems and pixels are preferred units, but you can also use cm, in, mm, pc, or pt.

3x \vspace{1em} 4y

3x

4y

Addition

+
x + 1

x + 1

Subtraction

-
x - 1

x − 1

Multiplication

*
\times
(implicit)
x * 2
x \times 2
2x

x · 2

x × 2

2x

Division

\div
x \div 2

x ÷ 2

Fractions

\frac{num}{den}

You can put a fraction in the numerator or denominator of another fraction.

\frac{x}{4}
image of fraction: x divided by 4

Binomial

\left(\over{n}{k}\right)
\left(\over{a}{b}\right)
image of binomial: a over b

Combinations, permutations, and isotopes (over/under notation)

\over{top}{bottom}

This is sometimes used with <s:space> in the top or bottom to help vertical alignment.

\left(\over{52}{5}\right) = 
2598960
P\over{10}{3} = 720
\over{233}{91}\pre{Pa}
52 over 5 equals 2598960
p 10 over 3 equals 720
233 over 91 Pa

Exponents (superscripts)

^ (caret)

If the superscript is more than 1 character, enclose it in braces {}.

x^2
x^{12}

x2

x12

Bases (subscripts)

_ (underscore)

If the subscript is more than 1 character, enclose it in braces {}.

x_2
x_{(y + 3)}

x2

x(y + 3)

Parentheses

(arg)
\left[size](
\right[size])

Specify the optional size as an integer from 1 through 9.

(x)
\left[1]( \frac{x}{3} 
\right[1])

(x)

image of fraction surrounded by parentheses

Brackets

[arg]
\left[size][
\right[size]]

Specify the optional size as an integer from 1 through 9.

[x]
\left[1][ \frac{x}{3} 
\right[1]]

[x]

image of fraction surrounded by brackets

Braces

{arg}
\left[size]\{
\right[size]\}

Specify the optional size as an integer from 1 through 9.

{x}
\left[1]\{ \frac{x}{3} 
\right[1]\}

{x}

image of fraction surrounded by braces

Angle brackets

\left[size]<
\right[size]>

Specify the optional size as an integer from 0 through 9.

\left<x\right>
\left[1]< \frac{x}{3} 
\right[1]>
image of x surrounded by angle brackets
image of fraction surrounded by angle brackets

Absolute values (vertical bars)

|arg|
\left[size]|
\right[size]|

Specify the optional size as an integer from 1 through 9.

|x|
\left[1]| \frac{x}{3} 
\right[1]|

|x|

image of fraction surrounded by vertical bars

Magnitude (double vertical bars)

\lleft[size]|
\rright[size]|

Specify the optional size as an integer from 0 through 9.

\lleft[0]|\overrightarrow{v
}\rright[0]|
image of v under a right arrow inside double vertical bars

Greatest integer function (double brackets)

\lleft[size][
\rright[size]]

Specify the optional size as an integer from 1 through 9.

\lleft[x\rright]
image of x inside double brackets

Square root

\sqrt{arg}
\sqrt{size}{arg}

Specify the optional size in positive integers; the height is approximately size lines.

\sqrt{16}
\sqrt{3}{\frac{1}{2}}
square root of 16
square root of one half

Nth root

\sqrt[n]{arg}
\sqrt{size}[n]{arg}

Specify the optional size in positive integers; the height is approximately size lines.

\sqrt[3]{27x}
\sqrt{3}[4]{\frac{x}{81}}
cube root of 27 x
4th root of x divided by 81

Factorial

!
5!

5!

Trigonometry

\sin      \cos      \tan
\arcsin   \arccos   \arctan
\isin     \icos     \itan
\sinh     \cosh     \tanh
\arcsinh  \arccosh  \arctanh
\isinh    \icosh    \itanh
\sec      \csc      \cot
\arcsec   \arccsc   \arccot
\isec     \icsc     \icot
\sech     \csch     \coth
\arcsech  \arccsch  \arccoth
\isech    \icsch    \icoth

\arccos, \arcsin, and so on can be abbreviated like \acos or \asin, but the longer version of the function name is displayed.

\asin x
\cos <s:theta>
\csch a
\tan(45<s:degree>)
\icoth(x)

arcsin x

cos θ

csch a

tan(45°)

coth-1(x)

Exponential function

e^n
e^2

e2

Logarithms

\ln(n)
\log(n)
\log_b(n)
\ln(e^x) = x
\log(1000) = 3
\log_2(128) = 7

ln(ex) = x

log(1000) = 3

log2(128) = 7

Equality

=
a = 2<s:pi>r

a = 2πr

Inequality

>
<
\geq
\leq
\neq
<s:notgreater>
<s:notless>
x > 3
x < 3
x \geq 3
x \leq 3
x \neq 3
x <s:notgreater> 3
x <s:notless> 3

x > 3

x < 3

x ≥ 3

x ≤ 3

x ≠ 3

x not greater than symbol 3

x not less than symbol 3

Approximate

\approx
x \approx 3

x ≈ 3

Plus or minus

\pm
x \pm 3

x ± 3

Minus or plus

\mp
x \mp 3

x minus plus symbol 3

Infinity

\infty
\infty

Greek

<s:letter_name>
<s:pi>

π

Capital Greek

<s:Letter_name>
<s:Omega>

Ω

Arrays

\begin{array}{alignment}
cell & cell \\
cell & cell
\end{array}

For more information, see Create WaTeX Arrays and Matrices.

\begin{array}{rl}
y = & <s:space>3x + 10 \\
2y = & <s:space>4x - 5
\end{array}
y = 3x + 10 followed by 2y = 4x - 5 on the next line. Equations are aligned with the equals sign.

Matrices

\begin{matrix}{alignment}
cell & cell \\
cell & cell
\end{matrix}

For more information, see Create WaTeX Arrays and Matrices.

A = \begin{matrix}{c}{2}
x & y & z\\
a & b & c
\end{matrix}
A = matrix; first row: x, y, z; second row: a, b, c

Determinants

For more information, see Create WaTeX Arrays and Matrices.

\pre{det}(A) = |A|
\left|\begin{array}{c}
a & b \\ c & d
\end{array}\right| = ad - 
bc

det(A) = |A|

determinant of a, b over c, d equals ad minus bc

Ellipses

\ddots
\cdots
\vdots
\iddots
\ldots
\ddots
\cdots
\vdots
\iddots
\ldots
3 dots descending
3 horizontal dots
3 vertical dots
3 dots ascending
3 horizontal dots

Overline

\overline{}
0.\overline{3}

0.3

Indefinite summation

\sum{arg}
\sum{x_i}
sum of x over i

Definite summation

\sum_{lower}^{upper}{arg}
\sum_{i = 0}^{n}{x_i}
sum of x over i from 0 to n

Indefinite integrals

\int{arg}
\int{f(x)dx}
integral of f of x dx

Definite integrals

\int_{lower}^{upper}{arg}
\int_{0}^{1}{\sqrt{x}dx}
integral from 0 to 1 of square root of x dx

Limits

\lim_{lower}{arg}
\lim{}_{lower}
\lim_{n\rightarrow\infty}{x
_n}
\lim{}_{n\rightarrow\infty} 
x_n
limit of x as n approaches infinity
limit of x as n approaches infinity

Right arrows

\rightarrow
\Longrightarrow
\rightarrow
\Longrightarrow

right arrow with two lines

Arrows over notation

\overleftarrow{arg}
\overrightarrow{arg}
\overleftrightarrow{arg}
\overleftarrow{AB}
\overrightarrow{AB}
\overleftrightarrow{AB}
AB with left arrow
AB with right arrow
AB with left-right arrow

Harpoons over notation

\overleftharpoon{arg}
\overrightharpoon{arg}
\overleftrightharpoon{arg}
\overleftharpoon{AB}
\overrightharpoon{AB}
\overleftrightharpoon{AB}
AB with left harpoon
AB with right harpoon
AB with left-right harpoon

Middle dot

\cdot
\cdot

·

Circle

\circ
\circ
open circle

Non-breaking text

\nobr{}
\nobr{1.2 \times 10^2}

1.2 × 102

Italics

\it{}

Not needed in math mode.

text \it{italicized} text

text italicized text

Boldface

\bf{}
\bf{boldface}

boldface

Strikeout

\sout{}
\sout{strikeout}

strikeout

Underline

\uline{}
\uline{underlined}

underlined