Display Math Notation with HTML Substitution

WebAssign provides several special tags that allow you to render specific kinds of notation using HTML substitution. Like WaTeX — and unlike LaTeX or <symimage> markup — you can include answer boxes in your formatted notation. Using HTML substitution is often simpler than using WaTeX, but its functionality is also much more limited than WaTeX.

Note
  • You cannot use HTML substitution tags inside of other HTML substitution tags, WaTeX, LaTeX, or <symimage> markup.
  • You cannot use WaTeX, LaTeX, or <symimage> markup inside of HTML substitution tags.

HTML Substitution Tags for Math

Six tags are provided for displaying math notation using HTML substitution. Inside each of these tags, you can use the math notation described in Notation That Can Be Used in HTML Substitution Tags for Math.

Expression

Code

Example

Display

General math

<h:math>markup</h:math>
<h:math> $a x^2 
</h:math>

9x2

Fractions

<h:frac> n='numerator' d='denominator' 
</h:frac>

Use WaTeX to display a fraction in the numerator or denominator of another fraction or under a square root.

<h:frac> 
n='x^2' d='x+$
a' </h:frac>
x 2 x + 9

Square roots

<h:sqrt>markup</h:sqrt>
<h:sqrt> x + 6 
</h:sqrt>
x + 6

Matrices

<h:matrix>
cell | cell ; cell | cell 
</h:matrix>

Use | to separate columns and ; to indicate the end of a row. Ensure that there is a space between the contents of a cell and the | or ; delimiters.

<h:matrix> 
a | b | c ; d | e | f 
</h:matrix>
a b c d e f

Determinants

<h:determinant> 
cell | cell ; cell | cell 
</h:determinant>

Use | to separate columns and ; to indicate the end of a row. Ensure that there is a space between the contents of a cell and the | or ; delimiters.

<h:determinant> 
$a | b ; c | d 
</h:determinan
t>
3 b c d

Long division

<h:longdiv> divisor | dividend 
</h:longdiv>
<h:longdiv> 
x+5 | x^2+6x+5 
</h:longdiv>
x+5 x2+6x+5

Notation That Can Be Used in HTML Substitution Tags for Math

Except where noted, you can use all of the notation in the following table in each of the HTML substitution tags for displaying math notation. Math variables are automatically italicized. You can also use any of the <s> tags described in .

Expression

Code

Example

Display

Perl variables

$variable
${variable}
<EQN $variable>

Use braces or add a space after each variable name to distinguish it from other text. Do not use the lowercase <eqn> tag.

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

9x + 1
9x + 1
9x + 1

Addition

+
x + 1

x + 1

Subtraction

-
x - 1

x − 1

Multiplication

*
times
cross
(implicit)
x * 2
x times 2
x cross 2
2x

x · 2
x × 2
x × 2
2x

Division

divide
/
x divide 2
x / 2

x ÷ 2
x / 2

Exponents (superscripts)

^ (caret)

If the superscript is more than a single number or a single variable, enclose it in parentheses.

x^2
x^(2y)

x2
x2y

Bases (subscripts)

_ (underscore)

If the subscript is more than a single number or a single variable, enclose it in parentheses.

x_2
x_((y + 3))

x2
x(y + 3)

Parentheses

()

In cases where a set of parentheses is required to format notation, such as with exponents, use two pairs of parentheses to explicitly display the parentheses.

4(x+1)
x_((y + 3))

4(x + 1)
x(y + 3)

Absolute value

|arg|
abs(arg)

You cannot use vertical bars to specify absolute values in in the <h:longdiv> tag.

|x|
abs(x)

|x| abs(x)

Square root

sqrt(arg)

You cannot use sqrt() in the <h:sqrt> or <h:longdiv> tags.

x + sqrt(y+3)
x + y + 3

Factorial

!

5!

5!

Trigonometry

sin      cos      tan
arcsin   arccos   arctan
sinh     cosh     tanh
arcsinh  arccosh  arctanh
sec      csc      cot
arcsec   arccsc   arccot
sech     csch     coth
arcsech  arccsch  arccoth

When arccos, arcsin, and so on are abbreviated like acos or asin, the function is displayed using exponential notation, like sin-1x.

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

sin-1x
cosθ
csch a
tan(45°)

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 pi r

a = 2πr

Inequality

>
<
>=
<=
!=
x > 3
x < 3
x >= 3
x <= 3
x != 3

x > 3
x < 3
x ≥ 3
x ≤ 3
x ≠ 3

Approximate

~=
x ~= 3

x ≈ 3

Infinity

infinity
infinity

Greek

Type the name of lowercase Greek letters in lowercase. Type the names of uppercase Greek letters in proper case.

pi
Omega

π
Ω