Last modified: 2014-08-22 16:34:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32463, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30463 - Add Support for Farsi Digits and Scripts in LaTeX Mathematical Formulae
Add Support for Farsi Digits and Scripts in LaTeX Mathematical Formulae
Status: RESOLVED DUPLICATE of bug 48032
Product: MediaWiki extensions
Classification: Unclassified
Math (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: ---
Assigned To: physikerwelt
: i18n, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-19 13:57 UTC by Vahid Ghasemian
Modified: 2014-08-22 16:34 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Vahid Ghasemian 2011-08-19 13:57:02 UTC
I'm one of the users of Farsi Wikipedia. I've been wondering to add
thesupporting of Farsi Digits and Scripts in Math Extension of MediaWiki (in
LaTeX mode).

Arabi, is a good package under LaTeX that supports Arabic or Persian
digits and scripts. this pacakge is available in MiKTeX 2.5 and newer pacakges
of LaTeX. For more information about this package, please read these links:

http://www.mail-archive.com/ctan-ann@dante.de/msg00778.html

http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/arabi/user_guide.pdf

For testing a sample file, please go to

http://sciencesoft.at/index.jsp?link=latex&js=0&lang=en

and copy-paste this code to the blank Area and click the "Start LaTeX" button:

% Start of the Code
\documentclass{article}
\usepackage[T1,LFE,LAE]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[farsi,arabic,english]{babel}
\TOCLanguage{farsi}

\makeatletter
%due to a bug in ARABI in which the command \textRL is not
%changed to write Farsi though the main TOC language is Farsi.
\def\textRL#1{{\expandafter\@farsi at R{#1}}}

%due to a bug in ARABI in which the quotaion marks are not
%assigned to their counterpart font-glyphs in lfeenc.def
\DeclareTextSymbol{\guillemotright}{LFE}{62}
\DeclareTextSymbol{\guillemotleft}{LFE}{60}
\makeatother

\begin{document}
\selectlanguage{farsi}
%a paragraph in Farsi
%to write a number use \I{NUMBER}
%to write some phrases in English use \textLR{English phrase}
سلام. بالاخره یک سرور \textLR{On Line}  پیدا شد که از فارسی نویسی در
\textLR{ \LaTeX\ } حمایت کند!

$$\sum^{+ \infty}_{i=1} \frac{1}{i^2} = \frac{\pi^2}{6}$$

\end{document}
% End of the code

by the help of this sample code, is it possible for you to add
supporting farsi digits and scripts to the MediaWiki Math Extension in
LaTeX mode  to use it in Farsi Wikipedia?

Best Regards
Comment 1 Vahid 2012-08-12 16:20:46 UTC
Please Edit texutils.ml as follows and define a farsi mode to choose by farsi wikipedia users:

Index: texutil.ml
===================================================================
--- texutil.ml	(revision 115660)
+++ texutil.ml	(working copy)
@@ -48,6 +48,7 @@
 let modules_color = ref false
 let modules_teubner = ref false
 let modules_euro = ref false 
+let modules_farsi = ref false
 
 (* wrappers to easily set / reset module properties *)
 let tex_use_ams ()     = modules_ams := true
@@ -55,13 +56,15 @@
 let tex_use_color ()  = modules_color := true
 let tex_use_teubner ()  = modules_teubner := true
 let tex_use_euro ()  = modules_euro := true
-let tex_mod_reset ()   = (
+let tex_use_farsi () = modules_farsi := true
+  let tex_mod_reset ()   = (
         modules_ams := false;
         modules_nonascii := false;
         modules_encoding := UTF8;
         modules_color := false;
         modules_teubner := false;
         modules_euro := false;
+        modules_farsi := false;
         )
 
 (* Return TeX fragment for one of the encodings in (UTF8,LATIN1,LATIN2) *)
@@ -77,8 +80,27 @@
               (if !modules_color then "\\usepackage[dvips,usenames]{color}\n" else "") ^
               (if !modules_teubner then "\\usepackage[greek]{babel}\n\\usepackage{teubner}\n" else "") ^
               (if !modules_euro then "\\usepackage{eurosym}\n" else "") ^
-              "\\usepackage{cancel}\n\\pagestyle{empty}\n\\begin{document}\n$$\n"
+              (if !modules_farsi then 
+              "\\usepackage[T1,LFE,LAE]{fontenc}
+\\usepackage[utf8]{inputenc}
+\\usepackage[farsi,arabic,english]{babel}
+\\TOCLanguage{farsi}
 
+\\makeatletter
+%due to a bug in ARABI in which the command \\textRL is not
+%changed to write Farsi though the main TOC language is Farsi.
+\\def\\textRL#1{{\\expandafter\\@farsi@R{#1}}}
+
+%due to a bug in ARABI in which the quotaion marks are not
+%assigned to their counterpart font-glyphs in lfeenc.def
+\\DeclareTextSymbol{\\guillemotright}{LFE}{62}
+\\DeclareTextSymbol{\\guillemotleft}{LFE}{60}
+\\makeatother"
+              else "") ^
+              "\\usepackage{cancel}\n\\pagestyle{empty}\n\\begin{document}\n" ^
+              (if !modules_farsi then "\\selectlanguage{farsi}\n" else "") ^
+              "$$\n"
+
 (* TeX fragment appended after the content *)
 let get_footer  ()  = "\n$$\n\\end{document}\n"
 
@@ -748,4 +770,5 @@
     | "\\color"            -> (tex_use_color (); LITERAL (TEX_ONLY "\\color"))
     | "\\pagecolor"        -> (tex_use_color (); LITERAL (TEX_ONLY "\\pagecolor"))
     | "\\definecolor"      -> (tex_use_color (); LITERAL (TEX_ONLY "\\definecolor"))
+    | "\\farsi"            -> (tex_use_farsi (); LITERAL (TEX_ONLY "\\selectlanguage{farsi}")) (* Redundant but we need to make the hash different *)
     | s                    -> raise (Illegal_tex_function s)



would you please test this code to see whether it works or not?

Best Regards

Vahid Ghasemian
Comment 2 Andre Klapper 2013-02-13 12:26:56 UTC
Hi Vahid,

you are very welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit your patch from comment 1 as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial
Putting your branch in Git makes it easier to review it quickly.
Thanks again! We appreciate your contribution.
Comment 3 Frédéric Wang 2013-02-13 12:45:34 UTC
Vahid:

Note that there is a MathJax option to replace PNG images, but AFAIK MathJax does not support the farsi command either. I guess \I and \textLR could be easy implement. I don't see these commands in the $$ of your example. Are the letters/digits supposed to be translated automatically, when one uses \selectlanguage{farsi}? Also, Farsi is written left to right, right?
Comment 4 Huji 2013-02-13 14:32:28 UTC
Farsi is written right to left, but digits and formulas are written left to right in farsi.
Comment 5 Frédéric Wang 2013-02-13 14:41:20 UTC
Thanks, yes I meant the formulas are written left to right (MathJax does not support MathML "overall directionality of formulas" at the moment, so I wanted to be sure that this was not needed for this bug).
Comment 6 Vahid Ghasemian 2013-02-13 14:55:20 UTC
(In reply to comment #3)
> Vahid:
> 
> Note that there is a MathJax option to replace PNG images, but AFAIK MathJax
> does not support the farsi command either. I guess \I and \textLR could be
> easy
> implement. I don't see these commands in the $$ of your example. Are the
> letters/digits supposed to be translated automatically, when one uses
> \selectlanguage{farsi}? Also, Farsi is written left to right, right?

Dear Fredric: I don't know MathJax programming, but I put an example of code to run Arabi package in LaTeX, as I said before, it seems that by putting theses preamble LaTeX codes in appropriate places of texutils.ml, we can load Arabi package to use it's capabilities to write LaTeX formulas with Arabic digits.
Comment 7 Gerrit Notification Bot 2013-04-09 14:29:36 UTC
Related URL: https://gerrit.wikimedia.org/r/58302 (Gerrit Change I960e39353f814d1f283c12f7161f30c5c3dac9a4)
Comment 8 physikerwelt 2013-09-30 02:17:52 UTC
I would recommend to use a construct like
<math>
a^\text{ه از فارسی نوی}
</math>
this will work for future versions of the math extension.
The text is then passed as normal text to the browser without to be modified by the math extension.
Is that acceptable.
Comment 9 physikerwelt 2013-10-16 10:36:45 UTC

*** This bug has been marked as a duplicate of bug 48032 ***
Comment 10 Gerrit Notification Bot 2014-08-22 16:34:50 UTC
Change 58302 abandoned by Jforrester:
Added Support for Farsi Digits and Scripts in LaTeX Mathematical Formulae( bug 30463 )

Reason:
Untouched in over a year. Please re-instate if you want to work on this some more.

https://gerrit.wikimedia.org/r/58302

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links