From: Ross Anderson on
I'm trying to produce the following LaTeX in my xlabel:
"\sum\limits_{k_i \ne k_j} \left| k_i - k_j \right|"

This simply fails. Matlab seem unable to interpret \ne as well as \limits_{summation index}

The best I can get is
"\Sigma_{k_i != k_j} | k_i - k_j|"

Does anyone have a more accurate solution?
From: Wayne King on
"Ross Anderson" <rpa5nospam(a)cornell.edu> wrote in message <hs58bt$cd3$1(a)fred.mathworks.com>...
> I'm trying to produce the following LaTeX in my xlabel:
> "\sum\limits_{k_i \ne k_j} \left| k_i - k_j \right|"
>
> This simply fails. Matlab seem unable to interpret \ne as well as \limits_{summation index}
>
> The best I can get is
> "\Sigma_{k_i != k_j} | k_i - k_j|"
>
> Does anyone have a more accurate solution?

Hi, Does this work?, just copy and paste the below in a command window with no figure up. It will put the text in the middle (essentially) of the figure.

text('Interpreter','latex',...
'String','$$\sum_{k_i \neq k_j} |k_i-k_j|$$',...
'Position',[.3 .5],...
'FontSize',16)

You can always adjust to place on x-axis, although I think the default axes will make it difficult to see the limits on the summation. You can always adjust the axes. For example:

% create figure
figure1 = figure;

% Create axes
axes1 = axes('Parent',figure1,...
'Position',[0.13 0.262 0.762 0.663]);

% Create text
text('Parent',axes1,'Interpreter','latex',...
'String','$$\sum_{k_i \neq k_j} |k_i-k_j|$$',...
'Position',[0.377 -0.270 9.160],...
'FontSize',16);

Hope that helps,
Wayne