plotly/plotly_matlab

Latex math in html file not rendering in browser

syncrodazt opened this issue · 1 comments

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

I have this problem too. I posted a question on matlab answers. https://www.mathworks.com/matlabcentral/answers/2042006-how-to-get-latex-to-render-when-using-fig2plotly. Crosslinking here so somebody who finds one finds the other.