 latex - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

latex

produce output suitable for LaTeX 2e printing

 Calling Sequence latex(expr, options) latex(expr, filename, options)

Parameters

 expr - any expression filename - (optional) file in which to put the output options - zero or more of the options described below

Options

 • append : true or false

Append to the output file filename instead of overwriting it

 • output : one of file, string, or terminal

Specify whether output should be written to filename, returned as a string, or printed as terminal output, respectively.  The default is output=file when parameter filename is provided, and output=terminal otherwise.

Description

 • The latex function produces output which is suitable for printing the input expr with a LaTeX 2e processor. It knows how to format integrals, limits, sums, products and matrices.
 • The mathematical format is taken, in general, from the CRC handbook or the Handbook of Mathematical functions.
 • When expr is a named table, it is evaluated before translation. Procedures and modules are not automatically evaluated.
 • The inert functions Sum, Int, Diff, Limit, and Log can be used instead of sum, int, diff, limit, and log to prevent evaluation.
 • It is possible to extend the abilities of latex to format other objects by defining a procedure with the name latex/functionname. The latex function will call this procedure when it encounters a function call to functionname within expr.  For more information, see latex/functions.
 • Note that the output of the latex command does not include the commands to invoke the latex math environment.
 • The function latex produces output as a side-effect, and returns NULL as the function value.  Therefore the ditto commands, % and %%, will not recall the LaTeX output.
 • When called with more than one argument, the second argument must be a string and is used as the name of a file on which to write the output. The file is overwritten unless the optional third argument, which must be the name append is given, which causes output to be appended to the file if it already exists.

Examples

 > $\mathrm{latex}\left({x}^{2}+{y}^{2}={z}^{2}\right)$
 {x}^{2}+{y}^{2}={z}^{2}

Put this output in the file LatexFile

 > $\mathrm{latex}\left({x}^{2}+{y}^{2}={z}^{2},\mathrm{LatexFile}\right)$
 > $\mathrm{latex}\left(\mathrm{Int}\left(\frac{1}{{x}^{2}+1},x\right)=\mathrm{int}\left(\frac{1}{{x}^{2}+1},x\right)\right)$
 \int \! \left( {x}^{2}+1 \right) ^{-1}\,{\rm d}x=\arctan \left( x \right)

Return the result as a string

 > $\mathrm{latex}\left(\mathrm{BesselK}\left(\mathrm{\nu },z\right)+\mathrm{BesselJ}\left(\mathrm{\nu },z\right),\mathrm{output}=\mathrm{string}\right)$
 ${"\left\{\left\{\sl K\right\}_\left\{\nu\right\}\left\left(z\right\right)\right\}+\left\{\left\{\sl J\right\}_\left\{\nu\right\}\left\left(z\right\right)\right\}"}$ (1)

Compatibility

 • The output option was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

 See Also