How to include latex code in Matlab live script
456 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ABDULAZIZ ALTUN
el 10 de Mzo. de 2020
Comentada: Julian Rene Cuellar Buritica
el 25 de Oct. de 2024 a las 17:23
I am new to matlab live script and I have a latex file that I whish to include in the mlx file using text or code
My latex code is
Denote the low-frequency monthly stocks ($(N+1)\times 1$) vector$Y_{lf}$ \
by:
\[
Y_{lf}=\left[
\begin{array}{ccccc}
S_{f_{0}} & S_{f_{1}} & S_{f_{2}} & \cdots & S_{f_{N}}%
\end{array}%
\right] ^{\prime }
\]%
where
\[
f_{j}=f_{j-1}+\kappa _{j}=\sum_{i=0}^{j}\kappa _{i},
\]%
$\kappa _{j}$ is the number of days in a month $j$. For example, if $j=0$
represents january 1999 this mean that there is $\kappa _{0}=29$ trading
days in this month.
I want to take this code and past it into the mlx but to be seen as a read not in this code style.
As you can see this has been done by copying and pasting but I was doing everytime α is not easily translated from the codes.
Can someone help in this regards?
1 comentario
Julian Rene Cuellar Buritica
el 25 de Oct. de 2024 a las 17:23
It seems there is people still looking for this, like me who want to print a nice integral on a live script.
This is the trick I used:
str = '$$ \int_{0}^{3} \frac{v+5}{144} dv $$'; % Create latex string
hh=figure(Position=[0,0,120,50]); % create s figure and control its size
text(0,0.2,str,'Interpreter','latex') % play around with the location of your equation
axis off % don't display figure axis
I got this output:
I hope this helps.
Respuestas (2)
Sahithi Metpalli
el 13 de Mzo. de 2020
Hi,
To Insert the Latex Equation
Go to the Insert tab, click Equation and select LaTeX Equation. The following window appears
Enter the equation and preview it, then click ok to insert in live script.
3 comentarios
Sahithi Metpalli
el 23 de Mzo. de 2020
Hi,
You can even add text in the equation field.Make sure that the syntax for the latex code is right.Follow the link https://www.mathworks.com/help/matlab/matlab_prog/insert-equations.html to know more details.
Walter Roberson
el 24 de Mzo. de 2020
Notice that the user has text outside of any $ area. Insert Latex does not appear to handle that -- not unless possibly if the user deliberately inserts extra $ to drop out of math mode.
Walter Roberson
el 21 de Mzo. de 2020
Unless I have missed something in R2020a, there is no way to compute something (such as by reading it in) and have it processed as latex in Live Script presentation -- only in graphics.
The package that does permit computation (such as I/O) leading to display of Latex is Report Generator.
0 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!