如何使用Latex Interpretation将变量传递到我的标题中?

use*_*497 5 matlab

我想要一些参数值出现在我的图片(subplot(3,2,1))中白框的位置.如果解释title()可能是乳胶,就像其他人一样,那将是理想的.

我尝试过以下方法:

title( sprintf( ' $\delta$ = %s  $\rho$ = %s  $\xi$ = %s  m =  %s', delta, rho, xi, m), 'Interpreter', 'latex') 
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

Warning: Control Character '\d' is not valid. See 'doc sprintf' for control characters valid in the format string. 
> In SIXY_sol (line 21) 
Warning: Error updating Text.

 String must have valid interpreter syntax:
 $
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

在此输入图像描述

Dan*_*Dan 7

这不是使用LaTeX解释器的问题,而是使用您使用的方式sprintf.在文档中sprintf,向下滚动到格式化操作符之前或之后的文本部分.在这里,您将看到该\字符用于开始转义序列,以便您可以执行\n新行等操作.您实际上希望\出现在字符串中,因此您需要转义转义字符.从文档该表需要更换所有的\\\.

尝试:

title( sprintf( ' $\\delta$ = %s  $\\rho$ = %s  $\\xi$ = %s  m =  %s', delta, rho, xi, m), 'Interpreter', 'latex') 
Run Code Online (Sandbox Code Playgroud)