How latex Formats Functions - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Input and Output : Translation : LaTeX : latex/functions

How latex Formats Functions

Description

 • When latex processes a Maple object of type function (i.e., an unevaluated function call), it checks to see if there exists a procedure by the name of latex/function_name, where function_name is the name of the function.  If such a procedure exists, it is used to format the function call.
 • For instance, invoking latex(Int(exp(x), x=1..3)) causes latex to check to see if there is a procedure by the name of latex/Int. Since such a procedure exists, the above call to latex returns the result of latex/Int(exp(x), x=1..3) as its value.  This allows LaTeX to produce standard mathematical output in most situations.
 • If such a procedure does not exist, latex formats the function call by recursively formatting the operands to the function call and inserting parentheses and commas at the appropriate points.
 • Maple has pre-defined latex/ functions for the following constructs:

 @ @@ D Diff Int Limit Log Sum abs binomial diff exp factorial int limit ln log10 log2 sum

 • Standard mathematical functions such as sin, cos, and tan are converted to  \sin,  \cos, and  \tan.  See latex/names for a description of how this is done.

Examples

 > $\mathrm{latex}\left({∫}{ⅇ}^{x}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}x\right)$
 \int \!{{\rm e}^{x}}\,{\rm d}x
 > $\mathrm{latex}\left(\underset{x→{0}^{-}}{{lim}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(3+y\left(x\right)\right)\right)$
 \lim _{x\rightarrow 0^{-}}3+y \left( x \right)

A procedure that prints the Bessel function of the first kind, BesselJ, in its standard notation, $J[n]\left(z\right)$, when translating to LaTeX.

 > latex/BesselJ := proc(a,z)     sprintf("{ {\\rm J}_{%a}(%a) }",latex/print(a),latex/print(z)) end proc:

With this procedure, the translation is:

 > $\mathrm{latex}\left(\mathrm{BesselJ}\left(n,z\right)\right)$
 { {\rm J}_{"n"}("z") }

A more sophisticated procedure, for the hypergeometric function pFq:

 > latex/hypergeom := proc(A0, B0, z0) local nA, nB, pFq, p, q, A, B, z;     nA, nB := nops(A0), nops(B0);     pFq := cat('\\mbox{$_',nA,'$F$_',nB,'$}');     if nA = 0 then A, nA := [\\ ], 1 else A := map(u -> cat(latex/print(u)), A0) end if;     if nB = 0 then B, nB := [\\ ], 1 else B := map(u -> cat(latex/print(u)), B0) end if;     z := cat(latex/print(z0));     p := op(map(u -> (u, ','), A[1 .. -2])), A[-1];     q := op(map(u -> (u, ','), B[1 .. -2])), B[-1];     cat({, pFq, (, p, ;\\,, q, ;\\,, z, )}) end proc:

With this procedure, the translation of the three 2F1, 1F1, and 0F1 functions is as follows.

 > $\mathrm{latex}\left(\mathrm{hypergeom}\left(\left[a,b\right],\left[c\right],z\right)\right)$
 {\mbox{$_2$F$_1$}(a,b;\,c;\,z)}
 > $\mathrm{latex}\left(\mathrm{hypergeom}\left(\left[a\right],\left[c\right],z\right)\right)$
 {\mbox{$_1$F$_1$}(a;\,c;\,z)}
 > $\mathrm{latex}\left(\mathrm{hypergeom}\left(\left[\right],\left[c\right],z\right)\right)$
 {\mbox{$_0$F$_1$}(\ ;\,c;\,z)}

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam