Latex Support to publish in html format

The following Latex code does not get recognised by Matlab when trying to publish in html:
\iint_{E}f\left(x,y\right)dxdy
The problem is undoubtedly the double integral; I get the following error: "Unable to interpret Latex string".
Could please someone help me? Why doesn't Matlab recognise this Latex command? It is perfectly fine with:
\int_{E}f\left(x,y\right)dx
Thanks in advance.
Alessio

 采纳的回答

Two workarounds:
1) Use \int\int with negative spaces in between \!\!
text(.5,.5,'$\int\!\!\int_{E} f\left(x,y\right) dxdy$','interpreter','latex')
2) Or integrate your .html with MathJax. Here's the technical solution that explains how: How can I use MathJax to render the LaTeX math in the published output in MATLAB 7.10 (R2010a)?

6 个评论

Thanks it works!!! The problem is that unfortunately Matlab is still complaining. Please, have a look at the attached image.
Which of the solutions have you tried, 1 or 2?
Solution with Mathjax, which works great. Those messages can be replaced by editing the html file using Notepad++ by searching with regular expressions; the error strings are always displayed in the pre tag and therefore removing them is quite easy, using this search command: class="error"[^<>]+</pre>.
Unfortunately, today I wrote another document and the method does not work anymore. I use the correct XSL file but Matlab keep writing that awful html file with images for every formula. Why is it happening? The original file that I used for the forum thread displays correctly, the others don't. I have selected the right XSL file but with no luck.
It is working with just one file, where the output is gorgeous. With all other files, no luck, Matlab keeps writing those awful images for formulas.
I have managed to identify the issue. Formulas that can be interpreted by the standard Matlab latex interpreter are trated as if the custom XSL file did not exist. Whereas, more complex formulas with double integrals for examples, are displayed correctly, if they are in display mode. Finally, MathJax during the export does not allow inline formulas.
The issue still persists. I would love to find a workaround so that I can force it to display using MathJax. Also I believe the ability to display inline Latex using Mathjax is much more important.

请先登录,再进行评论。

更多回答(2 个)

Alessio
The right and left parenthesis are maybe not recognized , try directly this command :
>>text(0.5,0.5,'\int_{E}f ( x,y ) dx dy')

2 个评论

Thanks for your reply! The left and right parenthesis are recognised; the problem is that I would like to use double integrals. For example, event this command would not be recognised:
E=\left\{ \left(x,y\right)\in\mathbb{R}^{2}\,:\,\left(x,y\right)\in\left[-1,1\right]\times\left[-2,2\right]\right\} \subseteq\mathbb{R}^{2}
The problem in the first example is \iint, whereas in the secondo \mathbb{R}, which do not get recongnised. I am sure since removing the two commands solves the issue. The parenthesis are fine.
Do you have any ideas in order to fix this issue?
waiting for an answer, so far you can try :
>>text(x,y,'the expression', 'interpreter','latex');
......

请先登录,再进行评论。

\iint and \mathbb are defined by the AMS packages. Hereford they are not available. There are a number of hack solutions that I have posted, but it is probably best to avoid using anything that is not defined in the LaTeX kernel and article class (note that size commands are not available).

2 个评论

Could you please point me to any of these workarounds? Thank you very much!
I gave an answer a while back on TeX.se http://tex.stackexchange.com/a/98803/10038, but I am telling you the work arounds are hacks. I would just stick with base LaTeX and not use macros that depend on packages.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Adding custom doc 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by