1TeX::Encode(3)        User Contributed Perl Documentation       TeX::Encode(3)
2
3
4

NAME

6       TeX::Encode - Encode/decode Perl utf-8 strings into TeX
7

SYNOPSIS

9         use TeX::Encode;
10         use Encode;
11
12         $tex = encode('latex', "This will encode an e-acute (".chr(0xe9).") as \'e");
13         $str = decode('latex', $tex); # Will decode the \'e too!
14

DESCRIPTION

16       This module provides encoding to LaTeX escapes from utf8 using mapping
17       tables. This covers only a subset of the Unicode character table (undef
18       warnings will occur for non-mapped chars). This module is intentionally
19       vague about what it will handle, see Caveats below.
20
21       Mileage will vary when decoding (converting TeX to utf8), as TeX is in
22       essence a programming language, and this module does not implement TeX.
23
24       I use this module to encode author names in BibTeX and to do a rough
25       job at presenting LaTeX abstracts in HTML. Using decode rather than
26       seeing $\sqrt{\Omega^2\zeta_n}$ you get something that looks like the
27       formula.
28
29       The next logical step for this module is to integrate some level of TeX
30       grammar to improve the decoding, in particular to handle fractions and
31       font changes (which should probably be dropped).
32

METHODS

34       TeX::Encode::encode STRING [, CHECK]
35           Encodes a utf8 string into TeX. CHECK isn't implemented.
36
37       TeX::Encode::decode STRING [, CHECK]
38           Decodes a TeX string into utf8. CHECK isn't implemented.
39
40       TeX::Encode::perlio_ok
41           Returns 0. PerlIO isn't implemented.
42

CAVEATS

44       Proper Encode checking is not implemented.
45
46       LaTeX comments (% ...) are ignored because chopping a lot of text may
47       not be what you actually want.
48
49   encode()
50       Converts non-ASCII Unicode characters to their equivalent TeX symbols
51       (unTeXable characters will result in undef warnings).
52
53   decode()
54       Attempts to convert TeX symbols (e.g. \ae) to Unicode characters. As an
55       experimental feature this also handles Math-mode TeX by inserting HTML
56       into the resulting string (so you end up with an HTML approximation of
57       the maths - NOT MathML).
58

SEE ALSO

60       Encode::Encoding, Pod::LaTeX, Encode
61

AUTHOR

63       ·   Timothy D Brody, <tdb01r@ecs.soton.ac.uk>
64
65       ·   Ahmad Fatoum "<athreef@cpan.org>", <http://a3f.at>
66
68       Copyright (C) 2005-2007 by Timothy D Brody
69
70       This library is free software; you can redistribute it and/or modify it
71       under the same terms as Perl itself, either Perl version 5.8.7 or, at
72       your option, any later version of Perl 5 you may have available.
73
74
75
76perl v5.32.0                      2020-07-28                    TeX::Encode(3)
Impressum