Autocompleting in Emacs adds ^M after having used octave plot command - emacs

I use M-x run-octave to trigger octave in emacs, everything works fine until I plot something, after that hit Tab would complete my input (say plo -> plot) but there is an annoying ^M in the end. So awg then hit Tab would get awgn ^M.
Does someone have a similar problem or any suggestion?

The real fix would be to be able to tell Octave to DTRT.
Try setting the buffer's end-of-line behavior, using C-x RET f and then specifying dos. If that works it's only because the ^M chars are then hidden. IOW, it's a workaround. Unless, that is, Octave is just doing the wrong thing because it doesn't bother to check the buffer eol setting. Consider also filing an Octave bug.

Related

How can I write with latex character in xlabel in matlab

I would write my xlabel with Latec character so I used this code
x = -10:0.1:10;
y = [sin(x); cos(x)];
plot(x,y)
xlabel('$\mathbb{x}$','Interpreter','latex')
but I have this warning message
Warning: Error updating Text.
String scalar or character vector must have valid interpreter syntax:
$\mathbb{x}$
and the xlabel appear like this
https://i.stack.imgur.com/NCI4n.png
please how I can fix this problem.
The problem with your example is the mathbb command, which is not in base Latex. To show this, replace the \mathbb with, e.g., \mathrm. This will work.
I've never seen an example of adding Latex packages into the Matlab environment. (Update below)
You can have a look at this question, which includes a very aggressive potential way to add the package you need. But it's not clear to me if the solution proposed is actually functional.
How do you use the LaTeX blackboard font in MATLAB?

Is there already any functions operates on latex equations mathematically in Emacs?

I have been thinking on editing latex equations mathematically in emacs:
Select current math term, shift it left and right, even across a "=" and changing signs. Terms are defined by "+" and "-" and other defined delimeters.
e.g. \alpha \bm{x} - 3\bm{y} = 10t, place cursor on "3" and call a function, the -3\bm{y} is selected. Call another function can change the equation to -3\bm{y}+\alpha\bm{x}=10t or \alpha \bm{x}=10t+3\bm{y}
Put coefficients into brackets, and even collect coefficients out.
e.g. With a function call can change 2(x+y) to (2x+2y).
Select current macro under cursor, copy the euqation from previous "=" or from a previous label.
The list goes on....
I have been using AUCTeX, CDLaTeX and RefTeX but up till now I do not know any functions already exists that can reach the effects above. So I want to ask if anyone knows an existing package in emacs can do these? If not, I am planning to elisp them myself

Surface plot with LaTeX code in label

I would like to use the Letter μ (LaTeX: \mu) in my surface plot. Unfortunately when I use the LaTeX symbol \mu in the zlabel('Power [\muW]'); command it results in:
'Power [ μ W]' instead of 'Power [μW]'
How can I avoid these spaces around μ?
I can't reproduce your problem, which could be due to you using an older version of Matlab. In the past it was neccesary to set the latex interpreter fist, before using Latex syntax. So the following should work:
zlabel('Power [$$\mu$$W]','interpreter','latex');
Nowadays it seems to recognize automatically at least greek letters.

MATLAB: F1 help function in Editor refers to a wrong function

I am using MATLAB 2014b.
If I write a line like
A = regexp(strcat('some string'),expression);
Placing the cursor on the first function (here regexp) lets me get the content help of it by pressing F1.
If I now move the cursor to strcat I also get the content help of regexp. This is just an example; the same problem happens for every function.
In MATLAB 2012b, I get the correct behavior. How can I make MATLAB 2014b act the same way?
Note: If I highlight the function name and press F1, I'll get the right content help. But this is just a workaround.
I don't have MATLAB 2012b to test on right now and I'm running 2015a, but I feel it might be an issue with your test case. Try putting the cursor within the brackets that the function is called with. Let me know if it works in 2014b!
regexp help:
strcat help:

matlab's phi symbol

Not that significant, but annoying to no end. Why does matlab has no small phi (\varphi) symbol ? It has pretty much all other symbols LaTeX offers, but not this one. Why ?
I may be wrong of course, in which case would be delighted if someone could prove me wrong...
The default interpreter is TeX actually, not LaTeX, which is why you're having this problem. You can use LaTeX as the interpreter for a given part doing something like this:
plot(1);
hl = legend('$$\varphi$$');
set(hl,'Interpreter','latex')
or you can set LaTeX as your default interpretor using
set(0,'DefaultTextInterpreter', 'latex');
which can be put in your startup.m file if you like.
Matlab uses TeX as default. Often, it is possible to switch to LaTeX, but in some cases (dialog boxes), this is impossible.
%# here's an example with all three phis
plot(rand(3))
yh = get(gca,'YLabel');
set(yh,'Interpreter','latex','string','$\varphi$ $\phi$ $\Phi$')