next up previous contents
Next: Writing Letters Up: LATEX Previous: The F2 key and

Interfacing With Mathematica On Suns Thru Emacs

To start a session of Mathematica within Emacs, use C-= (press and hold the CONTROL key and press the = key) or use C-K- (Control Keypad minus). To submit an expression to Mathematica, use F2 RET or M-RET (press and hold the META key and press RETURN). This will send all of the text typed since the last In[ ]:= prompt up to the end of the buffer (the cursor need not be at the end of the submitted expression). For example, to plot the ``Folium of Descartes'' in three dimensional color, enter (assuming the cell number is seven):

In[7]:= Plot3D[x^3+y^3-3 x y,{x,-1.2,1.2},{y,-1.2,1.2},
               PlotPoints->50,Mesh->False]
After a few seconds, Mathematica will respond with
Out[7]= -SurfaceGraphics-
and a graphics window will appear on your display. To remove the graphics window, Quit the file with the mouse by selecting Quit either on the File menu or in the menu produced by holding the right mouse button down on the green region at the top of the graph.

Use Emacs to copy a previous input you want to execute again or simply move your file marker with the arrow keys or the mouse to the line you want to submit execute by M-RET. To copy a previously submitted input, you could use C-c C-y and respond with the number of the Input cell you wish to copy. If you want to copy the last input, just press RETURN. Then you can edit the cell to change any parameters or syntax errors and resubmit it with M-RET.

To get help on a Mathematica symbol or command (like &&), use F1 e (lowercase `e') and then enter the symbol in the minibuffer. The output will pop up in another buffer instead of inside your Mathematica session as would usually be the case with ?Symbol. To get extra help on a symbol, use F1 E (capital `E') instead. This will list all of the attributes as well as any rules or default options defined for that symbol.

To get command or symbol completion help, use M-TAB. If the symbol typed thus far has only one possible completion, the rest of the ``word'' will be inserted for you. If more than one completion is possible, then a list of available symbols (either built-in Mathematica symbols or ones you defined previously) will appear in another buffer. You can type another letter or two and then use M-TAB again to finish the symbol or to generate a shorter list of completions.

To interrupt Mathematica during an operation, press the F2 key twice in a row. This is not currently possible if you are using Mathematica remotely. If you do press F2 twice, it will interrupt your session. This action will generate a Interrupt> prompt. You can enter the option you want (usually a to abort) or just a ? to get a list of options. Remember to use M-RET to send your choice (say a for abort) through the Emacs interface to Mathematica.

To end your Mathematica session completely, submit the Mathematica command Quit or press F2 ESC. To switch from a program composition file back to Mathematica, you can use use F10 to switch buffers, use C-= (perhaps the easiest), or use F3 (you may have to enter *math*). Recall that you can then load a program file prog.tex into the math session by <<prog.tex. If Mathematica was opened from the directory containing prog.tex, no path is needed. Recall that you can check the current directory by !PWD, however it appears you cannot change this directory inside Mathematica.

KEY Function Command
C-= Start Mathematica session and/or popup menu math
F1 e Help on Mathematica symbols math-help
F1 E Extra help (attributes, rules, defaults) math-extra-help
M-Tab Partially typed symbol completion math-complete-symbol
F2 RET Submit expression to be evaluated math-send-input
F2 Cut Kill typed input (what would be submitted) kill-shell-input
F2 Paste Yank (copy) a previous Input[ ] math-copy-cell
F2 Undo Edit a previously defined function math-edit-function
F2 Find Find syntax error in package find-math-error
F2 = Numerical results of last output math-N-percent
C-PrSc Print last graphics output math-PSPrint-percent
F1 m Describe math-mode describe-mode
F2 F2 Interrupt current operation interrupt-shell-subjob
F2 ESC Stop (kill) Mathematica process kill-9-process


next up previous contents
Next: Writing Letters Up: LATEX Previous: The F2 key and