Display symbolic vector in LaTeX formulation

11 visualizzazioni (ultimi 30 giorni)
Francesco Porretta
Francesco Porretta il 14 Mag 2021
Modificato: Satyam il 6 Feb 2025 alle 8:57
I have a vector of symbolic elements (like angle "phi').
What I want to do is to see in the command window (or somewhere else) my vector with the LaTeX notation instead of the matlab one. In other words, I want to see in the command window something like the following form:
instead of " cos(psi_R(t)) "
Does someone know how to do?

Risposte (1)

Satyam
Satyam il 6 Feb 2025 alle 8:56
Modificato: Satyam il 6 Feb 2025 alle 8:57
Hi,
You can’t display LaTeX notation on console since it only supports Unicode characters. For more details, you can refer to a related discussion: https://www.mathworks.com/matlabcentral/answers/1904575-is-it-possible-to-display-text-in-the-console-using-latex-expressions
However, you can use LaTeX to format text in ‘plot’, such as axis labels, titles, and annotations. To include LaTeX symbols, set the ‘Interpreter’ property to 'latex'. Here's an example demonstrating how to use LaTeX in an ‘annotation’:
figure;
annotation('textbox', [0.4, 0.5, 0.2, 0.2], 'String', '$\cos(\psi_R(t))$', 'Interpreter', 'latex','EdgeColor', 'none');
In this example, a ‘textbox’ annotation is added to the figure with the LaTeX formatted string ‘$\cos(\psi_R(t))$’. The ‘Interpreter’ property is set to 'latex’ to ensure the text is rendered correctly.
For more information on ‘textbox’ properties, you can refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/matlab.graphics.shape.textbox-properties.html

Categorie

Scopri di più su Labels and Annotations 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