Rui Nian
Rui Nian

Reputation: 2985

Cannot convert MATLAB y-axis to latex format

I recently started doing some prototyping using MATLAB. I like to make my axises in latex font because it is consistent with the rest of my writing. I used the following code:

figure()
plot(t, y(:, 1), t, y1, '--r')
legend('Transfer Function', 'State Space', 'Interpreter', 'latex');
xlabel('Time, \textit{t} (s)', 'Interpreter', 'latex');
ylabel('%MeOH in Distillate, \textit{X_D} (%)', 'Interpreter', 'latex');

By doing so, I got my x-axis and legend in latex format. However, my y-axis was not in latex format.. I am wondering why this is.

enter image description here

Thanks!

Upvotes: 0

Views: 158

Answers (1)

Sardar Usama
Sardar Usama

Reputation: 19689

You have messed up some LaTeX syntax. See the highlighted changes:

ylabel('\%MeOH in Distillate, \textit{$X_D$} (\%)', 'Interpreter', 'latex');
%       ^                             ^   ^   ^

output

Upvotes: 3

Related Questions