Math::Symbolic::Custom::LaTeXDumper - Math::Symbolic LaTeX output
use Math::Symbolic qw/parse_from_string/; use Math::Symbolic::Custom::LaTeXDumper; $term = parse_from_string(...); print $term->to_latex(...);
This class provides the to_latex()
method for all Math::Symbolic trees. It is a rewrite of the to_latex()
method that was supplied by Math::Symbolic
prior to version 0.201.
For details on how the custom method delegation model works, please have a look at the Math::Symbolic::Custom
and Math::Symbolic::Custom::Base
classes.
Please see the docs for Math::Symbolic::Custom::Base
for details, but you should not try to use the standard Exporter semantics with this class.
It returns a LaTeX representation of the Math::Symbolic tree it is called on. The LaTeX is meant to be included in a LaTeX source document. It does not include an enclosing math environment.
The method uses named parameter passing style. Valid parameters are:
Used to turn on the '.' (\cdot
) operators for all multiplications. Defaults to true, that is, the multiplication operators are not present.
Use '/' division operator instead of fractions. Defaults to false, that is, use fractions. See also: max_fractions
parameter.
Setting this parameter to a positive integer results in a limitation of the number of nested fractions. It defaults to 2
. Setting this to 0
results in arbitrarily nested fractions. To disable fractions altogether, set the no_fraction
parameter.
By default, the method includes all variables' signatures in parenthesis if present. Set this to true to omit variable signatures.
By default, all variable names are outputted as LaTeX in a way that makes them show up exactly as they did in your code. If you set this option to true, Math::Symbolic will try to replace as many greek character names with the appropriates symbols as possible.
Valid LaTeX symbols that are matched are:
Lower case letters: alpha, beta, gamma, delta, epsilon, zeta, eta, theta, iota, kappa, lambda, mu, nu, xi, pi, rho, sigma, tau, upsilon, phi, chi, psi, omega Variant forms of small letters: varepsilon, vartheta, varpi, varrho, varsigma, varphi Upper case letters: Gamma, Delta, Theta, Lambda, Xi, Pi, Sigma, Upsilon, Phi, Psi, Omega
Because not all variable names come out as you might want them to, you may use the 'variable_mappings' option to replace variable names in the output LaTeX stream with custom LaTeX. For example, the variable x_i should probably indicate an 'x' with a subscripted i. The argument to variable_mappings needs to be a hash reference which contains variable name / LaTeX mapping pairs.
If a variable is replaced in the above fashion, other options that modify the outcome of the conversion of variable names to LaTeX are ignored.
Set this option to a true value to have all underscores in variable names interpreted as subscripts. Once an underscore is encountered, the rest of the variable name is treated as subscripted. If multiple underscores are found, this mechanism works recursively.
Defaults to true
. Set to a false value to turn this off. This is automatically turned off for variables that are mapped to custom LaTeX by the variable_mappings
parameter.
By default, the dumper tries to convert exponents of 1/2 (or 0.5) or anything numeric that ends up being 1/2 to a square root. If this gives inconvenient results, set this option to a true value to turn the heuristics off.
New versions of this module can be found on http://steffen-mueller.net or CPAN. The module development takes place on Sourceforge at http://sourceforge.net/projects/math-symbolic/
Math::Symbolic::Custom Math::Symbolic::Custom::DefaultMods Math::Symbolic::Custom::DefaultDumpers Math::Symbolic::Custom::DefaultTests Math::Symbolic
Steffen M�ller, smueller@cpan.org
Copyright (C) 2006, 2008, 2011, 2013 by Steffen Mueller
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.