Question

I am trying to add a LaTeX annotation to a figure in MATLAB, but I'm running in to some problems. If I run

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

I would expect an arrow with the correct annotation. That is indeed what I get, but I also receive the following warning messages:

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 

So, my question is, why do I get these warnings, and how do I correct the underlying problem?

Was it helpful?

Solution

All you need to do is specify the interpreter before the string. This works

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

And also you need the long name interpreter instead of its abbreviation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top