GithubHelp home page GithubHelp logo

apollohuang1 / mathtranslate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from susyustc/mathtranslate

0.0 0.0 0.0 158.44 MB

translate scientific papers with math

Home Page: https://github.com/SUSYUSTC/MathTranslate

License: Apache License 2.0

Shell 0.34% Python 90.69% TeX 3.66% kvlang 5.31%

mathtranslate's Introduction

MathTranslate

English | 简体中文

This is a project to provide translation of scientific papers with heavy math symbols from any language to any language while keeping the math symbols unchanged. In most translation softwares you wouldn't be able to keep equations and it would annoy you.

The main work of this project is to translate LaTeX files based on Google Translate in plain text, and finally realize the translation of pdf.

Here's an example of what you get finally.

Releases

May 14, 2023

We add the ability to directly translate the whole arxiv project with just one click.

Mar 24, 2023

We add the ability to directly translate arxiv papers.

Mar 21, 2023

We add tencent translation option for users with IP in China mainland.

Mar 16, 2023

We are now supporting all operating systems! Now you can install simply by pip install --upgrade mathtranslate.

Requirements

  1. Python3 and pip. Anaconda is recommended.
  2. (For users with IP in Mainland China): Tencent Translation API account. After registration, you can get the secret ID (not the APP ID!) and secret Key in Tencent Console. Tencent Translate is the translation API with the highest free quota to our knowledge besides Google Translate, with a free quota of 5 million characters per month, and no fee will be deducted if there is no manual recharge (that is, there is no need to worry about misuse).

Installation & Update

pip install --upgrade mathtranslate

Usage

All operations are done by command line. For Windows User you may need to run cmd or powershell as administrator.

  1. Prepare or generate a tex file or project. You can obtain a tex file or project in the following ways:
    • For most arxiv papers, the latex source code is public, and we provide a simple API to translate the entire project with just one click using an arxiv number.
    • Use mathpix to convert the pdf you want to translate into latex code. Mathpix can directly convert pdf to latex code or convert a screenshot into code. Unfortunately, mathpix requires a fee after exceeding a certain amount of usage. Here is the price list.
  2. (For Tencent Translation API users) Run translate_tex --setkey to store the API secretID and secretKey.
  3. Translate the tex file or project in command line.
    • To translate a single file: translate_tex input.tex -o output.tex will generate a translated tex file output.tex.
    • To translate an arxiv project: translate_arxiv 2205.15510 will generate a translated tex project 2205.15510.zip.
  4. Compile your tex file. For a single file, you can use the command xelatex output.tex from texlive. Chinese translation requires the xeCJK package. For arxiv projects, we recommend uploading the obtained .zip file to overleaf for online compilation (New Project - Upload Project). Note that you need to set the compiler to XeLatex in Menu - Compiler.
  5. You can change the default settings of translation language and engine through command line arguments -engine, -from, -to. For example, translate_tex -engine tencent input.tex -o output.tex. You can also permanently change the settings through translate_tex --setdefault. You can view more details through translate_tex --help. translate_arxiv also provides exactly the same command line arguments, which have the same effect.

Examples

In the example directory, you can see main.txt which is the mathpix output of a part of paper.pdf. Run translate_tex main.txt and you will get the main.tex and main.pdf. translated.png is what you should expect to see in the main.pdf.

Further developments

  1. Fix bugs in the latex translations.
  2. A more user-friendly interface.

If you have any questions or have interests in making contributions, please contact me by [email protected] or joining QQ group 288646946.

Donation

If you think this project is helping you a lot, you can support us by the Wechat QR code below

mathtranslate's People

Contributors

susyustc avatar sherrylixuecheng avatar ivanmao714 avatar pythonorc avatar antimonyz 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.