All Projects → OmarIthawi → arabic-mathjax

OmarIthawi / arabic-mathjax

Licence: MIT license
Beautiful Arabic Math on all browsers. An extension for MathJax v2.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
Makefile
30231 projects

Projects that are alternatives of or similar to arabic-mathjax

Redux React I18n
An i18n solution for React/Redux and React Native projects
Stars: ✭ 64 (+433.33%)
Mutual labels:  i18n, l10n, arabic
i18n
internationalize projects to Arabic
Stars: ✭ 67 (+458.33%)
Mutual labels:  i18n, l10n, arabic
Kotsu
✨ Clean, opinionated foundation for new projects — to boldly go where no man has gone before
Stars: ✭ 48 (+300%)
Mutual labels:  i18n, l10n
figma-static-localizer
A Figma plugin for static localization
Stars: ✭ 30 (+150%)
Mutual labels:  i18n, l10n
lp-loader
Frictionless language packs for Webpack.
Stars: ✭ 14 (+16.67%)
Mutual labels:  i18n, l10n
awesome-i18n
🌍 A curated list of i18n resources for all kind of languages and frameworks
Stars: ✭ 205 (+1608.33%)
Mutual labels:  i18n, l10n
msgtools
Tools for Developing Diagnostic Messages
Stars: ✭ 18 (+50%)
Mutual labels:  i18n, l10n
android-studio-plugin
Integrate your Android project with Crowdin
Stars: ✭ 52 (+333.33%)
Mutual labels:  i18n, l10n
React Native Globalize
Internationalization (i18n) for React Native
Stars: ✭ 246 (+1950%)
Mutual labels:  i18n, l10n
vue-example
Vue.js example application (server-side rendering, router, vuex store, form validation, i18n & l10n)
Stars: ✭ 62 (+416.67%)
Mutual labels:  i18n, l10n
awesome-translations
😎 Awesome lists about Internationalization & localization stuff. l10n, g11n, m17n, i18n. Translations! 🌎🌍
Stars: ✭ 54 (+350%)
Mutual labels:  i18n, l10n
banana-i18n
banana-i18n - Javascript Internationalization library
Stars: ✭ 61 (+408.33%)
Mutual labels:  i18n, l10n
hexo-filter-mathjax
💯 Server side MathJax renderer plugin for Hexo.
Stars: ✭ 76 (+533.33%)
Mutual labels:  math, mathjax
vue-i18n
A small package for implementing translations in Vue.js
Stars: ✭ 40 (+233.33%)
Mutual labels:  i18n, l10n
mathjax-node-cli
CLI tools for mathjax-node
Stars: ✭ 27 (+125%)
Mutual labels:  math, mathjax
react-native-math-view
Math view for react native! No WebView!
Stars: ✭ 49 (+308.33%)
Mutual labels:  math, mathjax
react-i18next-phraseapp
Library support to use react-i18next with the Phrase In-Context Editor - DEPRECATED
Stars: ✭ 14 (+16.67%)
Mutual labels:  i18n, l10n
lisan
🌈i18n, Reimagined! 🚀A blazing fast and super small i18n library for Javascript
Stars: ✭ 85 (+608.33%)
Mutual labels:  i18n, l10n
Tourism Demo
Flutter app backed by Redux, shows animations, internationalization (i18n), ClipPath, fonts and others...
Stars: ✭ 232 (+1833.33%)
Mutual labels:  i18n, arabic
Openl10n
[paused] A localization tool for your applications
Stars: ✭ 237 (+1875%)
Mutual labels:  i18n, l10n

MathJax Arabic Extension

This is an extension to MathJax (v2.5+), that provides basic Arabic support to MathJax.

The extension so far only supports TeX input with HTML-CSS output. However, support to other input and output jaxes is possible.

Key Features

It provides the following:

  • Flip the Equation and render it the Right-to-left (RTL) way!
  • Translate commonly used identifiers and functions.

How to Use the Extension

Install the Extension

First you'd like to install and configure MathJax in your page.

Then you'll need to include the arabic.js as an extension, here's an example configuration:

MathJax.Ajax.config.path["arabic"] = "https://cdn.rawgit.com/OmarIthawi/arabic-mathjax/v1.2/dist";

MathJax.Hub.Config({
    extensions: [
        "[arabic]/arabic.js"
    ]
});

The Amiri Font

The extension relies (sort of) on the Amiri font to render beautifully (kinda).

One way to include the font is to add the following CSS from Google Fonts:

<link href='https://fonts.googleapis.com/css?family=Amiri' rel='stylesheet' type='text/css'>

Also you'd like to set the font as the undefined family. Because of a bug in MathJax, you should stick with a single font-family e.g. use Amiri or serif but not Amiri, serif.

MathJax.Hub.Config({
    'HTML-CSS': {
        undefinedFamily: 'Amiri'
    }
});

Typeset an Arabic Equation

