TeX::E...:BibTeX(3pm)

πŸ“¦
version 2.010 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

TeX::Encode::BibTeX β€” the lil module that encodes and decodes Perl utf-8 strings into BibTeX, no cap ✨ (it's a Perl module, and the man page for it lives in section 3pm, which is giving "3pm, user-contributed Perl documentation" energy πŸ’…)


🌸 SYNOPSIS 🌸

  use TeX::Encode;
  use Encode;

  $tex = encode('bibtex', "This will encode an e-acute (".chr(0xe9).") as \'e");
  $str = decode('bibtex', $tex); # Will decode the \'e too!

okay bestie look at that second line β€” you hand it an e-acute made with chr(0xe9) and it comes back out as \'e, and then decode turns that \'e right back into the e-acute. the way that round-trips?? iconic πŸ¦‹


✨ DESCRIPTION ✨

So this module does encoding to LaTeX escapes from utf8 using mapping tables. That's it, that's the job πŸ’…

But β€” important β€” it covers only a subset of the Unicode character table. For characters that aren't in the mapping you're gonna get undef warnings. It happens. Don't panic. 😭

This module is intentionally vague about what it will actually handle β€” for the receipts, see Caveats below. (Yes, it's secretive. Main character behavior.)

Mileage will vary when decoding (that's converting TeX back to utf8, bestie), because TeX is in essence a programming language, and this module does not implement TeX. So like, temper your expectations, fr fr. 🫢

The author uses this module to encode author names in BibTeX, and to do a rough job at presenting LaTeX abstracts in HTML. When you use decode, instead of staring at $\sqrt{\Omega^2\zeta_n}$, you get something that actually looks like the formula. Ate. πŸ”₯

The next logical step for this module is to integrate some level of TeX grammar to improve the decoding β€” in particular to handle fractions and font changes (which should probably be dropped). Manifesting that upgrade ✨


πŸ‘‘ METHODS πŸ‘‘

  • TeX::Encode::BibTeX::encode STRING [, CHECK] β€” Encodes a utf8 string into TeX. CHECK isn't implemented. (Yeah, it's just vibes in that slot, sorry bestie πŸ’€)
  • TeX::Encode::BibTeX::encode_url STRING β€” Make a URL safe for inclusion in BibTeX. 🌈
  • TeX::Encode::BibTeX::decode STRING [, CHECK] β€” Decodes a TeX string into utf8. CHECK isn't implemented either. (Consistent, at least. πŸ‘‘)
  • TeX::Encode::perlio_ok β€” Returns 0. PerlIO isn't implemented. Periodt.

πŸ’€ CAVEATS πŸ’€

Proper Encode checking is not implemented. That's it. That's the caveat. πŸ™ˆ

LaTeX comments (% ...) are ignored, because chopping out a lot of text may not be what you actually want. Like, respect, honestly. πŸ’œ

πŸŽ€ encode() πŸŽ€

Converts non-ASCII Unicode characters to their equivalent TeX symbols. (unTeXable characters will result in undef warnings.) ⭐

πŸ¦‹ decode() πŸ¦‹

Attempts to convert TeX symbols (e.g. \ae) to Unicode characters.

As an experimental feature, this also handles Math-mode TeX by inserting HTML into the resulting string β€” so you end up with an HTML approximation of the maths. So important to say: NOT MathML. It's giving "approximation" and that's the whole point πŸ“


🌟 SEE ALSO 🌟

  • Encode::Encoding
  • Pod::LaTeX
  • Encode

πŸ’œ AUTHOR πŸ’œ

Timothy D Brody, <tdb01r@ecs.soton.ac.uk> 🫢


Copyright (C) 2005-2007 by Timothy D Brody

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.


okay that's the whole page bestie, go forth and encode responsibly πŸ’–

mwah πŸ’‹ β€” this was perl v5.36.0, dated 2022-10-13, from the TeX::E...:BibTeX(3pm) corner of the manual, and yes the name is foreshortened like that on purpose, we don't make the rules πŸ’…βœ¨

πŸ“¦ where this page comes from