Latex expression in Matlab Report Generator

16 visualizzazioni (ultimi 30 giorni)
Silvia Butti
Silvia Butti il 29 Giu 2017
Risposto: Sameer il 12 Ago 2024
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 Commento
Marc Compere
Marc Compere il 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.

Accedi per commentare.

Risposte (1)

Sameer
Sameer il 12 Ago 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

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by