GithubHelp home page GithubHelp logo

dweiss / latex2unicode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomtung/latex2unicode

0.0 0.0 0.0 83 KB

Convert LaTeX markup to Unicode (in Scala and Java)

Home Page: http://latex2unicode.herokuapp.com/

License: Apache License 2.0

Scala 100.00%

latex2unicode's Introduction

LaTeX2Unicode Build Status

LaTeX2Unicode translates LaTeX markup to human readable Unicode when possible. Here's an online demo that can be conveniently used to type in special characters. (demo source)

Basic math notations are supported. For instance:

\because \t{AB} + \t{BC} \neq \t{AC}
\therefore \iint\sqrt[4]{\xi^{\theta+1}} - \frac 38 \le
\Sigma \zeta_i \\
\therefore \exists{x}\forall{y} x \in \^A

is converted to

∵ A͡B + B͡C ≠ A͡C ∴ ∬∜ξ̅ᶿ̅⁺̅¹̅ - ⅜ ≤ Σ ζᵢ

∴ ∃x∀y x ∈ Â

Hundreds of other symbols and special characters are supported, too. For example, \spadesuit, \aleph, \OE, \downdownarrows and \o are translated to , , Œ, , ø, respectively.

Some font styles are supported, too. For instance:

\textbb{Black Board Bold}, \textfrak{Fraktur},
{\bf Bold Face}, {\cal Calligraphic}, {\it Italic},
{\tt Monospace}

is translated to

𝔹𝕝𝕒𝕔𝕜 𝔹𝕠𝕒𝕣𝕕 𝔹𝕠𝕝𝕕, 𝔉𝔯𝔞𝔨𝔱𝔲𝔯, 𝐁𝐨𝐥𝐝 𝐅𝐚𝐜𝐞, 𝓒𝓪𝓵𝓵𝓲𝓰𝓻𝓪𝓹𝓱𝓲𝓬, 𝐼𝑡𝑎𝑙𝑖𝑐, 𝙼𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎

Using as Scala / Java Library

LaTeX2Unicode is written in Scala, thus can serve as a 3rd party library in any JVM application that needs to extract information from LaTeX texts (e.g. BibTeX).

Simple Conversion

For simple conversion without configuration, which works fine in most cases, one call to a static method and you're done.

In Scala:

import com.github.tomtung.latex2unicode._

val latex = "\\ss^2 + \\alpha_3 \n \\div \\frac{1}{3} = \\sqrt[3]{123}"
val unicode = LaTeX2Unicode.convert(latex)
println(unicode)

In Java:

import com.github.tomtung.latex2unicode.LaTeX2Unicode;

String latex = "\\ss^2 + \\alpha_3 \n \\div \\frac{1}{3} = \\sqrt[3]{123}"
String unicode = LaTeX2Unicode.convert(latex)
System.out.println(unicode);

Maven / SBT Dependency

To add dependency on LaTeX2Unicode, insert the following to your pom.xml file if you use Apache Maven:

<dependency>
    <groupId>com.github.tomtung</groupId>
    <artifactId>latex2unicode_2.12</artifactId>
    <version>0.3.1</version>
</dependency>

or add the following to your build.sbt file if you use sbt 0.11+:

libraryDependencies += "com.github.tomtung" %% "latex2unicode" % "0.3.1"

Credits

LaTeX2Unicode is inspired by two similar projects, latex-to-unicode by ypsu (written in Python) and latex-to-unicode by vikhyat (written in Ruby).

LaTeX2Unicode is built on fastparse, an fast and elegant PEG parsing framework.

Licence

Apache License Version 2.0

latex2unicode's People

Contributors

aesakamar avatar atcold avatar florian-beetz avatar i10416 avatar linusdietz avatar tobiasdiez avatar tomtung avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.