Graphics |
Mathematical Symbols, Greek Letters, and TEX Characters
You can include mathematical symbols and Greek letters in text using TEX-style character sequences. This section describes how to construct a TEX character sequence.
Two Levels of TEX Support
MATLAB provides two levels of TEX support, controlled by the text Interpreter
property.
tex
-- Support for a subset of TEX markup
latex
-- Support TEX and LaTEX markup
If you do not want the characters interpreted as TEX markup, then set the interpreter
property to none
.
Available Symbols and Greek Letters
For a list of symbols and the character sequences used to define them, see the table of available TEX characters in the Text Properties reference page.
In general, you can define text that includes symbols and Greek letters using the text
function, assigning the character sequence to the String
property of text objects. You can also include these character sequences in the string arguments of the title
, xlabel
, ylabel
, and zlabel
commands.
Example -- Using a Mathematical Expression to Title a Graph
This example uses TEX character sequences to create graph labels. The following statements add a title and x- and y-axis labels to an existing graph.
title('{\itAe}^{-\alpha\itt}sin\beta{\itt} \alpha<<\beta') xlabel('Time \musec.') ylabel('Amplitude')
The backslash character (\) precedes all TEX character sequences. Looking at the string defining the title illustrates how to use these characters.
Controlling the Interpretation of TEX Characters
The text Interpreter
property controls the interpretation of TEX characters. If you set this property to
none
, MATLAB interprets the special characters literally.
Editing Text Objects | Using Character and Numeric Variables in Text |
© 1994-2005 The MathWorks, Inc.