필터 지우기
필터 지우기

Is it possible to display text in the console using latex expressions ?

조회 수: 99 (최근 30일)
Matt
Matt 2023년 2월 1일
댓글: Matt 2023년 2월 6일
Hello,
I would like to display in the console grec letters using the latex syntaxe. Is there a way do this ?
For exemple I can do this with the title() function :
title('\theta_{\lambda/4}=20°')
But
disp('\theta_{\lambda/4}=20°')
displays literally \theta_{\lambda/4}.
I saw that disp('λ') works but you need to ctrl c - ctrl v the λ from somewhere to do so. Since latex interpretation works in title() I guess there must be a way to write latex in a prompt.
Thank you
  댓글 수: 6
Matt
Matt 2023년 2월 6일
Hello,
Yes : in this case the debugging is about checking if formulas have been correclty implemented in the code and not finding mistakes that generates matlab errors. To do so I manually run the program with different options and check if the resultats are realistic.
For this using disp (as well as plots/imagesc etc) to monitor if variables that have a physical meaning behave as they should well is convenient.
I accepted Jan answer on why it not possible/good practice and did a small function that transforms a '\{greek letter}' is the corresponding letter using the answer you pointed.
Thanks Lorenzo.
Matt
Matt 2023년 2월 6일
Hello,
Yes : in this case the debugging is about checking if formulas have been correclty implemented in the code and not finding mistakes that generates matlab errors. To do so I manually run the program with different options and check if the resultats are realistic.
For this using disp (as well as plots/imagesc etc) to monitor if variables that have a physical meaning behave as they should well is convenient.
I accepted Jan answer on why it not possible/good practice and did a small function that transforms a '\{greek letter}' is the corresponding letter using the answer you pointed.
Thanks Lorenzo.

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

채택된 답변

Jan
Jan 2023년 2월 1일
편집: Jan 2023년 2월 1일
LaTeX is not an option in the command window.
Using Unicode characters works for some fonts, but fails with other font. The result of a debugging should not depend on the font used in the command window, so I would avoid such fancy tricks.
  댓글 수: 1
Matt
Matt 2023년 2월 6일
Indeed I tried this and exotic fonts transforms greek letters in weird shapes. But the usual ones ( liberation XX, Times new roman etc) are fine.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by