Issue
I want to use subscript notation for Julia in Jupyter notebook.
In IJulia I can write a\_1<TAB>
to get a₁. In Jupyter notebook a\_m<TAB>
delivers aₘ but a\_1<TAB>
doesn't work. Is there any chance to have variables with subscript numbers?
EDIT:
For me it doesn't work. Only single characters can be subscript, i.e. no numbers, special characters or more than one character. Windows 10, Google Chrome and
Solution
Answer after question edit
There are two important things to know about Jupyter: There's a server, which basically runs the actual web page, file handling, and stuff like that; and then there's the kernel, which does the actual computation. So, for example, everything you actually type into a cell should be in the language of the kernel.
The server will always be some version of python, but the kernel can be practically anything at this point — python, julia, R, or any from a long list of others. When you evaluate a cell, behind the scenes it's python taking that code, sending it to the kernel, and then writing the output back to the web page. But normally, you shouldn't need to think about this at all.
Tab completion ties into the kernel, meaning that the language used for the kernel determines what can be tab completed. From the screenshot in the edited question, we can see that the kernel is actually python, which doesn't allow subscripted numerals.
To switch to the julia kernel, go up to the notebook's toolbar and select "Kernel" > "Change kernel" > "Julia [something]". If Julia isn't one of the options, you need to install it with IJulia, and probably refresh the notebook's web page.
It's also possible for Jupyter to get confused about which kernel it's on. This is a bug that I've come across when switching kernels. Try starting a new notebook with the Julia kernel via "File" > "New Notebook" > "Julia [something]".
It takes a little longer for the Julia kernel to start up than a python kernel, but once it says "Kernel ready", you should be able to get tab completion.
Older answer
a\_1<TAB>
works for me. I do find Jupyter buggy, so sometimes I have to wait a little for TAB to do anything. Also, if there's anything following the text I'm trying to tab-complete, it frequently doesn't work at all. But it's definitely possible.
In fact, all the numbers should work, along with ()+-=
, quite a few lowercase Latin letters, a few lowercase Greek letters, and schwa. Not all subscripted characters work, of course, because they don't exist in Unicode, for some reason.
Answered By - Mike
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.