You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would really appreciate a full code example, but i managed latex output to work in principle.
The problem is MathJax (the tex rendering engine used in plotly tex examples) not being referenced in our HTML scaffold. For a workaround until this is properly implemented, add these script tags to the html:
Additionally, as tex uses a lot of \ characters, your tex strings should be escaped using @:
[
Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")]|> Chart.Combine
|> Chart.Show
Which will then look like this:
From our side it is most likely the best to set this on the Config level of GenericChart, providing a Chart.withMathTex function indicating that the mathtex script should be contained in the html scaffold.
@kMutagene
I kind of understand, so this generally means that until the official support is established, We have to change the source code of Plotly.NET or manually add
or manually add [script tags]
to the chart which might be too complicated since no API in GenericChart supports directly adding these script tags. Am I right?
I can think of two workarounds that might work for you in the meantime:
The output of Chart.Show is a html text file like any other, so you can open the files programmatically and add those lines.
The GenericChart.toChartHTML returns the contents of that file as a string, so you can add these lines there and then write the content to a file like this:
[
Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")]|> Chart.Combine
|> Chart.toChartHTML
|> `add the missing lines`
|> `write to a .html file`
So temporarily solution is to change the HTML directly through adding these lines.
In the long term, wait for the API change in MathJAX.
Thanks for your help!
Activity
kMutagene commentedon Apr 13, 2021
Hi @Wongboo
I would really appreciate a full code example, but i managed latex output to work in principle.
The problem is MathJax (the tex rendering engine used in plotly tex examples) not being referenced in our HTML scaffold. For a workaround until this is properly implemented, add these script tags to the html:
Additionally, as tex uses a lot of
\characters, your tex strings should be escaped using@:Which will then look like this:
From our side it is most likely the best to set this on the
Configlevel ofGenericChart, providing aChart.withMathTexfunction indicating that the mathtex script should be contained in the html scaffold.wang-jinbo commentedon Apr 13, 2021
@kMutagene
I kind of understand, so this generally means that until the official support is established, We have to change the source code of
Plotly.NETor manually addto the chart which might be too complicated since no
APIinGenericChartsupports directly adding these script tags. Am I right?kMutagene commentedon Apr 13, 2021
I can think of two workarounds that might work for you in the meantime:
The output of
Chart.Showis a html text file like any other, so you can open the files programmatically and add those lines.The
GenericChart.toChartHTMLreturns the contents of that file as a string, so you can add these lines there and then write the content to a file like this:wang-jinbo commentedon Apr 13, 2021
So temporarily solution is to change the HTML directly through adding these lines.
In the long term, wait for the
APIchange inMathJAX.Thanks for your help!
kMutagene commentedon Apr 13, 2021
Exactly, i don't imagine this feature taking too long to implement though
#72 (WIP): Add DisplayOptions type to transport various html replacem…
kMutagene commentedon Apr 14, 2021
@Wongboo Watch out for the next release, you will be able to use
Chart.WithMathTex: