Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can I add normal text as well as Latex symbols on a figure axis?

1 回表示 (過去 30 日間)
Pierson
Pierson 2017 年 10 月 22 日
閉鎖済み: Pierson 2018 年 4 月 16 日
I wanted to implement some latex symbols into my axis, but I'm stuck on how to add normal text to the caption.
Here is what i wanted to do:
str = '$$ Absolute x-acceleration \ddot{x_{A}} [m/s²]$$';
ylabel(str, 'Interpreter','latex');
However, putting normal text between these $ symbols, results in an error. How can I combine the text with the xA symbol (x dubble dotted and A in subscript)
Thanks in advance!

回答 (1 件)

Cedric
Cedric 2017 年 10 月 22 日
編集済み: Cedric 2017 年 10 月 22 日
This is something that I don't fully understand actually, and I'd love to get some explanation from TMW. Some times (maybe on older versions), I had to set the interpreter afterwards. On my 2017b this works:
>> ylabel( '$\mbox{Absolute x-acceleration}~\ddot{x}_{A} [m/s^2]$', 'Interpreter', 'latex' ) ;
but I remember having had to do it in two operations:
>> h_yl = ylabel( '$\mbox{Absolute x-acceleration}~\ddot{x}_{A} [m/s^2]$' ) ;
set( h_yl, 'Interpreter', 'latex' ) ;
If you are in a situation where you leave it enough time generate a warning, you can just start by disabling that warning.
NOTE : in your expression, what was not valild was the superscript ².
  1 件のコメント
Cedric
Cedric 2017 年 10 月 30 日
If this is working for you, please [Accept] this answer. If not, I am happy to discuss what is not working.

Community Treasure Hunt

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

Start Hunting!

Translated by