You might not have noticed it, but you get an warning message in the command prompt:
Warning: Unable to interpret TeX string
which tells you that MATLAB has trouble parsing your LaTeX expression. More specifically, the blackboard bold math font (indicated by the '\mathbb'
) is not supported by MATLAB’s built-in LaTeX interpreter (it requires the amsmath package).
One way to install this package is described here and here. I’ll summarize it for you:
-
Download the AMS-LaTeX package from here.
-
Modify the m-file
tex.m
, which is located in theMATLAB root\toolbox\matlab\graphics
folder (backup the file before modifying it):2.1. In the
localDecorateInputString
function, modifystandardhead
to include the new packages (marked in bold):
standardhead = [' \nofiles \documentclass{mwarticle} \usepackage{amsfonts, amsbsy, amssymb} \begin{document}']
2.2. In the `localGetTeXPath` function, add the paths of where the AMS package files are located (marked in bold), for instance:
texpath{1} = blah blah blah...
texpath{end+1} = blah blah blah...
texpath{end+1} = 'C:\amslatex';
-
Copy all
.sty
files of the AMS package to theMATLAB root\sys\tex
folder. -
Restart MATLAB.
You should now have the necessary LaTeX font packages installed. I would’ve gladly checked it out myself if time allowed, it seems promising.