Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# latex

LaTeX representation of symbolic expression

latex(S)

## Description

latex(S) returns the LaTeX representation of the symbolic expression S.

## Examples

The statements

syms x
f = taylor(log(1+x));
latex(f)

return

ans =
\frac{x^5}{5} - \frac{x^4}{4} + \frac{x^3}{3} - \frac{x^2}{2} + x

The statements

H = sym(hilb(3));
latex(H)

return

ans =
\left(\begin{array}{ccc} 1 & \frac{1}{2} & \frac{1}{3}\\...
\frac{1}{2} & \frac{1}{3} & \frac{1}{4}\\...
\frac{1}{3} & \frac{1}{4} & \frac{1}{5} \end{array}\right)

The statements

syms t;
alpha = sym('alpha');
A = [alpha t alpha*t];
latex(A)

return

ans =
\left(\begin{array}{ccc} \mathrm{alpha} & t & \mathrm{alpha}\, t...
\end{array}\right)

You can use the latex command to annotate graphs:

syms x
f = taylor(log(1+x));
ezplot(f)
hold on
title(['$' latex(f) '$'],'interpreter','latex')
hold off

## See Also

Was this topic helpful?