plotly / plotly/plotly_matlab

Latex math in html file not rendering in browser

Open
#481 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MATLAB
Stars
413
Forks
166
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided MATLAB script and its fig2plotly(gcf) export, then inspect the generated HTML in Edge alongside the MATLAB figure. Done means the exported HTML renders the LaTeX annotation correctly in Edge; the issue names no repository file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.