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