Comments
========

A comment in Maxima input is any text between /* and */.

The Maxima parser treats a comment as whitespace for the purpose of finding tokens in the input stream; a token always ends at a comment.  An input such as a/* foo */b contains two tokens, a and b, and not a single token ab.  Comments are otherwise ignored by Maxima; neither the content nor the location of comments is stored in parsed input expressions.

Comments can be nested to arbitrary depth.  The /* and */ delimiters form matching pairs.  There must be the same number of /* as there are */.

Examples:

     (%i1) /* aa is a variable of interest */  aa : 1234;
     (%o1)                         1234
     (%i2) /* Value of bb depends on aa */  bb : aa^2;
     (%o2)                        1522756
     (%i3) /* User-defined infix operator */  infix ("b");
     (%o3)                           b
     (%i4) /* Parses same as a b c, not abc */  a/* foo */b/* bar */c;
     (%o4)                         a b c
     (%i5) /* Comments /* can be nested /* to any depth */ */ */  1 + xyz;
     (%o5)                        xyz + 1

Categories: Syntax

Files
=====

A file is simply an area on a particular storage device which contains data or text.  Files on the disks are figuratively grouped into "directories". A directory is just a list of files.  Commands which deal with files are:

   appendfile           batch                 batchload
   closefile            file_output_append    filename_merge
   file_search          file_search_maxima    file_search_lisp
   file_search_demo     file_search_usage     file_search_tests
   file_type            file_type_lisp        file_type_maxima
   load                 load_pathname         loadfile
   loadprint            pathname_directory    pathname_name
   pathname_type        printfile             save
   stringout            with_stdout           writefile

When a file name is passed to functions like plot2d save or writefile and the file name does not include a path, Maxima stores the file in the current working directory.  The current working directory depends on the system like Windows or Linux and on the installation.

