1TeX::Encode::BibTeX(3)User Contributed Perl DocumentationTeX::Encode::BibTeX(3)
2
3
4
6 TeX::Encode::BibTeX - Encode/decode Perl utf-8 strings into BibTeX
7
9 use TeX::Encode;
10 use Encode;
11
12 $tex = encode('bibtex', "This will encode an e-acute (".chr(0xe9).") as \'e");
13 $str = decode('bibtex', $tex); # Will decode the \'e too!
14
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
34 TeX::Encode::BibTeX::encode STRING [, CHECK]
35 Encodes a utf8 string into TeX. CHECK isn't implemented.
36
37 TeX::Encode::BibTeX::encode_url STRING
38 Make a URL safe for inclusion in BibTeX.
39
40 TeX::Encode::BibTeX::decode STRING [, CHECK]
41 Decodes a TeX string into utf8. CHECK isn't implemented.
42
43 TeX::Encode::perlio_ok
44 Returns 0. PerlIO isn't implemented.
45
47 Proper Encode checking is not implemented.
48
49 LaTeX comments (% ...) are ignored because chopping a lot of text may
50 not be what you actually want.
51
52 encode()
53 Converts non-ASCII Unicode characters to their equivalent TeX symbols
54 (unTeXable characters will result in undef warnings).
55
56 decode()
57 Attempts to convert TeX symbols (e.g. \ae) to Unicode characters. As an
58 experimental feature this also handles Math-mode TeX by inserting HTML
59 into the resulting string (so you end up with an HTML approximation of
60 the maths - NOT MathML).
61
63 Encode::Encoding, Pod::LaTeX, Encode
64
66 Timothy D Brody, <tdb01r@ecs.soton.ac.uk>
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.38.0 2023-07-21 TeX::Encode::BibTeX(3)