Skip to content

hayk314/LaTex-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LaTex handler

Transforming LaTeX accents to UTF8 or ASCII

A simple Python script providing a self-contained functionality for transforming accented characters of LaTeX into their equivalent UTF8 or ASCII encoding.

A sample usage

   import LaTexAccents as TeX

   converter = TeX.AccentConverter() # initialize the accent transformer class instance

    s = 'This t\\"{e}xt cont\\.ains Lat\\`ex ac\\^{c}ents'  #some string containig (or not) Tex accents
    # the result of print(s) (to see the actual string without espace characters)
    # This t\"{e}xt cont\.ains Lat\`ex ac\^{c}ents

    s1 = converter.decode_Tex_Accents(s, utf8_or_ascii=1) # replacing accents by UTF8
    # the result of print(s1)
    # This tëxt contȧins Latèx acĉents

    s2 = converter.decode_Tex_Accents(s, utf8_or_ascii=2) # replacing accents by ASCII
    # the result of print(s2)
    # This text contains Latex accents

Motivation

A variant of this script is intended to be used in SciLag a community project dedicated to open problems in mathematics. We thought to share it here, as this might be potentially useful in some routine tasks with Latex format.

Version

This is version 0.1 and might be subject to change. The list of current accents might not be complete, however, one may easily add more a translation rules from accents to UTF8 adding new rules inside function create_Translation_Rules.

About

functionality for working with LaTex files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages