LaTeX valid interpreter error

10 次查看(过去 30 天)
I'm trying to insert this into a figure and Matlab keeps giving me the 'String scalar or character vector must have valid interpreter syntax:' error
text(-8,75,'\[X=x+vt+\frac{1}{2}(at^2)\]','Interpreter','latex','FontSize',7,'FontName','Palentino Linotype','Color','black')
any help would be appreciated
I'm also using the online version of matlab, I don't know if that would make a difference

采纳的回答

andre con
andre con 2021-1-29
Hi Justin,
You could try Latex code between $$. Below I have suggest a code that I have sure that work.
rgds
clc; clear all; close all;
x=0:5
plot(x,x)
text(1,1,'$X=x+vt+\frac{1}{2}(at^2)$','Interpreter','latex','FontSize',20,'FontName','Palentino Linotype','Color','black')
  3 个评论
Walter Roberson
Walter Roberson 2021-1-29
Note: this is not enough to be able to use [ and ] .
Justin Pehrson
Justin Pehrson 2021-1-29
I used an online converter to get the latex format, I didn't need the brackets but they were put there anyways

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2021-1-29
text(-8,75,'$\left[X=x+vt+\frac{1}{2}(at^2)\right]$','Interpreter','latex','FontSize',7,'FontName','Palentino Linotype','Color','black')

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by