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
|
|
>
|
|
>
|
|
\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, , 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:
>
|
|
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.
>
|
|
{\mbox{$_2$F$_1$}(a,b;\,c;\,z)}
| |
>
|
|
{\mbox{$_1$F$_1$}(a;\,c;\,z)}
| |
>
|
|
{\mbox{$_0$F$_1$}(\ ;\,c;\,z)}
| |
|
|