1TeX::Encode(3) User Contributed Perl Documentation TeX::Encode(3)
2
3
4
6 TeX::Encode - Encode/decode Perl utf-8 strings into TeX
7
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
16 This module provides encoding to LaTeX escapes from utf8 using mapping
17 tables in Pod::LaTeX and HTML::Entities. This covers only a subset of
18 the Unicode character table (undef warnings will occur for non-mapped
19 chars). This module is intentionally vague about what it will handle,
20 see Caveats below.
21
22 Mileage will vary when decoding (converting TeX to utf8), as TeX is in
23 essence a programming language, and this module does not implement TeX.
24
25 I use this module to encode author names in BibTeX and to do a rough
26 job at presenting LaTeX abstracts in HTML. Using decode rather than
27 seeing $\sqrt{\Omega^2\zeta_n}$ you get something that looks like the
28 formula.
29
30 The next logical step for this module is to integrate some level of TeX
31 grammar to improve the decoding, in particular to handle fractions and
32 font changes (which should probably be dropped).
33
35 TeX::Encode::encode STRING [, CHECK]
36 Encodes a utf8 string into TeX. CHECK isn't implemented.
37
38 TeX::Encode::decode STRING [, CHECK]
39 Decodes a TeX string into utf8. CHECK isn't implemented.
40
41 TeX::Encode::perlio_ok
42 Returns 0. PerlIO isn't implemented.
43
45 Proper Encode checking is not implemented.
46
47 LaTeX comments (% ...) are ignored because chopping a lot of text may
48 not be what you actually want.
49
50 encode()
51 Converts non-ASCII Unicode characters to their equivalent TeX symbols
52 (unTeXable characters will result in undef warnings).
53
54 decode()
55 Attempts to convert TeX symbols (e.g. \ae) to Unicode characters. As an
56 experimental feature this also handles Math-mode TeX by inserting HTML
57 into the resulting string (so you end up with an HTML approximation of
58 the maths - NOT MathML).
59
61 Encode::Encoding, Pod::LaTeX, Encode
62
64 · Timothy D Brody, <tdb01r@ecs.soton.ac.uk>
65
66 · Ahmad Fatoum "<athreef@cpan.org>", <http://a3f.at>
67
69 Copyright (C) 2005-2007 by Timothy D Brody
70
71 This library is free software; you can redistribute it and/or modify it
72 under the same terms as Perl itself, either Perl version 5.8.7 or, at
73 your option, any later version of Perl 5 you may have available.
74
75
76
77perl v5.28.0 2017-12-21 TeX::Encode(3)