Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

For the command autocompletion, I can simply use Ctrk+K and then use Return or Tab to choose the completion. But when I want to autocomplete the local variables I have input, Ctrk+K works, but both Return and Tab fail to input the variable's name. I have tried to change this behavior with the Interface panel of the Preferences dialog , but there are no options I can change. Do you know some easy to make Return and Tab work for local variable autocompletion?

share|improve this question
I have Mathematica version 9.0.1 on OS X 10.9.1, and I find that autocompletion of local variables works when I have the notebook's default context set to be Global, but not when it is set to be Unique to This Notebook. – Stephen Luttrell Dec 26 '13 at 11:06
You are right! I just tried and it indeed work when the default context is Global. What I met is when editing .m file, and the context is not Global but my package. So the problem is the context, what should we do? – wxg Dec 26 '13 at 11:33
Are you sure you mean control+k and not command+k? Also, what do you mean by local variable? I get no autocompletion options for Block[ {hello} , hell (*cursor here*) ] when writing it the first time, but the fact that the variable is local does not matter I think. After evaluating the cell, hello is now available for autocompletion anywhere, also outside the Block. It seems symbols from the Global` context are autocompleted, no matter the option notebook's default context. If this option is set to unique for this notebook, new symbols are simple not added to Global`. – Jacob Akkerboom Dec 26 '13 at 12:04
Thank you for comment. In my mac it is cmd+k. I have tried Block[ {hello} , hell (*cursor here*) ], and the autocompletion works. By local variable I mean variables appear in Block and Module. I only have the problem when writing *.m file not notebook file. – wxg Dec 27 '13 at 15:02
Very similar to this question, – m_goldberg Dec 27 '13 at 23:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.