Latex expression in Matlab Report Generator
16 views (last 30 days)
Show older comments
I am generating a report of my work using the Matlab Report Generator. I would like to insert some LaTeX expressions within a text paragraph, however I cannot find a way to do it. I have already tried to generate an image but it does not look proper. Is there a more direct way to do this? Thank you!
1 Comment
Marc Compere
on 7 Apr 2024
I'm interested in this as well. The Matlab Report Generator is great, but latex superscript, subscripts, and greek characters would sure make it better.
Answers (1)
Sameer
on 12 Aug 2024
Hi Silvia
From my understanding, you want to insert LaTeX expressions within a text paragraph in your MATLAB report using the “MATLAB Report Generator”.
This can be achieved using the “mlreportgen.report.Equation” class, which allows you to include LaTeX equations directly in the report.
Below is an example implementation:
import mlreportgen.report.*
% Create the report and chapter
% Add an equation as a separate line in the chapter
rpt = Report('equation','docx');
ch = Chapter(Title='Equation');
add(ch,Equation('\int_{0}^{2} x^2\sin(x) dx'));
add(ch,Equation('E = mc^2'));
add(ch,Equation('\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}'));
add(ch,Equation('a^2 + b^2 = c^2'));
add(ch,Equation('\frac{d}{dx} e^x = e^x'));
add(rpt,ch);
% Close and view the report.
close(rpt);
rptview(rpt);
For more information, please refer to the link below:
I hope this helps!
Sameer
0 Comments
See Also
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!