texlabel - Produce TeX format from character string

Syntax

texlabel(f)
texlabel(f,'literal')

Description

texlabel(f) converts the MATLAB® expression f into the TeX equivalent for use in text strings. It processes Greek variable names (e.g., lambda, delta, etc.) into a string that is displayed as actual Greek letters.

texlabel(f,'literal') prints Greek variable names as literals.

If the string is too long to fit into a figure window, then the center of the expression is replaced with a tilde ellipsis (~~~).

Examples

You can use texlabel as an argument to the title, xlabel, ylabel, zlabel, and text commands. For example,

title(texlabel('sin(sqrt(x^2 + y^2))/sqrt(x^2 + y^2)'))

By default, texlabel translates Greek variable names to the equivalent Greek letter. You can select literal interpretation by including the literal argument. For example, compare these two commands.

text(.5,.5,...
     texlabel('lambda12^(3/2)/pi - pi*delta^(2/3)'))
text(.25,.25,...
     texlabel('lambda12^(3/2)/pi - pi*delta^(2/3)','literal'))

See Also

text, title, xlabel, ylabel, zlabel, the text String property

Annotating Plots for related functions

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS