Skip to content

Latex math in html file not rendering in browser #481

Open
@syncrodazt

Description

@syncrodazt

I have a problem with displaying LaTeX fonts in HTML files generated by MATLAB. I used the code from this link to create a simple plot with LaTeX annotations. The plot looks fine in MATLAB, but when I open the HTML file in Edge, the Latex fonts are not rendered correctly. How can I fix this issue?

The code

fib = zeros(1, 12);
for i = 1:12
    fib(i) = (((1+sqrt(5))/2)^i - ((1-sqrt(5))/2)^i)/sqrt(5);
end

figure
plot(1:12, fib, 'k^-')


title('Fibonacci Numbers from 1-12')
xlabel('n')
ylabel('F_n')

eqtext = '$$F_n={1 \over \sqrt{5}}';
eqtext = [eqtext '\left[\left({1+\sqrt{5}\over 2}\right)^n -'];
eqtext = [eqtext '\left({1-\sqrt{5}\over 2}\right)^n\right]$$'];

text(0.5, 125, eqtext, 'Interpreter', 'Latex', 'FontSize', 12, 'Color', 'k')

fig2plotly(gcf);

MATLAB Figure

image

Figure opened in Edge

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions