Here is an example of rendering LaTeX formulas (one hard-coded in the comments, the other as a string in a variable).
%% LaTeX Examples % Below are some equations rendered in LaTeX. % (try to publish this file). % %% The definition of e % Here we use equation embedded in the file. % % $$ e = \sum_{k=0}^\infty {1 \over {k!} } $$ % %% The Laplace transform % Here we render an equation stored in a variable. % % offscreen figure fig = figure('Menubar','none', 'Color','white', ... 'Units','inches', 'Position',[100 100 6 1.5]); axis off str = 'L\{f(t)\} \equiv F(s) = \int_0^\infty\!\!{e^{-st}f(t)dt}'; text(0.5, 0.5, ['$$' str '$$'], 'Interpreter','latex', 'FontSize',28, ... 'HorizontalAlignment','center', 'VerticalAlignment','middle') snapnow close(fig);
Here's what it looks like when a file is published as HTML:

You can transfer this last code to the render_latex_string(str) helper function and call it from different places.
Amro
source share