Display symbolic vector in LaTeX formulation

11 views (last 30 days)
Francesco Porretta
Francesco Porretta on 14 May 2021
Edited: Satyam on 6 Feb 2025 at 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?

Answers (1)

Satyam
Satyam on 6 Feb 2025 at 8:56
Edited: Satyam on 6 Feb 2025 at 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

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!