1 \input texinfo @c -*-texinfo-*-
3 @documentencoding ISO-8859-1
4 @setfilename imaxima.info
5 @settitle Imaxima Manual
15 * Imaxima: (imaxima). Image support for the computer algebra system Maxima. Interactive math minor mode.
22 This file documents Imaxima.
24 Copyright (C) 2002, 2003, 2004 Jesper Harder
25 Copyright (C) 2004, 2007, 2008 Yasuaki Honda
26 Copyright (C) 2020, 2021 Leo Butler
28 Permission is granted to make and distribute verbatim copies of
29 this manual provided the copyright notice and this permission notice
30 are preserved on all copies.
33 Permission is granted to process this file through Tex and print the
34 results, provided the printed document carries copying permission
35 notice identical to this one except for the removal of this paragraph
36 (this paragraph not being relevant to the printed manual).
42 @subtitle Version @value{VERSION}
43 @subtitle @value{UPDATED}
44 @author by Jesper Harder, Yasuaki Honda and Leo Butler. Imath mode by Yasuaki Honda.
47 @vskip 0pt plus 1filll
48 Copyright @copyright{} 2002, 2003, 2004 Jesper Harder
49 Copyright @copyright{} 2004, 2007, 2008 Yasuaki Honda
50 Copyright @copyright{} 2020, 2021 Leo Butler
52 Permission is granted to make and distribute verbatim copies of@*
53 this manual provided the copyright notice and this permission notice@*
54 are preserved on all copies.
58 @node Top, Installation, (dir), (dir)
60 Imaxima is a package for displaying the output from the computer
61 algebra system Maxima as images typeset by @TeX{}.
63 This manual documents imaxima version @value{VERSION}. You can
64 download the latest version of imaxima from
65 @uref{http://maxima.sourceforge.net/, the Maxima website}.
67 Since version 1.0b, imaxima and imath supports inline graphs.
69 Send suggestions and bug reports to
70 @email{maxima-discuss@@lists.sourceforge.net, the Maxima email list} or
71 @uref{https://sourceforge.net/p/maxima/bugs/, the Maxima bug tracker}.
74 * Installation:: Installing imaxima (and breqn).
75 * Usage:: Commands you can use in imaxima.
76 * Inline Graphs:: Commands you can use for inline graphs.
77 * Options:: Customizing imaxima.
78 * Imath minor mode:: Interactive Math minor mode.
82 @node Installation, Usage, Top, Top
85 Install imaxima by unpacking the tarball and doing the usual
98 (autoload 'imaxima "imaxima" "Image support for Maxima." t)
102 in your @file{.emacs} file.
104 If you use Interactive Math minor mode, put
107 (autoload 'imath-mode "imath" "Interactive Math minor mode." t)
111 in your @file{.emacs} file.
114 To do line breaking imaxima requires the LaTeX package
115 @code{breqn}. This package is currently distributed from
116 @uref{https://ctan.org/pkg/breqn, its CTAN webpage} as
117 @uref{http://mirrors.ctan.org/install/macros/latex/contrib/breqn.tds.zip,
120 The files in @code{breqn} must be installed in a place where @TeX{} can
121 find them. In a typical LaTeX installation you should put the
122 @file{*.sty} and @file{*.sym} files in
125 @file{/usr/share/texmf/tex/latex/breqn/}
129 and the documentation files in
132 @file{/usr/share/texmf/doc/latex/breqn/}.
135 The files can also be installed in a number of other places---consult
136 your @TeX{} documentation for details.
138 Now run @command{texhash} after installing the files. You can use the
139 command @command{kpsewhich} to verify that @TeX{} is able to find the
146 To get the best image quality a fairly recent version of Ghostscript
147 is recommended. @xref{Miscellaneous}, for options suitable for using
148 older versions of Ghostscript or not using Ghostscript at all
150 @section Manual installation
151 If you cannot use @command{make}, the manual steps required for
156 Byte compile @file{imaxima.el} and @file{imath.el}.
158 Place the files @file{imaxima.el}, @file{imaxima.elc}, @file{imath.el},
159 @file{imath.elc}, @file{imaxima-autoconf-variables.el} and
160 @file{imaxima.lisp} in Emacs' @code{load-path} (@pxref{Lisp Libraries,
161 , , emacs, The Emacs manual}).
163 Install the @TeX{} files in the way explained above.
166 @node Usage, Inline Graphs, Installation, Top
168 To start using imaxima just type @kbd{M-x imaxima}. The imaxima
169 directory needs to be on Emacs' @code{load-path}.
172 Starts a Maxima session in an Emacs buffer.
175 You can turn image generation off by evaluating
182 in Maxima. Output from Maxima is then shown with the usual
183 @acronym{ASCII} graphics. To turn images on again, evaluate
189 If there is an error in a LaTeX expression you can press @kbd{Mouse-2}
190 (or @kbd{@key{RET}}) on the error message to view the error log and
191 @kbd{Mouse-3} (or @kbd{M-@key{RET}}) to view the LaTeX source file.
193 @defopt imaxima-use-maxima-mode-flag
194 Set to non-@code{nil} to use the Maxima mode from @code{maxima.el}.
196 By default @code{imaxima.el} uses a very simple mode which doesn't
197 provide any custom menus, font-locking or key-bindings. You can,
198 however, combine @code{imaxima.el} with the Emacs mode from the Maxima
199 distribution to get these features.
203 Converts the Maxima buffer to a LaTeX document and opens it in LaTeX
204 mode. @ref{imaxima-latex-buffer-name} @emph{Note:} This command does not
208 @defun imaxima-to-html
209 Converts the Maxima buffer to a HTML document named session.html
210 and opens it in HTML mode. All the PNG files generated by imaxima
211 for each output from Maxima are gathered in a folder named session-images
212 and referenced from session.html. @emph{Note:} This command does not
216 @defun imaxima-clean-up
217 Delete temporary files created by imaxima and kill the Ghostscript
218 process if it is running. Normally imaxima does this automatically
219 when you quit Maxima. This command is just a convenience if
223 @defun imaxima-version
224 Display the package name and the version number of the imaxima imath
225 package in the mini buffer. You should make sure the version
226 information when you want to make bug reports.
229 @defun reinit-imaxima
230 Initialize the imaxima program. Sometimes you may encounter situations
231 where imaxima does not repond to your input. This is caused by the
232 inconsistency between Emacs Lisp and Maxima. Such situations can be
233 resolved by using this command. After calling this command from the
234 Emacs mini buffer, you should type simple Maxima expression such as
235 1+2; to ensure that the imaxima does respond to you now.
238 @anchor{imaxima-print-buffer}
239 @defun imaxima-print-buffer
240 Run LaTeX on the current buffer and show output. See
241 @xref{imaxima-print-tex-command} for how LaTeX is run.
245 @node Inline Graphs, Options, Usage, Top
246 @chapter Inline Graphs
248 Since version 1.0b, imaxima and imath supports the inline graph display
249 feature. That is, if a special graph command (such as wxplot2d, wxplot3d)
250 is used in the maxima session, the graph generated by the command is
251 inserted in the maxima session buffer, instead of displaying in another
255 Before using this feature, you should make sure @code{plot2d} works
256 with Gnuplot by trying:
258 (%i1) plot2d(x^2,[x,-5,5],[plot_format,gnuplot]);
260 If this works fine, then quite likely @code{wxplot2d} works, too.
262 Following commands can be used in a maxima session to draw graphs to be
263 displayed inline: @code{wxplot2d}, @code{wxplot3d}, @code{wxdraw2d},
264 @code{wxdraw3d}, @code{wximplicit_plot}, and @code{wxcontour_plot}. New
265 in version 1.0d, the graphics commands @code{wxdraw}, @code{wxjulia} and
266 @code{wxmandelbroit} also provide inline images.
268 The syntax and capabilities of the wx-prefixed versions of the commands
269 and their arguments are the same as the ones of the corresponding
270 original commands. Hence, @code{wxplot2d} draws a graph inline in the
271 @verb{*imaxima*} buffer, while @code{plot2d} displays the same graph in
272 a different window created by Gnuplot.
274 The wx-prefixed versions of the commands set up arguments so that
275 Gnuplot is used to draw the graph and writes the graph in extended
276 postscript format into a temporary file. Conseqently, use of plot
277 options such as @code{plot_format}, @code{gnuplot_script_file},
278 @code{gnuplot_term}, @code{ps_file} or their draw counterparts will
279 result in unspecified behaviour.
281 The @code{wxdraw} family of commands automatically load the draw package
282 since they call @code{draw} internally. Similarly, @code{wxjulia} and
283 @code{wxmandelbroit} automatically load the dynamics package.
287 * Commands and Options::
290 @node Keybindings, Commands and Options, Inline Graphs, Inline Graphs
293 Images in the @verb{*imaxima*} buffer have a special keymap
294 (@pxref{keymaps,keymaps,keymaps,emacs}). By hovering the mouse over the
295 image, one can display the list of `hot keys' and a short description of
296 each action pressing a key triggers. To activate the keymap, point must
301 l : Copy the @LaTeX{} source to generate the image under point into the
302 register stored in @ref{imaxima-latex-src-register} (default:
303 l). @pxref{imaxima-get-latex-src}.
306 g : Have Gnuplot replot the graph/image under point in a separate window
307 spawned by Gnuplot. @pxref{imaxima-gnuplot-replot}.
310 s : Forcibly restart the Gnuplot process. This can be useful if an error
311 occurs during plotting. Some @code{plot} examples may only work if
312 Gnuplot is restarted. @pxref{imaxima-gnuplot-restart}.
315 @node Commands and Options, , Keybindings, Inline Graphs
316 @section Commands and Options
318 @anchor{imaxima-get-latex-src}
319 @deffn {Command} imaxima-get-latex-src
320 When point is over an image, this copies the @LaTeX{} source used by
321 imaxima to generate the image into the register named by
322 @ref{imaxima-latex-src-register}.
325 @anchor{imaxima-gnuplot-replot}
326 @deffn {Command} imaxima-gnuplot-replot
327 When point is over an image created by Gnuplot, this command will
328 re-execute the Gnuplot script that created the image and display it in a
329 separate window spawned by Gnuplot. Asks for the Gnuplot terminal to
330 use. @pxref{imaxima-gnuplot-replot-term}.
333 @anchor{imaxima-gnuplot-restart}
334 @deffn {Command} imaxima-gnuplot-restart
335 Forcibly kill the Gnuplot process and buffer, if necessary, and then
336 start a new Gnuplot process.
339 @anchor{imaxima-gnuplot-buffer}
340 @defopt imaxima-gnuplot-buffer
341 The name of the buffer in which imaxima runs its Gnuplot
342 process. Default: @verb{|*imaxima-gnuplot*|}.
345 @anchor{imaxima-gnuplot-command}
346 @defopt imaxima-gnuplot-command
347 The name of the Gnuplot executable that imaxima runs. Default:
351 @anchor{imaxima-gnuplot-args}
352 @defopt imaxima-gnuplot-args
353 Optional arguments sent to the Gnuplot executable by imaxima. Default:
357 @anchor{imaxima-latex-src-register}
358 @defopt imaxima-latex-src-register
359 One can copy the @LaTeX{} source used to generate an image into a
360 register by placing point over the image and typing this key. Default:
364 @anchor{imaxima-gnuplot-replot-term}
365 @defopt imaxima-gnuplot-replot-term
366 The name of the Gnuplot terminal used to display an inline plot in an
367 external, Gnuplot-spawned window. @pxref{imaxima-gnuplot-replot}.
371 @node Options, Imath minor mode, Inline Graphs, Top
375 * Appearance:: Size, colors, fonts.
376 * Line Breaking:: Options for Line Breaking.
380 All options can be changed in the Emacs customize interface, use
381 @kbd{M-x customize-group @key{RET} imaxima @key{RET}}.
383 @node Appearance, Line Breaking, Options, Options
386 @anchor{imaxima-pt-size}
387 @defopt imaxima-pt-size
388 The type size used in LaTeX. This can be @samp{9}, @samp{10},
389 @samp{11} or @samp{12} pt.
392 @anchor{imaxima-fnt-size}
393 @defopt imaxima-fnt-size
394 Default size of font. Options include @samp{small},
395 @samp{normalsize}, @samp{large}, @samp{Large}, @samp{LARGE},
396 @samp{huge} or @samp{Huge} (in non decreasing order).
399 @anchor{imaxima-scale-factor}
400 @defopt imaxima-scale-factor
401 Scale all images by this factor. The default is @samp{1.0}.
404 @emph{Note:} The options @code{imaxima-pt-size},
405 @code{imaxima-fnt-size} and @code{imaxima-scale-factor} are highly
408 @anchor{imaxima-equation-color}
409 @defopt imaxima-equation-color
410 Color used for equations.
413 @anchor{imaxima-label-color}
414 @defopt imaxima-label-color
415 Color used for output labels (red by default).
418 @anchor{imaxima-bg-color}
419 @defopt imaxima-bg-color
420 Background color used in the imaxima buffer. @code{nil} if you don't want
421 to change the default color.
424 @anchor{imaxima-fg-color}
425 @defopt imaxima-fg-color
426 Foreground color used in the imaxima buffer. @code{nil} if you don't want
427 to change the default color.
430 @anchor{imaxima-latex-preamble}
431 @defopt imaxima-latex-preamble
432 (See options @code{imaxima-latex-document-class},
433 @code{imaxima-latex-use-packages},
434 @code{imaxima-latex-document-dimensions}, @code{imaxima-latex-macros}
435 and @code{imaxima-latex-macros-linear}.) LaTeX expression inserted at
436 the start of the document preamble when TeX'ing equations. This can be
437 used to change, say, the document font. E.g.
440 \usepackage@{concrete@}
446 will use Herman Zapf's Euler math fonts and the accompanying Concrete
447 roman fonts. These are probably better suited as screen fonts than the
448 default Computer Modern, which works best at high resolutions.
451 @anchor{imaxima-latex-error-face}
452 @defopt imaxima-latex-error-face
453 Face used for LaTeX errors. This option is ignored when using
457 @anchor{imaxima-latex-document-class}
458 @defopt imaxima-latex-document-class
459 An elisp list (FORMAT-STRING [ARGS]) that provides a valid list of
460 inputs to @code{format}. FORMAT-STRING should generate the @LaTeX{}
461 document class used to generate all @LaTeX{} documents; ARGS is
462 evaluated. Used by @code{imaxima-latex}.
465 @anchor{imaxima-latex-use-packages}
466 @defopt imaxima-latex-use-packages
467 A string that contains all @code{usepackage} declarations needed. This
468 is inserted into the @LaTeX{} document after
469 @code{imaxima-latex-preamble}.
472 @anchor{imaxima-latex-macros-format-file}
473 @defopt imaxima-latex-macros-format-file
474 Macros used by @code{imaxima-dump-tex} to generate the format file.
477 @anchor{imaxima-latex-macros}
478 @anchor{imaxima-latex-macros-linear}
479 @defopt imaxima-latex-macros, imaxima-latex-macros-linear
480 A string that defines @emph{imaxima}-specific macros to format fractions
481 in regular and linear fashion.
484 @anchor{imaxima-latex-document-dimensions}
485 @defopt imaxima-latex-document-dimensions
486 A string the contains the document dimensions for @code{imaxima-latex}.
489 @anchor{imaxima-create-image-options}
490 @defopt imaxima-create-image-options
491 An association list of options that are used by the imaxima function
492 @code{imaxima-create-image}. For example, if one is using a dark
493 background in emacs, it may be preferable to set this option to
494 @code{(:ascent center)}, thereby removing the default mask option.
498 @node Line Breaking, Miscellaneous, Appearance, Options
499 @section Line Breaking
500 Imaxima usually does a decent job of breaking lines that are too wide
501 to fit in the buffer (thanks to the @code{breqn} LaTeX package).
502 However, this doesn't work so well for very long fractions,
503 superscripts and subscripts. Imaxima has two ways of dealing with
510 Rewriting the equation in a ``linear'' form which can be split over
514 The following options control how this is done.
517 @defopt imaxima-max-scale
518 Maximum amount of scaling allowed to fit wide equations in the buffer.
519 The default is @code{0.85}, which allows images to be scaled down to
520 85% of the original size. @code{nil} disables scaling and @code{t}
521 allows unlimited scaling.
524 @defopt imaxima-linearize-flag
525 Non-@code{nil} allows fractions, superscripts, subscripts and square
526 roots to be linearized to fit in the buffer. That is
536 $$a^b \quad a_b \quad {{a+b}\over{c+d}} \quad \sqrt{a+b}$$
544 expt(a,b) subscript(a,b) (a + b)/(c + d) (a + b)
548 $${\rm expt}(a,b) \quad {\rm subscript}(a,b) \quad (a+b)/(c+d) \quad (a+b)^{1/2}$$
552 @node Miscellaneous, , Line Breaking, Options
553 @section Miscellaneous
554 If the required files are in your path, you shouldn't normally need to
555 change these options.
557 @anchor{imaxima-latex-buffer-name}
558 @defopt imaxima-latex-buffer-name
559 The default name of the buffer created by @code{imaxima-latex}.
560 The default value is @code{*imaxima-latex*}.
565 @defopt imaxima-image-type
566 Image type used in the buffer. @acronym{PNG}, @acronym{JPEG},
567 @acronym{TIFF} and PostScript are supported. In my opinion
568 @acronym{PNG} gives the best results, but if your Emacs wasn't
569 compiled with @acronym{PNG} support you could try one of the others.
570 PostScript doesn't require Ghostscript to be installed. XEmacs can
571 not display PostScript images, so this type does not work in XEmacs.
575 @defopt imaxima-gs-program
576 Ghostscript executable
579 @defopt imaxima-gs-options
580 Options passed to @command{gs} when converting @acronym{EPS} to other
581 image formats. Older versions of Ghostscript don't support
582 anti-aliasing. In that case you might have to remove the options
583 @option{-dTextAlphaBits=4} and @option{-dGraphicsAlphaBits=4}.
586 @defopt imaxima-cp-program
587 The default `copy' program.
590 @defopt imaxima-dvips-program
594 @defopt imaxima-dvips-options
595 Command line options passed to @command{dvips} when converting
596 @acronym{EPS} files to @acronym{DVI}.
599 @anchor{imaxima-tmp-dir}
600 @defopt imaxima-tmp-dir
601 Directory used for temporary files created by imaxima.
602 @file{/tmp} by default.
605 @defopt imaxima-lisp-file
606 The Lisp file used to initialize Maxima.
609 @defopt imaxima-tex-program
613 @defopt imaxima-initex-option
614 Option passed to @TeX{} to start it in the ``initial'' form capable of
615 dumping format files.
618 @defopt imaxima-maxima-program
623 @defopt imaxima-maxima-options
624 Command line arguments passed to Maxima. If you have Maxima versions
625 compiled with different Lisps, you can use this to select which one to
626 use. E.g. @option{--lisp=cmucl} will choose the version compiled with
630 @defopt imaxima-startup-hook
631 Hook run when starting imaxima.
634 @defopt imaxima-exit-hook
635 Hook run when exiting imaxima.
638 @defopt imaxima-html-dir
639 When imaxima-to-html function is called, the function determines
640 the directory into which the session.html file and the
641 session-images directory are created. The default value is ``~''.
644 @anchor{imaxima-print-tex-file}
645 @defopt imaxima-print-tex-file
646 Name of the LaTeX file name to be created by
647 @code{imaxima-print-buffer}. Do not include ".tex" suffix. This file
648 will be stored in the directory @code{imaxima-tmp-dir}.
651 @anchor{imaxima-print-tex-command}
652 @defopt imaxima-print-tex-command
653 Command to run LaTeX on the file created by
654 @code{imaxima-print-buffer}. In the string '%s' is replaced by the name
655 of the tex file. e.g. "pdflatex %s; xpdf %s"
658 @node Imath minor mode, Index, Options, Top
659 @chapter Imath minor mode
660 The imath minor mode provides a small set of functions to aid
661 insert math formulas into plain text.
663 A math formula is written using a Maxima form whose syntax is
664 @{maxima a formula maxima@} where a formula is a string which can
665 be accepted as Maxima command input. C-c [ inserts a template
668 The other way to write a math formula is to use LaTeX form
669 whose syntax is @{latex a formula latex@} where a formula is
670 a valid LaTeX commands. C-c ] inserts a template for a latex
673 Example maxima and latex forms are:
675 @{maxima integrate(f(x),x) maxima@}
676 @{maxima sum(a[n],n,0,i) maxima@}
677 @{latex \\int @{f\\left(x\\right)@}@{\\;dx@} latex@}
678 @{latex \\sum_@{n=0@}^@{i@}@{a_@{n@}@} latex@}
681 Assuming the cursor position is right after a form or in the
682 middle, C-c ! transforms the form into the formula image using
683 the Imaxima functionality.
685 If the resulting image is not what you want, you may want to edit
686 the formula again. To do this, place the cursor right after the
687 image and C-c &. Then the image is removed and original form
688 appears at the position.
690 When saving the buffer into a file, images are
691 discarded. However, maxima forms and their corresponding latex
692 forms are kept there in the text. If the text is loaded again
693 into Emacs and imath minor mode is enabled, you can type C-c $ to
694 restore all the images for the forms in the buffer.
697 \C-c[ Compose Maxima form
698 \C-c] Compose Latex form
699 \C-c! Transform a form to an image
700 \C-c$ Transform all forms to images
701 \C-c& Remove the image to restore the original form text
704 You can export the imath mode buffer contents into HTML using
705 a command named imath-to-html. This command can be invoked by
706 M-x imath-to-html. Then a buffer is created, visiting a file
707 whose name is the same as the original imath text file, only
708 exception being .html as the file extension. Upon saving, the
709 file is placed in the same directory as the original file. Also
710 a directory is created whose name is the same as the imath text
711 file, but removing the extension and add -images. Images for
712 formulas are copied in this directory.
714 @node Index, , Imath minor mode, Top
722 @c time-stamp-format: "%:y-%02m-%02d %02H:%02M:%02S"