# FreeBSD Manual Pages

Number::WithError::LaTUser)Contributed Perl DocumenNumber::WithError::LaTeX(3)NAMENumber::WithError::LaTeX - LaTeX output for Number::WithErrorSYNOPSISuse Number::WithError::LaTeX; my $num = Number::WithError::LaTeX->new(5.647, 0.31); print $num . "\n"; # prints '5.65e+00 +/- 3.1e-01' # (I.e. it automatically does scientific rounding) print $num->latex() . "\n"; # prints '5.65 \cdot 10^{0} \pm 3.1 \cdot 10^{-1}' print $num->latex(radix => ',', enclose => '$') . "\n"; # prints '$5,\!65 \cdot 10^{0} \pm 3,\!1 \cdot 10^{-1}$' print $num->encode("This will encode an e-acute (".chr(0xe9).") as \\'e") . "\n"; # Delegated to TeX::Encode::encode(). # prints 'This is a German umlaut: \"a'DESCRIPTIONThis class is a subclass of Number::WithError. It provides the same interface and the same exports. It adds several methods to every object. The main functionality is provided by "latex()", which dumps the object as valid LaTeX code. Also, "encode()" is a convenient way to encode any UTF-8 string into TeX. It is just a convenience thing since it is delegated to TeX::Encode. Unlike "Number::WithError", this module requires perl version 5.8 or later. (That is the rationale for creating a separate distribution, too.)EXPORTThis module exports the following subroutines on demand. It supports the ":all" Exporter tag to export all of them. The subroutines are documented in Number::WithError.witherrorwitherror_bigMETHODSThis is a list of public methods.latexThis method stringifies the object as valid LaTeX code. The returned string is valid in a LaTeX math mode. That means, you will have to enclose it in dollars or in an "equation" environment by default. The method takes named parameters. All parameters are optional. The "enclose" parameter can set a string to enclose the produced latex code in. This can be either a simple string like "$" or an array reference containing two strings. Those two strings will be used for the start and end respectively. (For environments.) Example: (let $obj be '5.6e-01 +/- 2.3e-02') $obj->latex(enclose => '$'); # returns '$5.6 \cdot 10^{-1} \pm 2.3 \cdot 10^{-2}$' The asymmetric environment-like "enclose" can be used as follows: $obj->latex(enclose => ['\begin{equation}', '\end{equation}']); # returns'\begin{equation}5.6 \cdot 10^{-1} \pm 2.3 \cdot 10^{-2}\end{equation}' There are two convenience methods "latex_math" and "latex_equation" which do exactly what the above examples demonstrated. The "radix" parameter can set the radix (decimalpoint) used. The default is a dot ("."). If you use a comma, LaTeX will generally typeset it in a way that results in a space after the comma. Since that is not desireable, using a "," as the radix results in the radix being set as ",\!". An example can be found in the synopsis.latex_mathWorks exactly like "latex()" except that the "enclose" string defaults to "$".latex_equationWorks exactly like "latex()" except that the "enclose" string defaults to the environment "\begin{equation}\n" and "\n\end{equation}".encodeThis method encodes an arbitrary UTF-8 string as TeX. Syntax: my $encoded = $obj->encode($string); For detailed documentation, please refer to TeX::Encode.SUPPORTBugs should be reported via the CPAN bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Number-WithError-LaTeX> For other issues, contact the author.SEE ALSOIt is important that you have a look at the TeX::Encode module if you use the "encode()" method. The "decode()" operation from that module, however, is not supported by "Number::WithError::LaTeX". You may use Math::BigFloat with this module. Also, it should be possible to use Math::Symbolic to calculate larger formulas. Just assign a "Number::WithError::LaTeX" object to the "Math::Symbolic" variables and it should work. You also possibly want to have a look at the prefork pragma. The test suite is implemented using the Test::LectroTest module. In order to keep the total test time in reasonable bounds, the default number of test attempts to falsify the test properties is kept at a low number of 100. You can enable more rigorous testing by setting the environment variable "PERL_TEST_ATTEMPTS" to a higher value. A value in the range of 1500 to 3000 is probably a good idea, but takes a long time to test.AUTHORSteffen Mueller <modules at steffen-mueller dot net>, <http://steffen-mueller.net/>COPYRIGHTCopyright 2006 Steffen Mueller. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.32.1 2006-12-20 Number::WithError::LaTeX(3)

NAME | SYNOPSIS | DESCRIPTION | EXPORT | METHODS | SUPPORT | SEE ALSO | AUTHOR | COPYRIGHT

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=Number::WithError::LaTeX&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>