%% Create Text with LaTeX
% By default, MATLAB interprets text using TeX markup. However, for more formatting options, you can use LaTeX markup instead.
% For example, plot y = x^2\sin(x) and draw a vertical line at x = 2. Add text to the graph that contains an integral expression using LaTeX markup. To show the expression in display mode, surround the markup with double dollar signs ($$). When you call the text function, set the Interpreter property to 'latex'.

x = linspace(0,3);
y = x.^2.*sin(x);
plot(x,y)
line([2,2],[0,2^2*sin(2)])

str = '$$ \int_{0}^{2} x^2\sin(x) dx $$';
text(1.1,0.5,str,'Interpreter','latex')

% Copyright 2015 The MathWorks, Inc.