The extension provides the following additional TeX commands to be typeset an Arabic equation:

  1. \alwaysar

    \alwaysar{EQUATION} A macro to translate and RTL'ize an EQUATION, where EQUATION can be anything from x = 1 to e^x=\lim_{n\to\infty}.

    Wrap any TeX equation with it, and it should just work.

  2. \ar

    \ar{EQUATION} (Recommended) A similar macro to \alwaysar{EQUATION}, but it only translate and RTL'ize the equation if the page is Arabic.

    Bellow is an example equation:

    \ar{x=1}
    

    The above would render x=1 beautifully in an English page, while it should render س=١ in an Arabic page even more beautifully ( in my opinion :) ).

Supported Features

  • Flip everything (almost) including:

    • Parentheses (), braces {}, and brackets []
    • Things that should be flipped like: Integration , Root and Sigma Σ
  • Doesn't flip the things that should't be flipped, like the following letters: Theta Θ, Pi π, and Epsilon ε

  • Translate the basic math functions:

    • \sin --> جا
    • \cos --> تا
    • \tan --> ظا
    • \cot --> ظتا
    • \sec --> قا
    • \csc --> قتا
    • \log --> لو
  • Translate \lim into نها, Although some would prefer غــا, but that's just a preference, may someone can patch it to support ar_IQ for the Iraqi people!

  • Render the Arabic numbers (١, ٢, ٣) instead of (1, 2, 3), which is awesome!

  • The following new commands:

    • Circle radius: \radius Translates to r and نق

    • Area of circle: (and other stuff) \Area Translates to A and م

    • Arabic Zero: \zero Renders the صفرin Arabic while printing normal 0 in English. The former is usually preferred by the Arabic Math textbooks.

    • Charge Sheen Character: \charge Renders the ڛ (Unicode U+069B) character in Arabic while printing C in English.

      This sheen character is then replaced by a more appropriate Ruqa (رقعة) character, when using the modified Amiri font.

  • Bilingual commands, which prints the first argument on English pages and the second argument on Arabic pages. Useful to to build bilingual equations for strings that the extension provides no explicit support to. Note The first (English) argument is always a TeX input, while the second (Arabic) can be TeX, Text or TeX with Symbols, depending on the command you're using.

    • Translate a TeX input \transx
    • Translate a text input \transt e.g. \transt{\text{if}}{إذا} for the Math piecewise equations.
    • Translate a TeX input with Arabic symbols \transs: e.g. \transs{A_b}{أ_ب}
    • Translate Arabic numbers \transn: e.g. \transn{2000,000.195}
    • Translate Mixed Fractions \tmfrac: e.g. \tmfrac{10}{1}{2} to denote 10.5 as a mixed fraction
  • Basic variable and function names translation:

    • A --> أ
    • B --> ب
    • C --> حـ
    • a --> ا
    • b --> ب
    • c --> حـ
    • d --> د
    • e --> هـ
    • m --> م
    • l --> ل
    • n --> ن
    • f --> ق
    • g --> حـ
    • h --> هـ
    • k --> ك
    • r --> ر
    • t --> ت
    • x --> س
    • y --> ص
    • z --> ع
  • Translation to other identifiers and operators like limits (\lim), sine, cosine and tan.

  • A very configurable translation utility to provide English/Arabic TeX commands (same command, with language-dependent output).

  • A configurable page language detection (defaults to the lang attribute of <html> tag).

  • It is generally configurable, but I haven't documented how to do it!

Experimental Stuff

Additional extensions for Physics and some Chemistry units and symbols exists, however, it is not tested/developed well. If you're curious, you can take a look at the following extensions:

  • phys1.js: Contains general physics units like Farad and speed of light. Interesting stuff, but haven't had proper testing and usage (yet).

  • phys2.js: Additional advanced physics units that I don't understand as much!

  • hacks.js: A hack to convert the English decimal mark from . to ٫ (Arabic decimal mark, Unicode 0x066b). Although the Arabic decimal mark exists, I'm not sure if it is common enough to include it in the main installation.

How to Contribute

Well, just issue a pull request to this repo and ping me (my GitHub username is @OmarIthawi). Even better, grab my docker-based development environment from here so you can have a better development experience:

$ git clone https://github.com/OmarIthawi/arabic-mathjax.git
$ cd arabic-mathjax
$ git clone [email protected]:mathjax/MathJax mathjax
$ cd mathjax
$ git checkout 2.7.1
$ cd ..
$ make init
$ docker-compose up

License

The MIT License

Copyright (c) 2015-2016 Edraak.org, Omar Al-Ithawi and contributors.

Author

A bit of a Background

Why this plugin exists? Well, I could tell you an interesting story like I wanted to change the world, but frankly we needed it to display Math equations for our Arabic learners at Edraak.org, and therefore I made it.

Well, it does change the world somehow, at the least in the eyes of our learners ^_^

Fork Info

The original repository is:

This fork aims to be more updated and supported.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].