MATLAB: Using $\textit{w}$ in legend

figureMATLAB

I have an existing figure that I want to use this term $\textit{w} = 0$ in its legend. I'm setting the latex interpreter using set(findall(gcf,'defaulttextInterpreter','latex ')) but I keep getting this error Warning: Unable to interpret TeX string "$\textit{w}$ = 1,k=1" any help would be appreciated.

Best Answer

Try setting the interpreter directly,
set( legend('$\textit{w}$ = 1,k=1') , 'Interpreter','latex');
Related Question