~ninjin/Unicode2LaTeX.jl

Tiny Julia library for mapping Unicode characters to their corresponding LaTeX-internal form

dad403a Support Julia 1.x

3 years ago

80720ae Remove test target --check-bounds, is implicit

4 years ago

Unicode2LaTeX is a tiny Julia library for mapping Unicode characters to their corresponding LaTeX-internal form. While modern TeX engines have Unicode support, passing pure ASCII data is a safer option when programmatically generating content to be consumed by a TeX engine not under your control.

#Installation

Simply use the Julia package manager:

add Unicode2LaTeX

#Usage

Unicode2LaTeX exports a single function that maps strings and characters to their corresponding LaTeX-internal form:

using Unicode2LaTeX

unicode2latex('ö') # => "\\\"o"
unicode2latex("Kurt Gödel") # => "Kurt G\\\"odel"

Do note that ASCII characters are left in place, as TeX already knows how to interpret them.

#Extracurricular reading

To produce this library it was necessary to go deep down a rabbit hole of LaTeX internals. If you also want to find out what lurks in the depths of LaTeX input encoding and font output encoding, you may find the following documents useful:

  1. “Providing some UTF-8 support via inputenc”
  2. “LaTeX font encodings”
  3. “Cyrillic languages support in LaTeX”