functions - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


How latex Formats Functions

 

Description

Examples

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. If such a procedure exists (not the case, but as an example), 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.

• 

Since Maple 2021, there are no more pre-defined latex/ functions for anything. Instead, the latex command translates what the Maple Typesetting package produces as display. In this way everything you see on the screen can be translated to LaTeX as you see it; for details about that see latex.

Examples

Although latex produces a LaTeX version of the Bessel function of the first kind, BesselJ, and of the hypergeometric function based on the display for them by the Typesetting package, as an exercise consider a latex/BesselJ and latex/hypergeom routines to produce their mathematical notation. For BesselJ,latex/BesselJ would need to produce Jnz. This is how you can achieve that:

`latex/BesselJ` := proc(a,z)
    sprintf("{ {\\rm J}_{%s}(%s) }",cat("", latex(a, output = string)), cat("", latex(z, output = string)))
end proc:

With this procedure, the translation is:

latexBesselJn,z+1

{ {\rm J}_{n}(z +1) }

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 -> latex(u, output = string), A0) end if;
    if nB = 0 then B, nB := [`\\ `], 1 else B := map(u -> latex(u, output = string), B0) end if;
    z := latex(z0, output = string);
    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.

latexhypergeoma,b,c,z

{\mbox{$_2$F$_1$}(a,b;\,c;\,z)}

latexhypergeoma,c,z

{\mbox{$_1$F$_1$}(a;\,c;\,z)}

latexhypergeom,c,z

{\mbox{$_0$F$_1$}(\ ;\,c;\,z)}

See Also

latex