2 \documentclass{article
}
3 \usepackage[lines
]{emaxima
}
6 \newcommand{\emx}{\textsl{\sffamily EMaxima
}}
7 \newcommand{\mx}{\textsl{\sffamily Maxima
}}
8 \newcommand{\hyph}{-
\hspace{0pt
}}
10 \firstcol=
.35\textwidth
12 \secondcol=
.65\textwidth
14 \title{\mx{} and Emacs
}
22 \section{Using
\mx{} and Emacs
}
24 Emacs, while nominally a text editor, is an extensible environment for
25 interacting with text in various ways. As such, it provides a
26 convenient interface for many text-based utilities. For example,
27 users of Emacs can interact with
\mx{} from within their favorite
28 editor
\footnote{Emacs.
} in a number of ways. The most basic way is to
29 use Emacs as a shell and run a
\mx{} process interactively from
30 within a buffer. Emacs can interact with this process from other
31 buffers, and thus interact with the
\mx{} process in less
32 straightforward ways. Emacs can also be used to write
33 \mx{} programs. A special mode is provided which will take
34 care of syntax highlighting, indentation, etc. Portions of the
35 program can also be sent automatically to a
\mx{} program.
36 Finally, text and
\mx{} commands can be interweaved in a
\mx{}
37 notebook mode called
\emx{}.
39 \section{Running
\mx{} Interactively
}
41 To run
\mx{} interactively in a buffer, type
\texttt{M-x maxima
}. A
42 buffer named
\texttt{*Maxima*
} should start up in which a
\mx{}
44 \footnote{In XEmacs, a double input prompt will sometimes appear in
45 the
\texttt{*Maxima*
} buffer. If this occurs, the customizable
46 variable
\texttt{maxima
\hyph{}fix
\hyph{}double
\hyph{}prompt
} can be set to
\texttt{t
}
47 to take care of this.
}
48 A history of input commands can be saved across Maxima sessions by
49 setting the variable
\texttt{maxima
\hyph{}save
\hyph{}input
\hyph{}history
} to
\texttt{t
}.
50 In the
\texttt{*Maxima*
} buffer,
\texttt{RET
} will check the line for
51 balanced parentheses, and send line as input.
\texttt{C-RET
} will
52 send the line as input without checking for balanced parentheses. A
53 list of available commands are listed in Appendix
\ref{app:intmx
}.
55 If this is the only way that
\mx{} is to be used from within Emacs,
56 then the
\textsl{Imaxima
} package should be considered. It allows the
57 user to work with
\mx{} interactively, and produces the output in
58 visually nice form. It is available from
59 \verb+http://memberss3.jcom.home.ne.jp/imaxima/Site/Welcome.html+.
61 \section{Running
\mx{} from arbitrary buffers
}
63 Several commands will access the
\mx{} process from outside of the
64 \texttt{*Maxima*
} buffer; these commands are given convenient key
65 bindings with the
\mx{} minor mode (which can be started
66 with
\texttt{M-x maxima-minor-mode
}), but are available without the
67 minor mode. In the following, the minor mode keybindings are given in
70 The command
\texttt{M-x maxima-minibuffer-on-determined-region
}
71 (
\texttt{C-c = e
}) will send part of the current buffer containing
72 the point to the
\mx{} process and return the result in the
73 minibuffer. The region that is sent is the region bounded above and
74 below by blank lines (although the delimiters can be changed by
75 changing the regexps
\texttt{maxima
\hyph{}minor
\hyph{}prefix
} and
76 \texttt{maxima
\hyph{}minor
\hyph{}postfix
}). Given an argument, this command
77 will also insert the output into the current buffer, after the symbol
78 \texttt{~==>~
}. (The output indicator
\texttt{~==>~
} is the value of
79 the customizable variable
\texttt{maxima
\hyph{}minor
\hyph{}output
}.)
81 \texttt{maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}determined
\hyph{}region
} on a region
82 which already has some output displayed, everything
83 after the indicator
\texttt{~==>~
} will be ignored, and, if the new
84 output is to be inserted, everything after the indicator will be
85 assumed to be old output and deleted.
87 The commands
\texttt{M-x maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}region
} (
\texttt{C-c = r
}),
88 \texttt{M-x maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}line
} (
\texttt{C-c = l
}) and
89 \texttt{M-x maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}form
} (
\texttt{C-c = f
}) work
90 similarly to
\texttt{M-x maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}determined
\hyph{}region
}, but
91 send the current region (respectively, the current line, current form
%
92 \footnote{The region between the preceding
\texttt{;
} or
\texttt{\$
}
93 and the subsequent
\texttt{;
} or
\texttt{\$
}.
})
94 to
\mx{} and display the result in the minibuffer.
95 Care must be taken when inserting the output into the current buffer
96 with
\texttt{M-x maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}region
} or
97 \texttt{M-x maxima
\hyph{}minibuffer
\hyph{}on
\hyph{}form
}, since new output will
98 be inserted without the old output being deleted.
100 The command
\texttt{M-x maxima
\hyph{}minibuffer
} (
\texttt{C-c = m
}) will use
101 the minibuffer to prompt for an expression to send to a
\mx{} process,
102 and the result will appear in the minibuffer
%
103 \footnote{In GNU Emacs, the output will be in
2D form if the
104 customizable variable
\texttt{maxima
\hyph{}minibuffer
\hyph{}2d
} is non-nil. Since
105 XEmacs does not have a resizable minibuffer, this cannot be done in
107 You can scroll through previous minibuffer inputs using the arrow keys.
109 The latest
\mx{} output (whether from a minibuffer command or not) can
110 be placed in the current buffer with the command
111 \texttt{M-x maxima
\hyph{}insert
\hyph{}last
\hyph{}output
} (
\texttt{C-c = o
}).
%
112 \footnote{If the output is
2D, this won't look nice.
}
113 The command
\texttt{M-x maxima
\hyph{}insert
\hyph{}last
\hyph{}output
\hyph{}tex
} (
\texttt{C-c = t
})
114 will insert the last output in
\TeX{} form.
118 \mx{} mode is a major mode for writing
\mx{} code. While in this
119 mode, Emacs provides commands for moving around in the code, syntax
120 highlighting, indenting lines to an appropriate level, sending
121 portions of the code to a
\mx{} process, and providing help on
\mx{}
122 commands. A list of available commands is in Appendix
125 When something is sent to a
\mx{} process, the
\texttt{*Maxima*
}
127 appear. (If a
\mx{} process is not running, one will be started.) It
128 can also be made to appear by using the command
\texttt{C-c C-p
}. If
129 an argument is given to a command to send information to
\mx{}, the
130 region will first be checked to make sure the parentheses are
131 balanced. The Maxima process can be killed, after asking for
132 confirmation, with
\texttt{C-c C-k
}. To kill without confirmation, give
133 \texttt{C-c C-k
} an argument.
135 By default, a newline will be indented to the same level as the
136 previous line, with an additional space added for open parentheses. A
137 tab will add extra spaces, by default, this is
2. The behaviour of
138 the automatic indentation can be changed by the command
139 \texttt{M-x maxima
\hyph{}change
\hyph{}indent
\hyph{}style
}. The possibilities are
140 \texttt{'standard
}, as above, and
\texttt{'perhaps
\hyph{}smart
}, which tries
141 to guess an appropriate indentation, based on open parentheses, ``do''
144 A
\texttt{RET
} will, by default, insert a new line, and indent the new
145 line an appropriate amount. This behavior can be changed by setting
147 \texttt{maxima
\hyph{}return
\hyph{}style
}, the self-explanatory options are
149 \texttt{'newline
\hyph{}and
\hyph{}indent
}, and
150 \texttt{'reindent
\hyph{}then
\hyph{}newline
\hyph{}and
\hyph{}indent
}. (Note that standard Emacs
151 behavior is to let
\texttt{RET
} only insert a newline, and
152 \texttt{LFD
} or
\texttt{C-j
} insert a newline and indent it.)
154 The indentation style, as well as many other things, are customizable;
155 see Appendix
\ref{app:custmxmode
}.
157 To help writing
\mx{} code in
\texttt{Noweb
},
158 \texttt{maxima
\hyph{}noweb
\hyph{}mode
} is a modification of
\texttt{maxima
\hyph{}mode
}
159 that will work nicely with
\texttt{noweb
\hyph{}mode
}; namely, it will limit
160 any relevant searches to the current chunk and treat
161 \texttt{<<
\ldots>>
} as word parts.
165 \emx{} is a major mode for Emacs that allows the user to write
166 documents while interacting with
\mx. It is based on Dan Dill's
167 \TeX{}/
\textit{Mathematica
} package
\footnote{\TeX/
\textit{Mathematica
}
168 is available from
\url{ftp://chem.bu.edu/pub/tex-mathematica-
2.0}.
},
169 and uses a modified version of William Schelter's
\texttt{maxima.el
}.
170 While the
\mx{} mode provided by
\texttt{maxima.el
} is designed to
171 help write
\mx{} programs,
\emx{} is designed to help write documents
172 that include
\mx{} code.
\emx{} is an extension of the
\LaTeX{} mode
173 provided by AUC
\TeX{}\footnote{This can be configured so that
\emx{}
174 extends the standard
\TeX{} mode provided by Emacs, or just text
175 mode.
}, and so has the
\LaTeX{} mode commands available. The
176 resulting
document can be processed by
\LaTeX{}; this requires putting
185 The basic unit of
\mx{} code in
\emx{} is a
\textbf{cell
}. A cell
186 consists of text between the delimiters
196 A cell can be created by typing
\texttt{C-c C-o
}. (The
\texttt{C-o
} in this
197 case stands for
\textbf{o
}pening a cell.) The delimiters will then be
198 placed in the buffer, and the point will be placed between them.
200 When working with several cells, you can jump between them by using
201 \texttt{C-c +
} to go to the next cell and
\texttt{C-c -
} to go to the
204 \subsection{Evaluating cells
}
207 To evaluate the contents of a cell, the command
208 \texttt{C-c C-u c
} (
\texttt{emaxima
\hyph{}update
\hyph{}cell
})
\footnote{Sending the
209 cells contents to a
\mx{} process and returning the results is
210 called
\textbf{updating
} the cell, the prefix
211 \texttt{C-c C-u
} will be used to update cells in different ways.
}
212 will send the contents
213 of the cell to a
\mx{} process (if there is no
\mx{} process running,
214 one will be started) and return the results to the cell,
215 separated from the input by the marker
221 $
\sin(x^
2)$, for example, type
222 \texttt{diff(sin(x\^
{}2),x);
} in a cell:
229 After typing
\texttt{C-c C-u c
}, it will look like
239 To delete the output and return the cell to its original form, you can
240 use the command
\texttt{C-c C-d
}.
241 If the
document is to be
\TeX{}ed, the above cell will look like:
246 and the cell with output will look like:
254 \emx{} mode can take advantage of the fact that
\mx{} can give its
255 output in
\LaTeX{} form. The command
\texttt{C-c C-u C
}
256 works the same as
\texttt{C-c C-u c
}, except now the output is in
\LaTeX{}
257 form, ready to be formatted by
\LaTeX{}. In general, if
258 \texttt{C-c C-u
}\textsl{letter
} returns
\mx{} output, then
259 \texttt{C-c C-u
}\textsl{capital letter
} will return the output in
260 \TeX{} form. The above cell would become
269 which, when
\LaTeX{}ed, would become
276 (Note that whenever a cell is updated, any old output is discarded and
277 replaced with new output.) The command
\texttt{C-c C-u a
} will update all
278 of the cells in your
document,
279 stopping at each one to ask if you indeed want it updated. Given an
280 argument,
\texttt{C-u C-c C-u a
}, it will update all of the cells in your
281 document without asking. The command
\texttt{C-c C-u A
} behaves
282 similarly, except now all the output is returned in
\LaTeX{} form.
284 \subsection{Referencing Other Cells
}
287 Instead of
\mx{} code, a cell can contain a reference to another cell,
288 and when the original cell is sent to
\mx{}, the reference is replaced
289 by the referenced cell's contents (but only in the
\mx{} process
291 content in the
document's buffer is not changed). In order to do
292 this, the original cell must be marked by having a label of the form
293 \texttt{<
}\textsl{filename
}\texttt{:
}\textsl{cell label
}\texttt{>
}.
294 (The reason for the
\textsl{filename
} will become apparent later, and
295 \textsl{cell label
} is optional for the referencing cell.)
296 The referenced cell must also be labeled, with the same
297 \textsl{filename
} but a unique
\textsl{cell label
}. To reference the
298 other cell, the original cell need only contain the marker for the
299 referenced cell. For example, given cell
1:
301 \begin{maxima
}[filename:optional
]
309 \begin{maxima
}[filename:definef
]
314 then the result of updating cell
1 (
\texttt{C-c C-u c
}) will be:
316 \begin{maxima
}[filename:optional
]
329 When
\LaTeX{}ed, the top line will contain a copy of the marker.
331 \begin{maxima
}[filename:optional
]
343 A cell can contain more than one reference, and referenced cells can
344 themselves contain references.
346 To aid in labelling the cells, the command
\texttt{C-c C-x
}
347 will prompt for a label name and label the
348 cell. To aid in calling references, the command
\texttt{C-c C-TAB
}
349 can be used for completing the
350 the
\textsl{filename
} and
\textsl{cell label
} parts of a reference,
351 based on the current labels.
352 Another option is to set the Emacs variable
353 \texttt{emaxima
\hyph{}abbreviations
\hyph{}allowed
} to
\texttt{t
}, say, by putting
356 (setq emaxima-abbreviations-allowed t)
359 in your
\texttt{.emacs
} file. This will allow the
\textsl{filename
}
360 and
\textsl{cell label
} parts of a reference to be abbreviated by enough
361 of a prefix to uniquely identify it, followed by ellipses
363 For example, if there are cells labelled
365 [filename:long description
]
366 [filename:lengthy description
]
374 will suffice to refer to the second label above.
376 If you want the references in a cell to be replaced by the actual
377 code, the command
\texttt{C-c @
} will expand all the
378 references and put the code into a separate buffer (so it will not
379 affect the original
document).
384 The reason for the ability to reference other cells is so that you can
385 write what Donald Knuth calls literate programs. The idea is that the
386 program is written in a form natural to the author rather than natural
387 to the computer. (Another aspect of Knuth's system is that the code
388 is carefully documented, hence the name ``literate programming'', but
389 that is done naturally in
\emx{}.) Knuth called his original
390 literate programming tool
\texttt{WEB
}, since, as he puts it,
391 ``the structure of a software program may be thought of as a web that
392 is made up of many interconnected pieces.''
393 \emx{}'s ability in this respect is taken directly from
394 \TeX{}/
\textit{Mathematica
}, and is ultimately based on
395 \texttt{WEB
}. To create a
396 program, the ``base cell'' or ``package cell'' should contain
397 a label of the form
\texttt{[}\textsl{filename
}\texttt{:
]}
398 (no cell label), and can
399 contain references of the form
400 \texttt{<
}\textsl{filename
}\texttt{:
}\textsl{part
}\texttt{>
}
401 (same file name as the base cell).
403 As a simple (and rather silly) example, suppose we want to create a
404 program to sum the first $n$ squares. We could start:
406 \begin{maxima
}[squaresum.max:
]
408 <squaresum.max:makelist>
409 <squaresum.max:squarelist>
410 <squaresum.max:addlist>
415 We would then need cells
417 \begin{maxima
}[squaresum.max:makelist
],
421 \begin{maxima
}[squaresum.max:squarelist
]
422 <squaresum.max:definesquare>
426 \begin{maxima
}[squaresum.max:addlist
]
431 and then we would also need:
433 \begin{maxima
}[squaresum.max:definesquare
]
438 When
\TeX{}ed, the header of the cell will say that it determines the
439 file
\texttt{squaresum.mu
}.
440 \begin{maxima
}[squaresum.max:
]
442 <squaresum.max:makelist>
443 <squaresum.max:squarelist>
444 <squaresum.max:addlist>
449 \texttt{C-u C-c @
} will put all the pieces
450 together in the file it determines. The resulting file, in this case,
451 will be
\texttt{squaresum.max
} and will look like:
461 (Although the idea is that only the computer need look at this file.)
463 \subsection{Other types of cells
}
466 When a cell is
\TeX{}ed, the input and output are kept separate. To
467 have the results look like a
\mx{} session, there are, in addition to
468 the standard cells, special cells called
\emph{session cells
}. A
469 session cell is delimited by
471 \begin{maximasession
}
479 The command
\texttt{C-c C-a
} will create a session cell. When a
480 session cell is updated, the portion of the cell after the
481 \verb+
\maximaoutput+ will contain both the input and the output,
482 with the
\mx{} prompts. For example, if the session cell
484 \begin{maximasession
}
490 were updated, the result would look like
492 \begin{maximasession
}
496 (
%i1) diff(sin(x),x);
500 (
%i2) integrate(cos(x),x);
507 which, when
\TeX{}ed, would look like
508 \begin{maximasession
}
512 (
%i1) diff(sin(x),x);
516 (
%i2) integrate(cos(x),x);
522 If it is updated in
\TeX{} form, it will look like
524 \begin{maximasession
}
528 \i5. diff(sin(x),x); \\
530 \i6. integrate(cos(x),x); \\
535 which, when
\TeX{}ed, will look like
536 \begin{maximasession
}
540 \i5. diff(sin(x),x); \\
542 \i6. integrate(cos(x),x); \\
546 % For particularly long output lines inside the \verb+\maximaoutput*+
547 % part of a session cell, the command \verb+\DD+ will typeset anything
548 % between the command and \verb+\\+. Unfortunately, to take advantage
549 % of this, the output has to be broken up by hand.
550 % If a session cell has not been updated, or has no output for some
551 % other reason, it will not appear when the document is \TeX{}ed.
553 If a cell is
\emph{starred
}, that is, if the environment ends with an
554 asterisk, then the output will not appear in the
\TeX{}ed output.
555 The star can be toggled with
\texttt{C-c C-n
}.
557 If the command to create one type of cell is called while inside
558 another type of cell, the type of cell will be changed. So, for
559 example, the command
\texttt{C-c C-a
} from inside the cell
568 \begin{maximasession
}
573 If a standard cell is a package part, its type cannot be changed.
575 \subsection{\emx{} and
\texttt{Preview-LaTeX
}}
577 For users of
\texttt{preview-latex
}, the
\emx{} cells can be
578 previewed.
\footnote{Currently, this only works in GNU Emacs.
}
579 This requires using the
\texttt{preview
} option to the
580 \texttt{emaxima
} package; i.e., putting
582 \usepackage[preview
]{emaxima
}
585 The cells will be un-previewed whenever they are updated.
586 If the customizable variable
\texttt{emaxima
\hyph{}preview
\hyph{}after
\hyph{}update
\hyph{}all
}
587 is non-nil, then the buffer will be re-previewed whenever an
588 update-all command is called.
591 \subsection{Miscellaneous
}
594 Some
\mx{} commands can be used even outside of cells. The command
595 \texttt{C-c C-u l
} send the current line to a
596 \mx{} process, comment out the current line, and insert the
\mx{}
597 output in the current buffer. The command
598 \texttt{C-c C-u L
} will do the same, but
599 return the result in
\LaTeX{} form.
601 The command
\texttt{C-c C-h
} will provide
602 information on a prompted for function (like
\mx's
\texttt{describe
}),
603 and
\texttt{C-c C-i
} will give the
\mx{} info manual.
605 Finally, the
\mx{} process can be killed with
\texttt{C-c C-k
}.
607 A list of the commands for
\emx{} are in Appendix
\ref{app:emx
}, and
608 the customizability options are in Appendix
\ref{app:custemx
}.
613 \section{Installation
}
615 To run
\mx{} interactively or use
\mx{} mode or minor mode, the files
616 \texttt{maxima.el
} and
\texttt{maxima
\hyph{}font
\hyph{}lock.el
} need to be
617 somewhere in the Emacs load path. To be able to automatically run
618 \mx{} or use
\mx{} mode or minor mode, add the lines\\
620 (autoload 'maxima "maxima" "Run Maxima interactively" t)
621 (autoload 'maxima-mode "maxima" "Major mode for writing Maxima programs" t)
622 (autoload 'maxima-minor-mode "maxima" "Minor mode for working with Maxima" t)
626 in your
\texttt{.emacs
} file.
627 To ensure that files ending in
\texttt{.max
} start up in
\mx{} mode,
630 (setq auto-mode-alist (cons '("\\.max" . maxima-mode) auto-mode-alist))
634 For the
\emx{} package, in addition to the above files, the files
635 \texttt{emaxima.el
} and
\texttt{emaxima.lisp
} need to be somewhere in
636 the Emacs load path
\footnote{If Emacs cannot find
637 \texttt{emaxima.lisp
}, then the
\TeX{} output functions will not
638 work, any attempts to get
\TeX{} output will result in an error.
},
639 and if you want to run
\LaTeX{} on the resulting
document,
640 \texttt{emaxima.sty
} and
\texttt{maxima.sty
} need to be in the
\TeX{}
641 inputs path. If you use pdflatex, you'll also need
\texttt{pdfcolmk.sty
}.
643 To make sure that
\texttt{emaxima.el
} is loaded when necessary, the line
645 (autoload 'emaxima-mode "emaxima" "EMaxima" t)
648 can be inserted into your
\texttt{.emacs
} file. Then typing
649 \texttt{M-x emaxima
\hyph{}mode
} will start
\emx{} mode. The command
650 \texttt{M-x emaxima
\hyph{}mark
\hyph{}file
\hyph{}as
\hyph{}emaxima
} will put the line
655 at the beginning of the file, if it isn't there already, and will ensure
656 that the next time the file is opened, it will be in
\texttt{emaxima
\hyph{}mode
}.
657 This can be done automatically everytime a file is put in
658 \texttt{emaxima
\hyph{}mode
} by putting the line
660 (add-hook 'emaxima-mode-hook 'emaxima-mark-file-as-emaxima)
663 somewhere in your
\texttt{.emacs
} file.
666 \section{\mx{} help commands
}
668 The following commands can be used in any Maxima related buffer. (For
669 Maxima minor mode, replace
\texttt{C-c C-d
} with
\texttt{C-= d
}.)
674 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
676 \textbf{Key
} &
\textbf{Description
}\\
679 %& \texttt{maxima-help}
680 & Get help on a (prompted for) subject.\\
681 \texttt{C-c C-d d
} \\
683 %& \texttt{maxima-apropos}
684 & Get help with the symbol under point.\\
686 \texttt{C-c C-d a
} & Apropos.\\
688 \texttt{C-c C-d C-p
} & Get apropos with the symbol under point.\\
690 \texttt{C-c C-d C-m
}\\
692 \texttt{C-c C-d C-i
} & Read the Maxima info manual.
695 \section{Interactive
\mx{} commands
}
700 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
702 \textbf{Key
} &
\textbf{Description
}\\
704 \texttt{M-TAB
} & Complete the Maxima symbol as much as possible, providing
705 a completion buffer if there is more than one possible
707 \texttt{C-M-TAB
} & Complete the input line, based on previous input lines.\\
708 \texttt{C-c C-k
} & Kill the process and the buffer, after asking for
709 confirmation. To kill without confirmation, give
\texttt{C-c C-k
} an
711 \texttt{M-p
} & Bring the previous input to the current prompt.\\
712 \texttt{M-n
} & Bring the next input to the prompt.\\
713 \texttt{M-r
} & Bring the previous input matching
714 a regular expression to the prompt.\\
715 \texttt{M-s
} & Bring the next input matching
716 a regular expression to the prompt.
719 \section{\mx{} minor mode commands
}
724 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
726 \textbf{Key
} &
\textbf{Description
}\\
728 \texttt{C-c=e
} & Run Maxima on the region between
729 \texttt{maxima
\hyph{}minor
\hyph{}prefix
} and
\texttt{maxima
\hyph{}minor
\hyph{}postfix
}. By
730 default, these are blank lines.\\
731 \texttt{C-c=r
} & Run Maxima on the current region. \\
732 \texttt{C-c=l
} & Run Maxima on the current line.\\
733 \texttt{C-c=f
} & Run Maxima on the current form.\\
734 \texttt{C-c=m
} & Prompt for Maxima input in the minibuffer.\\
735 \texttt{C-c=o
} & Insert the last Maxima output in the current
737 \texttt{C-c=t
} & Insert the last Maxima output in
\TeX{} form in the
742 \section{\mx{} mode commands
}
753 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
755 \textbf{Key
} &
\textbf{Description
}\\
757 \texttt{M-C-a
} & Go to the beginning of the form.\\
758 \texttt{M-C-e
} & Go to the end of the form.\\
759 \texttt{M-C-b
} & Go to the beginning of the sexp.\\
760 \texttt{M-C-f
} & Go to the end of the sexp.
771 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
773 \textbf{Key
} &
\textbf{Description
}\\
775 \texttt{C-c C-p
} & Start a
\mx{} process.\\
776 \texttt{C-c C-r
} & Send the region to the
\mx{} process.\\
777 \texttt{C-c C-b
} & Send the buffer to the
\mx{} process.\\
778 \texttt{C-c C-c
} & Send the line to the
\mx{} process.\\
779 \texttt{C-c C-e
} & Send the form to the
\mx{} process.\\
780 \texttt{C-c C-k
} & Kill the
\mx{} process.\\
781 \texttt{C-c C-p
} & Display the
\mx{} buffer.
792 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
794 \textbf{Key
} &
\textbf{Description
}\\
796 \texttt{M-TAB
} & Complete the
\mx{} symbol.\\
808 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
810 \textbf{Key
} &
\textbf{Description
}\\
812 \texttt{C-c ;
} & Comment the region.\\
813 \texttt{C-c :
} & Uncomment the region.\\
814 \texttt{M-;
} & Insert a short comment.\\
815 \texttt{C-c *
} & Insert a comment environment.
827 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
829 \textbf{Key
} &
\textbf{Description
}\\
831 \texttt{TAB
} & Indent line.\\
832 \texttt{M-C-q
} & Indent form.
839 \textbf{Miscellaneous
}
844 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
846 \textbf{Key
} &
\textbf{Description
}\\
848 \texttt{M-h
} & Mark the form.\\
849 \texttt{C-c )
} & Check the region for balanced parentheses.\\
850 \texttt{C-c C-)
} & Check the form for balanced parentheses.
853 \section{\emx{} mode commands
}
857 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
859 \textbf{Key
} &
\textbf{Description
}\\
861 \texttt{C-c C-o
} & Create a (standard) cell.\\
862 \texttt{C-c C-a
} & Create a session cell.\\
863 \texttt{C-c C-n
} & Toggle starred cells.\\
864 \texttt{C-c +
} & Go the the next cell.\\
865 \texttt{C-c -
} & Go to the previous cell.\\
867 Update all of the cells. With an argument, don't ask before updating.\\
869 & Update all of the cells in
\TeX{} form. With an argument don't ask
872 & Update all of the session cells in
\TeX{} form. With an
873 argument, don't ask before updating.
880 \textbf{Commands only available in cells.
}
885 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
887 \textbf{Key
} &
\textbf{Description
}\\
890 %& \texttt{emaxima-send-cell}
891 & Send the current cell to the
\mx{} process.\\
893 %& \texttt{emaxima-update-cell}
894 & Update the current cell.\\
896 %& \texttt{emaxima-tex-update-cell}
897 & Update the current cell in
\TeX{} form.\\
899 %& \texttt{emaxima-delete-output}
900 & Delete the output from the current cell.\\
902 %& \texttt{emaxima-package-part}
903 & Insert a heading for the cell indicating that it's part of a
906 %& \texttt{emaxima-assemble}
907 & Assemble the references contained in the cell. With an argument,
908 assemble the package that the cell defines.\\
909 \texttt{C-c C-
\texttt{TAB
}}
910 %& \texttt{emaxima-insert-complete-name}
911 & Complete a reference within a cell.
917 \textbf{Commands only available outside of cells.
}
922 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
924 \textbf{Key
} &
\textbf{Description
}\\
927 %& \texttt{emaxima-replace-line}
928 & Send the current line to
\mx{}, and replace the line with the
931 %& \texttt{emaxima-replace-line-with-tex}
932 & Send the current line to
\mx{}, and replace the line with the
933 \mx{} output in
\TeX{} form.
937 \section{AUC
\TeX{} commands
}
942 \textbf{Inserting commands
}
947 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
949 \textbf{Key
} &
\textbf{Description
}\\
952 & Insert an environment.\\
954 & Insert a section.\\
956 & Close an environment.\\
958 & Insert an item into a list.\\
962 & Smart dollar sign.\\
964 & Insert double brace.\\
966 & Insert
\TeX{} macro.\\
968 & Complete
\TeX{} macro.\\
979 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
981 \textbf{Key
} &
\textbf{Description
}\\
988 & Format environment.\\
990 & Mark an environment.\\
1004 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
1006 \textbf{Key
} &
\textbf{Description
}\\
1009 & Comment a region.\\
1011 & Uncomment a region.\\
1013 & Comment a paragraph.\\
1015 & Uncomment a paragraph.
1021 \textbf{Font selection
}
1026 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
1028 \textbf{Key
} &
\textbf{Description
}\\
1030 \texttt{C-c C-f C-b
}
1032 \texttt{C-c C-f C-i
}
1034 \texttt{C-c C-f C-r
}
1036 \texttt{C-c C-f C-e
}
1038 \texttt{C-c C-f C-t
}
1040 \texttt{C-c C-f C-s
}
1042 \texttt{C-c C-f C-d
}
1044 \texttt{C-u C-c C-f
}
1049 \textbf{Running
\TeX{}}
1054 (Commands:
\texttt{TeX
},
\texttt{TeX Interactive
},
\texttt{LaTeX
},
1055 \texttt{LaTeX Interactive
},
\texttt{SliTeX
},
\texttt{View
},
1056 \texttt{Print
},
\texttt{BibTeX
},
\texttt{Index
},
\texttt{Check
},
1057 \texttt{File
},
\texttt{Spell
}.)
1062 \begin{tabular
}{p
{\firstcol}p
{\secondcol}}
1064 \textbf{Key
} &
\textbf{Description
}\\
1067 & Run a command on the master file.\\
1069 & Run a command on the current region.\\
1071 & Run a command on the buffer.\\
1073 & Go to the next error.\\
1075 & Kill the
\TeX{} process.\\
1077 & Center the output buffer.\\
1079 & Switch to the master file.\\
1081 & Toggle debug of overful boxes.\\
1084 \section{Customization
}
1086 \subsection{Customizing
\mx{} mode
}
1087 \label{app:custmxmode
}
1089 Indentation in
\mx{} mode can be controlled with the following
1092 \item[maxima-indent-style
] This determines how hard
\mx{} mode will
1093 try to compute an appropriate indentation. The options are
1094 \texttt{'standard
} and
\texttt{'perhaps-smart
}, the default is
1095 \texttt{'perhaps-smart
}.
1096 \item[maxima-indent-amount
] This is the default indentation for each
1097 level in
\mx{} mode. By default, it is
2.
1098 \item[maxima-paren-indent-amount
] This is the amount of extra
1099 indentation to be added for each parenthetical nesting. By default,
1100 it is
1, so that the lines following an open parenthesis will start
1101 in the first column past the parenthesis.
1102 \item[maxima-blockparen-indent-amount
] This is the amount of extra
1103 indentation to be added after a
\texttt{block(
}. By default, this
1104 is $-
3$, so that the following lines won't be indented too far.
1105 \item[maxima-continuation-indent-amount
] This is the amount of
1106 indentation to be added when a line is the continuation of the
1107 expression begun on the previous line. By default, it is
2.
1108 \item[maxima-multiline-comment-indent-amount
] This is the amount of
1109 extra indentation to be given to comments. By default, it is
2.
1110 \item[maxima-if-extra-indent-amount
] This is the amount of extra
1111 indentation to give a then which follows an if, assuming the then
1112 starts on its own line. By default, it is
0, so the then will begin
1116 Other facets of
\mx{} mode can be controlled through the following
1119 \item[maxima-return-style
] This determines how
\mx{} mode will handle
1120 \texttt{RET
}. The options are
\texttt{'newline
},
1121 \texttt{'newline
\hyph{}and
\hyph{}indent
}, and
1122 \texttt{'reindent
\hyph{}then
\hyph{}newline
\hyph{}and
\hyph{}indent
}, the default is
1123 \texttt{'reindent
\hyph{}then
\hyph{}newline
\hyph{}and
\hyph{}indent
}.
1126 Some other options that may occasionally need to be set are:
1128 \item[maxima-command
] The command used to start
\mx{}. By default,
1129 it is
\texttt{maxima
}.
1130 \item[maxima-args
] Extra arguments to pass to the
\mx{} command. By
1131 default, it is
\texttt{nil
}.
1132 \item[maxima-use-tabs
] If this is non-nil, the indentation will use
1133 TABS as well as spaces. By default, it is
\texttt{nil
}.
1137 \subsection{Customizing
\emx{}}
1140 There are a few (very few) things that you can do to customize
\emx{}.
1142 By default,
\emx{} is an extension of AUC
\TeX{} mode. This can be
1143 changed by changing the variable
\texttt{emaxima
\hyph{}use
\hyph{}tex
}. The possible
1144 values are
\texttt{'auctex
},
\texttt{'tex
} and
\texttt{nil
}. Setting
1145 \texttt{emaxima
\hyph{}use
\hyph{}tex
} (the default) to
\texttt{'auctex
} will make
\emx{}
1146 an extension of AUC
\TeX{}, setting it to
\texttt{'tex
} will make
\emx{} an
1147 extension of Emacs's default
\TeX{} mode, and setting
1148 \texttt{emaxima
\hyph{}use
\hyph{}tex
} to
\texttt{nil
} will make
\emx{} an extension of
1149 text-mode. So, for example, putting
1151 (setq emaxima-use-tex nil)
1154 in your
\texttt{.emacs
} file will make
\emx{} default to an extension of
1157 Whether or not the dots (
\dots{}) abbreviation is allowed in cell
1158 references is controlled by the elisp variable
1159 \texttt{emaxima
\hyph{}abbreviations
\hyph{}allowed
}, which is set to
\texttt{t
} by
1160 default. Setting this to
\texttt{nil
} will disallow the abbreviations,
1161 but will speed up package assembly.
1163 The variable
\texttt{emaxima
\hyph{}preview
\hyph{}after
\hyph{}update
\hyph{}all
} will determine
1164 whether or not the buffer will be previewed (when preview-latex is
1165 being used) after an update-all command. By default, it is
\texttt{t
}.
1168 The
\LaTeX{}ed output can be customized somewhat. The
1169 \texttt{emaxima
} LaTeX
{} package can take some options, namely
1170 \texttt{breqn
},
\texttt{lines
},
\texttt{listings
} and
\texttt{preview
}.
1171 The
\texttt{breqn
} option will use the
\LaTeX{} \texttt{breqn
} package
1172 (which must be installed) to break long
\mx{} lines into shorter lines
1174 The
\texttt{preview
} option will enable the Emacs preview package
1175 (which must be installed) to preview the
\mx{} environments.
1176 The
\texttt{lines
} option will put lines before and after some of the
1178 The
\texttt{listings
} option will use the
\LaTeX{} \texttt{listings
}
1179 package (which must be installed) to typeset some of the
\mx{} code.
1180 To use this, the file
\texttt{maxima.sty
} must be in the search path
1183 The indentation of the
\mx{} code can be reset by resetting the
1184 \LaTeX{} length
\verb+
\maximaindent+.
1185 The colors of the prompts, inputs and outputs can be reset by renewing
1186 the commands
\verb+
\maximapromptcolor+,
\verb+
\maximainputcolor+
1187 and
\verb+
\maximaoutputcolor+ to appropriate colors.
1189 The top, middle and bottom of a maxima cell are determined by the
1190 commands
\verb+
\maximatop+,
\verb+
\maximamiddle+ and
\verb+
\maximabottom+.
1191 By default,
\verb+
\maximamiddle+ is set to
\verb+
\maximaoutputmarker+.
1192 If the
\texttt{lines
} option is used, then
\verb+
\maximatop+ and
1193 \verb+
\maximabottom+ are set to
\verb+
\maximaboxtop+ and
1194 \verb+
\maximaboxbottom+, respectively.
1195 Otherwise,
\verb+
\maximatop+ and
\verb+
\maximabottom+ are set to do nothing.
1196 The top and bottom of a maxima session are determined by
1197 \verb+
\maximasessiontop+ and
\verb+
\maximasessionbottom+, respectively.
1198 By default, they do nothing.
1200 The verbatim output for maxima cells is inserted with
1201 \verb+
\maximaverbatiminput+. This will do one of two things.
1202 If the listings option is used, this is defined by
1203 \verb+
\lstinputlisting[style=emaxima
]{#1}+, and so can be adjusted by
1204 resetting the emaxima style. By default, this style is given by
1206 \lstdefinestyle{emaxima
}
1210 xleftmargin=
\maximaindent}
1213 If the listings package is not used, then
\verb+
\maximaverbatiminput+ is
1214 defined by
\verb+
\VerbatimInput[xleftmargin=
\maximaindent]{#1}+
1215 (
\verb+
\VerbatimInput+ is from the fancyvrb package.)
1216 In either case, it can be adjusted by redefining
1217 \verb+
\maximaverbatiminput+, which is expected to indent everything by
1218 \verb+
\maximaindent+.
1219 The fonts used in the maximasessions is
\verb+
\maximafont+, by default