Functions and Variables for File Input and Output
=================================================

 -- Function: appendfile (FILENAME)

     Appends a console transcript to FILENAME.  appendfile is the same as writefile except that the transcript file, if it exists, is always appended.

     closefile closes the transcript file opened by appendfile or writefile.

     Categories: File output Console interaction

 -- Function: batch
     batch (FILENAME)
     batch (FILENAME, OPTION)
     batch (S)
     batch (S, OPTION)

     batch(FILENAME) reads Maxima expressions from FILENAME and evaluates them.  batch searches for FILENAME in the list file_search_maxima  See also file_search

     batch(S) reads Maxima expressions from the input stream S as created by openr. The behavior of batch in this case is the same as if the input were a file name, and in the remainder of this description, what is said about input files applies to input streams as well, except that the comments about searching for files do not apply to streams.

     batch(FILENAME, demo) is like demo(FILENAME). In this case batch searches for FILENAME in the list file_search_demo  See demo

     batch(FILENAME, test) is like run_testsuite with the option display_all=true.  For this case batch searches FILENAME in the list file_search_maxima and not in the list file_search_tests like run_testsuite.  Furthermore, run_testsuite runs tests which are in the list testsuite_files  With batch it is possible to run any file in a test mode, which can be found in the list file_search_maxima.  This is useful, when writing a test file.

     FILENAME comprises a sequence of Maxima expressions, each terminated with ; or $.  The special variable % and the function %th refer to previous results within the file.  The file may include :lisp constructs.  Spaces, tabs, and newlines in the file are ignored. A suitable input file may be created by a text editor or by the stringout function.

     batch reads each input expression from FILENAME, displays the input to the console, computes the corresponding output expression, and displays the output expression.  Input labels are assigned to the input expressions and output labels are assigned to the output expressions.  batch evaluates every input expression in the file unless there is an error.  If user input is requested (by asksign or askinteger for example) batch pauses to collect the requisite input and then continue.

     It may be possible to halt batch by typing control-C at the console.  The effect of control-C depends on the underlying Lisp implementation.

     batch has several uses, such as to provide a reservoir for working command lines, to give error-free demonstrations, or to help organize one's thinking in solving complex problems.

     batch evaluates its arguments.

     When called with no second argument or with the option demo, batch returns the path of FILENAME, if the argument is a file name, or the path of the file for which the input stream was opened, if the argument is a file input stream. If the argument is a string input stream, a representation of the input stream is returned.

     When called with the option test, the return value is a an empty list [] or a list with FILENAME and the numbers of the tests which have failed.

     See also load batchload and demo

     Categories: Session management File input

 -- Function: batchload
     batchload (FILENAME)
     batchload (S)

     Reads Maxima expressions from input file FILENAME or input stream S and evaluates them, without displaying the input or output expressions and without assigning labels to output expressions.  Printed output (such as produced by print or describe) is displayed, however.

     The special variable % and the function %th refer to previous results from the interactive interpreter, not results within the file. The file cannot include :lisp constructs.

     batchload evaluates its argument.

     batchload returns the path of FILENAME, if the argument is a file name, or the path of the file for which the input stream was opened, if the argument is a file input stream. If the argument is a string input stream, a representation of the input stream is returned.

     See also batch and load

     Categories: Session management File input

 -- Function: closefile ()

     Closes the transcript file opened by writefile or appendfile

     Categories: File output Console interaction

 -- Option variable: file_output_append
     Default value: false

     file_output_append governs whether file output functions append or truncate their output file.  When file_output_append is true, such functions append to their output file.  Otherwise, the output file is truncated.

     save stringout and with_stdout respect file_output_append.  Other functions which write output files do not respect file_output_append.  In particular, plotting and translation functions always truncate their output file, and tex and appendfile always append.

     Categories: File output Global flags

 -- Function: filename_merge (PATH, FILENAME)

     Constructs a modified path from PATH and FILENAME.  If the final component of PATH is of the form ###.SOMETHING, the component is replaced with FILENAME.SOMETHING.  Otherwise, the final component is simply replaced by FILENAME.

     The result is a Lisp pathname object.

     Categories: File input File output

 -- Function: file_search
     file_search (FILENAME)
     file_search (FILENAME, PATHLIST)

     file_search searches for the file FILENAME and returns the path to the file (as a string) if it can be found; otherwise file_search returns false.  file_search (FILENAME) searches in the default search directories, which are specified by the file_search_maxima file_search_lisp and file_search_demo variables.

     file_search first checks if the actual name passed exists, before attempting to match it to ``wildcard'' file search patterns. See file_search_maxima concerning file search patterns.

     The argument FILENAME can be a path and file name, or just a file name, or, if a file search directory includes a file search pattern, just the base of the file name (without an extension).  For example,

          file_search ("/home/wfs/special/zeta.mac");
          file_search ("zeta.mac");
          file_search ("zeta");

     all find the same file, assuming the file exists and /home/wfs/special/###.mac is in file_search_maxima.

     file_search (FILENAME, PATHLIST) searches only in the directories specified by PATHLIST, which is a list of strings.  The argument PATHLIST supersedes the default search directories, so if the path list is given, file_search searches only the ones specified, and not any of the default search directories.  Even if there is only one directory in PATHLIST, it must still be given as an one-element list.

     The user may modify the default search directories. See file_search_maxima

     file_search is invoked by load with file_search_maxima and file_search_lisp as the search directories.

     Categories: File input

 -- Option variable: file_search_maxima
 -- Option variable: file_search_lisp
 -- Option variable: file_search_demo
 -- Option variable: file_search_usage
 -- Option variable: file_search_tests

     These variables specify lists of directories to be searched by load demo and some other Maxima functions.  The default values of these variables name various directories in the Maxima installation.

     The user can modify these variables, either to replace the default values or to append additional directories.  For example,

          file_search_maxima: ["/usr/local/foo/###.mac",
              "/usr/local/bar/###.mac"]$

     replaces the default value of file_search_maxima, while

          file_search_maxima: append (file_search_maxima,
              ["/usr/local/foo/###.mac", "/usr/local/bar/###.mac"])$

     appends two additional directories.  It may be convenient to put such an expression in the file maxima-init.mac so that the file search path is assigned automatically when Maxima starts. See also Introduction for Runtime Environment.

     Multiple filename extensions and multiple paths can be specified by special ``wildcard'' constructions.  The string ### expands into the sought-after name, while a comma-separated list enclosed in curly braces {foo,bar,baz} expands into multiple strings.  For example, supposing the sought-after name is neumann,

          "/home/{wfs,gcj}/###.{lisp,mac}"

     expands into /home/wfs/neumann.lisp, /home/gcj/neumann.lisp,
     /home/wfs/neumann.mac, and /home/gcj/neumann.mac.

     Categories: File input Global variables

 -- Function: file_type (FILENAME)

     Returns a guess about the content of FILENAME, based on the filename extension.  FILENAME need not refer to an actual file; no attempt is made to open the file and inspect the content.

     The return value is a symbol, either object, lisp, or maxima.  If the extension is matches one of the values in file_type_maxima, file_type returns maxima.  If the extension matches one of the values in file_type_lisp, file_type returns lisp.  If none of the above, file_type returns object.

     See also pathname_type

     See file_type_maxima and file_type_lisp for the default values.

     Examples:

          (%i2) map('file_type,
                    ["test.lisp", "test.mac", "test.dem", "test.txt"]);
          (%o2)            [lisp, maxima, maxima, object]

     Categories: File input

 -- Option variable: file_type_lisp
     Default value:  [l, lsp, lisp]

     file_type_lisp is a list of file extensions that maxima recognizes as denoting a Lisp source file.

     See also file_type

 -- Option variable: file_type_maxima
     Default value:  [mac, mc, demo, dem, dm1, dm2, dm3, dmt, wxm]

     file_type_maxima is a list of file extensions that maxima recognizes as denoting a Maxima source file.

     See also file_type

 -- Function: load (FILENAME)

     Evaluates expressions in FILENAME, thus bringing variables, functions, and other objects into Maxima.  The binding of any existing object is clobbered by the binding recovered from FILENAME.

     FILENAME must be a string, symbol, or Lisp pathname (as created by filename_merge). To find the file, load calls file_search with file_search_maxima and file_search_lisp as the search directories.  If load succeeds, it returns the name of the file.  Otherwise load prints an error message.

     load works equally well for Lisp code and Maxima code.  Files created by save translate_file and compile_file which create Lisp code, and stringout which creates Maxima code, can all be processed by load.  load calls loadfile to load Lisp files and batchload to load Maxima files.

     load does not recognize :lisp constructs in Maxima files, and while processing FILENAME, the global variables _, __, %, and %th have whatever bindings they had when load was called.

     Note also that structures will only be read back as structures if they have been defined by defstruct before the load command is called.

     See also loadfile for Lisp files; and batch batchload and demo for Maxima files.

     See file_search for more detail about the file search mechanism. The numericalio chapter describes many functions for loading csv and other data files.

     During Maxima file loading, the variable load_pathname is bound to the pathname of the file being loaded.

     load evaluates its argument.

     Categories: Session management File input

 -- System variable: load_pathname
     Default value: false

     When a file is loaded with the functions load loadfile or batchload the system variable load_pathname is bound to the pathname of the file which is processed.

     The variable load_pathname can be accessed from the file during the loading.

     Example:

     Suppose we have a batchfile test.mac in the directory

     "/home/dieter/workspace/mymaxima/temp/" with the following commands

          print("The value of load_pathname is: ", load_pathname)$
          print("End of batchfile")$

     then we get the following output

          (%i1) load("/home/dieter/workspace/mymaxima/temp/test.mac")$
          The value of load_pathname is:
                             /home/dieter/workspace/mymaxima/temp/test.mac
          End of batchfile

     Categories: File input

 -- Function: loadfile (FILENAME)

     Evaluates Lisp expressions in FILENAME.  loadfile does not invoke file_search so filename must include the file extension and as much of the path as needed to find the file.

     loadfile can process files created by save translate_file and compile_file  The user may find it more convenient to use load instead of loadfile.

     Categories: Session management File input

 -- Option variable: loadprint
     Default value: true

     loadprint tells whether to print a message when a file is loaded.

       * When loadprint is true, always print a message.

       * When loadprint is 'loadfile, print a message only if a file is loaded by the function loadfile.

       * When loadprint is 'autoload, print a message only if a file is automatically loaded. See setup_autoload

       * When loadprint is false, never print a message.

     Categories: File input Global flags

 -- Function: directory (PATH)

     Returns a list of the files and directories found in PATH in the file system.

     PATH may contain wildcard characters (i.e., characters which represent unspecified parts of the path), which include at least the asterisk on most systems, and possibly other characters, depending on the system.

     directory relies on the Lisp function DIRECTORY, which may have implementation-specific behavior.

     Categories: File input

 -- Function: pathname_directory (PATHNAME)
 -- Function: pathname_name (PATHNAME)
 -- Function: pathname_type (PATHNAME)

     These functions return the components of PATHNAME.

     Examples:

          (%i1) pathname_directory("/home/dieter/maxima/changelog.txt");
          (%o1)                 /home/dieter/maxima/
          (%i2) pathname_name("/home/dieter/maxima/changelog.txt");
          (%o2)                       changelog
          (%i3) pathname_type("/home/dieter/maxima/changelog.txt");
          (%o3)                          txt

     Categories: File input

 -- Function: printfile (PATH)

     Prints the file named by PATH to the console.  PATH may be a string or a symbol; if it is a symbol, it is converted to a string.

     If PATH names a file which is accessible from the current working directory, that file is printed to the console.  Otherwise, printfile attempts to locate the file by appending PATH to each of the elements of file_search_usage via filename_merge

     printfile returns PATH if it names an existing file, or otherwise the result of a successful filename merge.

     Categories: File input Console interaction

 -- Function: save
     save (FILENAME, NAME_1, NAME_2, NAME_3, ...)
     save (FILENAME, values, functions, labels, ...)
     save (FILENAME, [M, N])
     save (FILENAME, NAME_1=EXPR_1, ...)
     save (FILENAME, all)
     save (FILENAME, NAME_1=EXPR_1, NAME_2=EXPR_2, ...)

     Stores the current values of NAME_1, NAME_2, NAME_3, ..., in FILENAME.  The arguments are the names of variables, functions, or other objects.  If a name has no value or function associated with it, it is ignored.  save returns FILENAME.

     save stores data in the form of Lisp expressions. If FILENAME ends in .lisp the data stored by save may be recovered by load (FILENAME). See load

     The global flag file_output_append governs whether save appends or truncates the output file.  When file_output_append is true, save appends to the output file.  Otherwise, save truncates the output file.  In either case, save creates the file if it does not yet exist.

     The special form save (FILENAME, values, functions, labels, ...) stores the items named by values functions labels etc.  The names may be any specified by the variable infolists  values comprises all user-defined variables.

     The special form save (FILENAME, [M, N]) stores the values of input and output labels M through N.  Note that M and N must be literal integers.  Input and output labels may also be stored one by one, e.g., save ("foo.1", %i42, %o42). save (FILENAME, labels) stores all input and output labels. When the stored labels are recovered, they clobber existing labels.

     The special form save (FILENAME, NAME_1=EXPR_1, NAME_2=EXPR_2, ...) stores the values of EXPR_1, EXPR_2, ..., with names NAME_1, NAME_2, ... It is useful to apply this form to input and output labels, e.g., save ("foo.1", aa=%o88).  The right-hand side of the equality in this form may be any expression, which is evaluated.  This form does not introduce the new names into the current Maxima environment, but only stores them in FILENAME.

     These special forms and the general form of save may be mixed at will. For example, save (FILENAME, aa, bb, cc=42, functions, [11, 17]).

     The special form save (FILENAME, all) stores the current state of Maxima.  This includes all user-defined variables, functions, arrays, etc., as well as some automatically defined items.  The saved items include system variables, such as file_search_maxima or showtime if they have been assigned new values by the user; see myoptions

     save evaluates FILENAME and quotes all other arguments.

     Categories: Session management File output

 -- Function: stringout
     stringout (FILENAME, EXPR_1, EXPR_2, EXPR_3, ...)
     stringout (FILENAME, [M, N])
     stringout (FILENAME, input)
     stringout (FILENAME, functions)
     stringout (FILENAME, values)

     stringout writes expressions to a file in the same form the expressions would be typed for input.  The file can then be used as input for the batch or demo commands, and it may be edited for any purpose. stringout can be executed while writefile is in progress.

     The global flag file_output_append governs whether stringout appends or truncates the output file.  When file_output_append is true, stringout appends to the output file.  Otherwise, stringout truncates the output file.  In either case, stringout creates the file if it does not yet exist.

     The general form of stringout writes the values of one or more expressions to the output file.  Note that if an expression is a variable, only the value of the variable is written and not the name of the variable.  As a useful special case, the expressions may be input labels (%i1, %i2, %i3, ...) or output labels (%o1, %o2, %o3, ...).

     If grind is true, stringout formats the output using the grind format.  Otherwise the string format is used.  See grind and string.

     The special form stringout (FILENAME, [M, N]) writes the values of input labels m through n, inclusive.

     The special form stringout (FILENAME, input) writes all input labels to the file.

     The special form stringout (FILENAME, functions) writes all user-defined functions (named by the global list functions) to the file.

     The special form stringout (FILENAME, values) writes all user-assigned variables (named by the global list values) to the file. Each variable is printed as an assignment statement, with the name of the variable, a colon, and its value.  Note that the general form of stringout does not print variables as assignment statements.

     Categories: Session management File output

 -- Function: with_stdout
     with_stdout (F, EXPR_1, EXPR_2, EXPR_3, ...)
     with_stdout (S, EXPR_1, EXPR_2, EXPR_3, ...)

     Evaluates EXPR_1, EXPR_2, EXPR_3, ... and writes any output thus generated to a file F or output stream S.  The evaluated expressions are not written to the output.  Output may be generated by print display grind among other functions.

     The global flag file_output_append governs whether with_stdout appends or truncates the output file F.  When file_output_append is true, with_stdout appends to the output file.  Otherwise, with_stdout truncates the output file.  In either case, with_stdout creates the file if it does not yet exist.

     with_stdout returns the value of its final argument.

     See also writefile and display2d

          (%i1) with_stdout ("tmp.out", for i:5 thru 10 do
                print (i, "! yields", i!))$
          (%i2) printfile ("tmp.out")$
          5 ! yields 120
          6 ! yields 720
          7 ! yields 5040
          8 ! yields 40320
          9 ! yields 362880
          10 ! yields 3628800

     Categories: File output

 -- Function: writefile (FILENAME)

     Begins writing a transcript of the Maxima session to FILENAME. All interaction between the user and Maxima is then recorded in this file, just as it appears on the console.

     As the transcript is printed in the console output format, it cannot be reloaded into Maxima.  To make a file containing expressions which can be reloaded, see save and stringout  save stores expressions in Lisp form, while stringout stores expressions in Maxima form.

     The effect of executing writefile when FILENAME already exists depends on the underlying Lisp implementation; the transcript file may be clobbered, or the file may be appended.  appendfile always appends to the transcript file.

     It may be convenient to execute playback after writefile to save the display of previous interactions.  As playback displays only the input and output variables (%i1, %o1, etc.), any output generated by a print statement in a function (as opposed to a return value) is not displayed by playback.

     closefile closes the transcript file opened by writefile or appendfile.

     Categories: File output Console interaction

