Error with latex interpreter and text function

32 ビュー (過去 30 日間)
Aaron Anderson
Aaron Anderson 2016 年 10 月 19 日
回答済み: Pietro Iob 2020 年 1 月 10 日
I'm not sure, but I think my issue might stem from my use of
set(0,'defaulttextinterpreter','latex')
so that I don't have to put latex as the interpreter for all my titles and axis labels, and the use of the text() function. Basically, when I try to use text(), and do a \leftarrow, for example:
text(x,y,'\leftarrow thistext')
I get the following error
Warning: Error updating Text.
Character vector must have valid interpreter syntax:
\leftarrow thistext
Then I read about it a bit and I thought maybe it had to do with the use of my \ and it already being in latex mode or something. So I tried \\ instead of \ in front of my leftarrow. This worked, however it just reads "leftarrow thistext" in latex format. I should note that when I don't do \\ I get "\leftarrow thistext" but in non-latex font where I put the location. Does anyone know how to get around this? I like latex font a lot, and I also like left arrows. Can I not have the best of both worlds here?
Thanks, Aaron

採用された回答

dpb
dpb 2016 年 10 月 20 日
Try
text(x,y,'$\leftarrow$ thistext');
  2 件のコメント
Aaron Anderson
Aaron Anderson 2016 年 10 月 20 日
Nice! I don't really know why I didn't consider that..
dpb
dpb 2016 年 10 月 21 日
Well, if you would've, you know far more of LaTex than I do... :) I Gargled it and found a posting that happens to work in Matlab. I've found all kinds of similar things that apparently work with some releases but that could never get to transfer over to Matlab's version, too, otoh.

サインインしてコメントする。

その他の回答 (1 件)

Pietro Iob
Pietro Iob 2020 年 1 月 10 日
title('$\mathcal{M}_1(\theta)$', 'Interpreter', 'latex')
Same problem with this line of code. The title is written in a correct way, but I recive this warning
String scalar or character vector must have valid interpreter syntax:
$\mathcal{M}_1(\theta)$

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by