【问题标题】:LaTeX annotation in MATLABMATLAB 中的 LaTeX 注释
【发布时间】:2014-03-14 15:59:37
【问题描述】:

我正在尝试向 MATLAB 中的图形添加 LaTeX 注释,但遇到了一些问题。如果我跑

figure
annotation('textarrow', [0.3, 0.6], [0.3, 0.6], 'String', '$$\tau_{\mathrm{abc}}$$', 'interp', 'latex')

我希望有一个带有正确注释的箭头。这确实是我得到的,但我也收到以下警告消息:

Warning: Unable to interpret TeX string "$$\tau_{\mathrm{abc}}$$" 
> In scribe.textarrow.createTextArrow>localChangePosition at 409
  In scribe.textarrow.schema>localSetToText at 357
  In scribe.textarrow.createTextArrow at 152
  In scribe.textarrow.textarrow at 11
  In annotation at 149 
Warning: incomplete command in TeX text string:
'$$\tau_{\mathrm{abc}}$$' 
> In scribe.textarrow.createTextArrow>localChangePosition at 409
  In scribe.textarrow.schema>localSetToText at 357
  In scribe.textarrow.createTextArrow at 152
  In scribe.textarrow.textarrow at 11
  In annotation at 149 

所以,我的问题是,为什么我会收到这些警告,以及如何纠正根本问题?

【问题讨论】:

  • 看起来 Matlab 不喜欢 "\mathrm"。没有那个就不会出现警告
  • 是的。但是,\mathrm 在技术上应该适用于 MATLAB。此外,如果我用\mathrm 替换\frac 等其他内容,我也会收到警告。
  • @riklund:也许可以试试$\tau_{\rm abc}$
  • @Werner,这也会发出警告(而且它不会在图表上生成正确的文本)。
  • 个人意见,在 Matlab 上用 LaTex 苦苦挣扎之后,还是使用 Tex。你几乎可以用它做任何事情,它使用公认的语法,而不是使用 Matlab 改编的混乱语法。

标签: matlab latex


【解决方案1】:

您需要做的就是在字符串之前指定解释器。 这行得通

annotation('textarrow', [0.3, 0.6], [0.3, 0.6], 'interpreter', 'latex', 'String', '$$\tau_{\mathrm{abc}}$$')

您还需要长名称解释器而不是其缩写。

【讨论】:

    猜你喜欢
    • 2010-10-20
    • 1970-01-01
    • 2020-12-06
    • 2013-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-28
    • 1970-01-01
    相关资源
    最近更新 更多