Functions and Variables for TeX Output
======================================

Note that the built-in TeX output functionality of wxMaxima makes no use of the functions described here but uses its own implementation instead.

 -- Function: tex
     tex (EXPR)
     tex (EXPR, DESTINATION)
     tex (EXPR, false)
     tex (LABEL)
     tex (LABEL, DESTINATION)
     tex (LABEL, false)

     Prints a representation of an expression suitable for the TeX document preparation system.  The result is a fragment of a document, which can be copied into a larger document but not processed by itself.

     tex (EXPR) prints a TeX representation of EXPR on the console.

     tex (LABEL) prints a TeX representation of the expression named by LABEL and assigns it an equation label (to be displayed to the left of the expression).  The TeX equation label is the same as the Maxima label.

     DESTINATION may be an output stream or file name.  When DESTINATION is a file name, tex appends its output to the file.  The functions openw and opena create output streams.

     tex (EXPR, false) and tex (LABEL, false) return their TeX output as a string.

     tex evaluates its first argument after testing it to see if it is a label.  Quote-quote '' forces evaluation of the argument, thereby defeating the test and preventing the label.

     See also tex1 and texput

     Examples:

          (%i1) integrate (1/(1+x^3), x);
                                              2 x - 1
                            2            atan(-------)
                       log(x  - x + 1)        sqrt(3)    log(x + 1)
          (%o1)      - --------------- + ------------- + ----------
                              6             sqrt(3)          3
          (%i2) tex (%o1);
          $$-{{\log \left(x^2-x+1\right)}\over{6}}+{{\arctan \left({{2\,x-1
           }\over{\sqrt{3}}}\right)}\over{\sqrt{3}}}+{{\log \left(x+1\right)
           }\over{3}}\leqno{\tt (\%o1)}$$
          (%o2)                          (\%o1)
          (%i3) tex (integrate (sin(x), x));
          $$-\cos x$$
          (%o3)                           false
          (%i4) tex (%o1, "foo.tex");
          (%o4)                          (\%o1)

     tex (EXPR, false) returns its TeX output as a string.

          (%i1) S : tex (x * y * z, false);
          (%o1) $$x\,y\,z$$
          (%i2) S;
          (%o2) $$x\,y\,z$$

     Categories: TeX output File output

 -- Function: tex1 (E)

     Returns a string which represents the TeX output for the expressions E. The TeX output is not enclosed in delimiters for an equation or any other environment.

     See also tex and texput

     Examples:

          (%i1) tex1 (sin(x) + cos(x));
          (%o1)                     \sin x+\cos x

 -- Function: texput
     texput (A, S)
     texput (A, F)
     texput (A, S, OPERATOR_TYPE)
     texput (A, [S_1, S_2], matchfix)
     texput (A, [S_1, S_2, S_3], matchfix)

     Assign the TeX output for the atom A, which can be a symbol or the name of an operator.

     texput (A, S) causes the tex function to interpolate the string S into the TeX output in place of A.

     texput (A, F) causes the tex function to call the function F to generate TeX output.  F must accept one argument, which is an expression which has operator A, and must return either a string (the TeX output) or false, indicating that the TeX function in effect when texput is called should handle the expression. F may call tex1 to generate TeX output for the arguments of the input expression.

     texput (A, S, OPERATOR_TYPE), where OPERATOR_TYPE is prefix, infix, postfix, nary, or nofix, causes the tex function to interpolate S into the TeX output in place of A, and to place the interpolated text in the appropriate position.

     texput (A, [S_1, S_2], matchfix) causes the tex function to interpolate S_1 and S_2 into the TeX output on either side of the arguments of A.  The arguments (if more than one) are separated by commas.

     texput (A, [S_1, S_2, S_3], matchfix) causes the tex function to interpolate S_1 and S_2 into the TeX output on either side of the arguments of A, with S_3 separating the arguments.

     See also tex and tex1

     Examples:

     Assign TeX output for a variable.

          (%i1) texput (me,"\\mu_e");
          (%o1)                         \mu_e
          (%i2) tex (me);
          $$\mu_e$$
          (%o2)                         false

     Assign TeX output for an ordinary function (not an operator).

          (%i1) texput (lcm, "\\mathrm{lcm}");
          (%o1)                     \mathrm{lcm}
          (%i2) tex (lcm (a, b));
          $$\mathrm{lcm}\left(a , b\right)$$
          (%o2)                         false

     Call a function to generate TeX output.

          (%i1) texfoo (e) := block ([a, b], [a, b] : args (e),
            concat("\\left[\\stackrel{",tex1(b),"}{",tex1(a),"}\\right]"))$
          (%i2) texput (foo, texfoo);
          (%o2)                        texfoo
          (%i3) tex (foo (2^x, %pi));
          $$\left[\stackrel{\pi}{2^{x}}\right]$$
          (%o3)                         false

     Assign TeX output for a prefix operator.

          (%i1) prefix ("grad");
          (%o1)                         grad
          (%i2) texput ("grad", " \\nabla ", prefix);
          (%o2)                        \nabla
          (%i3) tex (grad f);
          $$ \nabla f$$
          (%o3)                         false

     Assign TeX output for an infix operator.

          (%i1) infix ("~");
          (%o1)                           ~
          (%i2) texput ("~", " \\times ", infix);
          (%o2)                        \times
          (%i3) tex (a ~ b);
          $$a \times b$$
          (%o3)                         false

     Assign TeX output for a postfix operator.

          (%i1) postfix ("##");
          (%o1)                          ##
          (%i2) texput ("##", "!!", postfix);
          (%o2)                          !!
          (%i3) tex (x ##);
          $$x!!$$
          (%o3)                         false

     Assign TeX output for a nary operator.

          (%i1) nary ("@@");
          (%o1)                          @@
          (%i2) texput ("@@", " \\circ ", nary);
          (%o2)                         \circ
          (%i3) tex (a @@ b @@ c @@ d);
          $$a \circ b \circ c \circ d$$
          (%o3)                         false

     Assign TeX output for a nofix operator.

          (%i1) nofix ("foo");
          (%o1)                          foo
          (%i2) texput ("foo", "\\mathsc{foo}", nofix);
          (%o2)                     \mathsc{foo}
          (%i3) tex (foo);
          $$\mathsc{foo}$$
          (%o3)                         false

     Assign TeX output for a matchfix operator.

          (%i1) matchfix ("<<", ">>");
          (%o1)                          <<
          (%i2) texput ("<<", [" \\langle ", " \\rangle "], matchfix);
          (%o2)                [ \langle ,  \rangle ]
          (%i3) tex (<<a>>);
          $$ \langle a \rangle $$
          (%o3)                         false
          (%i4) tex (<<a, b>>);
          $$ \langle a , b \rangle $$
          (%o4)                         false
          (%i5) texput ("<<", [" \\langle ", " \\rangle ", " \\, | \\,"],
                matchfix);
          (%o5)           [ \langle ,  \rangle ,  \, | \,]
          (%i6) tex (<<a>>);
          $$ \langle a \rangle $$
          (%o6)                         false
          (%i7) tex (<<a, b>>);
          $$ \langle a \, | \,b \rangle $$
          (%o7)                         false

     Categories: TeX output

 -- Function: get_tex_environment (OP)
 -- Function: set_tex_environment (OP, BEFORE, AFTER)

     Customize the TeX environment output by tex. As maintained by these functions, the TeX environment comprises two strings: one is printed before any other TeX output, and the other is printed after.

     Only the TeX environment of the top-level operator in an expression is output; TeX environments associated with other operators are ignored.

     get_tex_environment returns the TeX environment which is applied to the operator OP; returns the default if no other environment has been assigned.

     set_tex_environment assigns the TeX environment for the operator OP.

     Examples:

          (%i1) get_tex_environment (":=");
          (%o1) [
          \begin{verbatim}
          , ;
          \end{verbatim}
          ]
          (%i2) tex (f (x) := 1 - x);

          \begin{verbatim}
          f(x):=1-x;
          \end{verbatim}

          (%o2)                         false
          (%i3) set_tex_environment (":=", "$$", "$$");
          (%o3)                       [$$, $$]
          (%i4) tex (f (x) := 1 - x);
          $$f(x):=1-x$$
          (%o4)                         false

     Categories: TeX output

 -- Function: get_tex_environment_default ()
 -- Function: set_tex_environment_default (BEFORE, AFTER)

     Customize the TeX environment output by tex. As maintained by these functions, the TeX environment comprises two strings: one is printed before any other TeX output, and the other is printed after.

     get_tex_environment_default returns the TeX environment which is applied to expressions for which the top-level operator has no specific TeX environment (as assigned by set_tex_environment).

     set_tex_environment_default assigns the default TeX environment.

     Examples:

          (%i1) get_tex_environment_default ();
          (%o1)                       [$$, $$]
          (%i2) tex (f(x) + g(x));
          $$g\left(x\right)+f\left(x\right)$$
          (%o2)                         false
          (%i3) set_tex_environment_default ("\\begin{equation}
          ", "
          \\end{equation}");
          (%o3) [\begin{equation}
          ,
          \end{equation}]
          (%i4) tex (f(x) + g(x));
          \begin{equation}
          g\left(x\right)+f\left(x\right)
          \end{equation}
          (%o4)                         false

     Categories: TeX output

Functions and Variables for Fortran Output
==========================================

 -- Option variable: fortindent
     Default value: 0

     fortindent controls the left margin indentation of expressions printed out by the fortran command.  0 gives normal printout (i.e., 6 spaces), and positive values will causes the expressions to be printed farther to the right.

     Categories: Translation and compilation

 -- Function: fortran (EXPR)

     Prints EXPR as a Fortran statement. The output line is indented with spaces. If the line is too long, fortran prints continuation lines. fortran prints the exponentiation operator ^ as **, and prints a complex number a + b %i in the form (a,b).

     EXPR may be an equation.  If so, fortran prints an assignment statement, assigning the right-hand side of the equation to the left-hand side. In particular, if the right-hand side of EXPR is the name of a matrix, then fortran prints an assignment statement for each element of the matrix.

     If EXPR is not something recognized by fortran, the expression is printed in grind format without complaint. fortran does not know about lists, arrays, or functions.

     fortindent controls the left margin of the printed lines. 0 is the normal margin (i.e., indented 6 spaces).  Increasing fortindent causes expressions to be printed further to the right.

     When fortspaces is true, fortran fills out each printed line with spaces to 80 columns.

     fortran evaluates its arguments; quoting an argument defeats evaluation. fortran always returns done.

     See also the function function_f90, f90 for printing one or more expressions as a Fortran 90 program.

     Examples:

     (%i1) expr: (a + b)^12$
     (%i2) fortran (expr);
           (b+a)**12
     (%o2)                         done
     (%i3) fortran ('x=expr);
           x = (b+a)**12
     (%o3)                         done
     (%i4) fortran ('x=expand (expr));
           x = b**12+12*a*b**11+66*a**2*b**10+220*a**3*b**9+495*a**4*b**8+792
          1   *a**5*b**7+924*a**6*b**6+792*a**7*b**5+495*a**8*b**4+220*a**9*b
          2   **3+66*a**10*b**2+12*a**11*b+a**12
     (%o4)                         done
     (%i5) fortran ('x=7+5*%i);
           x = (7,5)
     (%o5)                         done
     (%i6) fortran ('x=[1,2,3,4]);
           x = [1,2,3,4]
     (%o6)                         done
     (%i7) f(x) := x^2$
     (%i8) fortran (f);
           f
     (%o8)                         done

     Categories: Translation and compilation

 -- Option variable: fortspaces
     Default value: false

     When fortspaces is true, fortran fills out each printed line with spaces to 80 columns.

     Categories: Translation and compilation