How to add other languages to TeX

不问归期 提交于 2019-12-06 07:38:23

问题


In MediaWiki if you add in formulas non english text it cuts. For example if you write \text{щfбb} (щ and б russian (cyrillic) symbols) output will be fb not щfбb.


回答1:


First of all if you have MediaWiki version lower than 1.18 then open file includes/Math.php and find (this code for version 1.16):

escapeshellarg( $wgTmpDirectory ).' ';
escapeshellarg( $this->tex ).' ';

and replace with:

escapeshellarg( $wgTmpDirectory ).' '; setlocale(LC_CTYPE, "en_US.utf8"); $cmd .=
escapeshellarg( $this->tex ).' '; setlocale(LC_ALL, "C"); $cmd .=

this needed because escapeshellarg cut UTF8 symbols. If you see in that place function wfEscapeShellArg instead of escapeshellarg then you need to set $wgShellLocale to en_US.utf8.

Second, download latest Math extension and extract math folder. Open file texutil.ml and find line:

"\\usepackage{cancel}\n\\pagestyle{empty}\n\\begin{document}\n$$\n"

add your alphabet:

"\\usepackage[russian]{babel}\n\\usepackage{cancel}\n\\pagestyle{empty}\n\\begin{document}\n$$\n"

Delete all files from your current math folder and upload files from extension. Open console, cd to math folder and do make:

$ aptitude install ocaml /* install ocaml if needed */
$ make

Also add to LocalSettings.php (change folder to yours):

putenv('HOME=/home/user');

Now new alphabet should work. ;)



来源:https://stackoverflow.com/questions/19276411/how-to-add-other-languages-to-tex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!