Latex expression in Matlab Report Generator

조회 수: 18 (최근 30일)
Silvia Butti
Silvia Butti 2017년 6월 29일
답변: Sameer 2024년 8월 12일
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
Marc Compere
Marc Compere 2024년 4월 7일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sameer
Sameer 2024년 8월 12일
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

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by