Format text into TeX string


  • TeXString = texlabel(f) example
  • TeXString = texlabel(f,'literal') example



TeXString = texlabel(f) converts the MATLAB® expression f into the TeX equivalent for use in text strings. texlabel converts Greek variable names (for example, lambda, delta, and so on) into a string that is displayed as Greek letters. The TeXString output is useful as an argument to annotation functions such as title, xlabel, and text.

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


TeXString = texlabel(f,'literal') interprets Greek variable names literally.


expand all

Insert TeX String in Figure

Create a figure and a TeX string for use in a text graphics object.

TeXString = texlabel('lambda12^(3/2)/pi - pi*delta^(2/3)');

Add a text object containing the TeX string to the figure.


If you include the 'literal' argument, texlabel interprets Greek variable names literally. Add a text object containing the literal string.

text(4,60,texlabel('lambda12^(3/2)/pi - pi*delta^(2/3)','literal'))

Input Arguments

expand all

f — Input MATLAB expressionstring

Input MATLAB expression, specified as a string.

Example: 'theta (degrees)'

Data Types: char

See Also

| | | |

Was this topic helpful?