Jump to content

Manual talk:Math

Add topic
From mediawiki.org
Latest comment: 4 years ago by PikAsriel in topic Zh translate

Where can I download the extension?

[edit]

Searching for "texvc" in the english wikipedia shows me that:

"Like the rest of MediaWiki, it is available under the terms of the GNU GPL from the MediaWiki site."

When I click the link to the MediaWiki site, I can't find anything about a texvc download. If I type "texvc" into the search field, I come to this site. But I can't find a hint how and where I can download the software. 84.134.179.36 21:23, 18 June 2007 (UTC)Reply

texvc is included with the MediaWiki download. See the "math" directory under your installation. There's a README for how to make texvc. Kaolin 00:59, 17 February 2008 (UTC)Reply

And what do we do when it refuses to compile?

$ grep OCaml README
OCaml 3.06 or later is required to compile texvc; this can be acquired from
$ ocaml -version
The Objective Caml toplevel, version 3.12.1
$ ocamlopt -version
3.12.1
$ pwd
/var/www/localhost/htdocs/wiki/extensions/Math/math
$ make
ocamlopt -o texvc unix.cmxa util.cmx parser.cmx html.cmx mathml.cmx texutil.cmx lexer.cmx render.cmx texvc.cmx
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/ocaml/libasmrun.a(
roots.o): relocation R_X86_64_32S against `caml_frametable' can not be used when making a shared object;
recompile with -fPIC 
/usr/lib64/ocaml/libasmrun.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
make: *** [texvc] Error 2

--70.97.12.233 23:51, 31 January 2012 (UTC)Reply

How to set permissions on newly rendered png's?

[edit]

For some security reasons we drive php as cgi-script using suphp. So all the mediawiki stuff is executed under a userid different from wwwrun. Since texvc is started via php, the resulting files are owned by this userid, too. This is nice, but the file permissions of the png-graphics is read/write only for the owner. As the pngs are loaded without php, wwwrun must have read access. I tried to fix this using acls on all the directories containing the math-graphics but with no effect. The resulting files are read/writeable only by the files owner. Any idea how to avoid this?

I think the easiest place would be to add a system/exec chmod command in includes/Math.php Kaolin 01:03, 17 February 2008 (UTC)Reply

The 'math temp directory'

[edit]
Failed to parse (Can't write to or create math temp directory)

It seems that the above stated is a common error message people get after compiling texvc and enabling $wgUseTeX in LocalSettings.php.

When you will try to fix this, make sure you try to generate new images every time you try if it worked. This can be done by working in preview-mode and then changing a letter in the formula or something like that.

Unfortunately I couldn't find a solution to the problem on the web (but several error messages in wikis around the world...) and the README file in the math subdirectory of the wiki installation only states

Ensure that the temporary and math directories exist and can be written to by the user account the web server runs under

But it doesn't say what temporary directory is meant. Creating tmp, temp, temporary as well as math/tmp, math/temp, math/temporary, all with 777, does not help. Could anyone please say which directory is meant and how the permissions should be set to make it work?

I installed the last stable MediaWiki (1.11.0) locally, running MacOS X 10.4.10. --Ileo 11:27, 1 November 2007 (UTC)Reply

After looking through includes/Math.php I found that the directory Mediwiki wants is "images/tmp". I chown'd the images directory to apache, and it was then happy to create the directory for me. Kaolin 01:02, 17 February 2008 (UTC)Reply

My images folder contains both a /math folder and a /tmp folder. My /math folder was set to 777 but not /tmp. On changing the permissions of /tmp from 755 to 777, the error message cleared. Now I have a new error message to solve:
Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert)
It looks like some help can be found on the page "Troubleshooting math display errors" --93.97.21.214 18:11, 2 March 2009 (UTC)Reply
I think that the solution to this issue is addressed in Manual:Troubleshooting math display errors. Jdpipe 07:37, 13 May 2009 (UTC)Reply


I got it to run on a host. First
  1. #apt-get install mediawiki-math
  1. then set the globals:
  1. on LocalSettings.php
  • $IP = "/home/user/htdocs/wiki";
  • $wgScriptPath = "/wiki";
  • $wgEnableUploads = true;
  • $wgUseTex = true;
  • $wgUploadPath = "$wgScriptPath/images";
  • $wgUploadDirectory = "$IP/images";
  • $wgMathPath = "$wgUploadPath/math";
  • $wgMathDirectory = "$wgUploadDirectory/math";
  • $wgTmpDirectory = "$wgUploadDirectory/tmp";
  • $wgUploadBaseUrl = false; #not sure about why this one too...
  • $wgTexvc = "/usr/bin/texvc"; #install through apt-get instead of make on ./math
  1. and also global rights for images/ , images/math/ and images/tmp/
  1. user@host:~/htdocs/wiki#chmod 777 images/ images/math/ images/tmp

Abacatabacaxi 02:53, 26 May 2011 (UTC)Reply

Wiki at host

[edit]

Is there any way to get this up and running if your wiki is located at a host? Thanks, Guido den Broeder 20:56, 9 March 2009 (UTC)Reply

This manual page could be more helpful

[edit]

I came here directly from the FAQ page, because I wanted my wiki to show mathematical formulae.

Here it says that "To use TeX formulas in MediaWiki, you have to build and configure the texvc program". This is actually not true. Texvc is one way of having LaTeX formulae in MediaWiki, and arguably not the easiest, especially if your wiki is on a host and/or you have limited experience with or access to the shell.

Sure, it is what Wikipedia is using, but many private wikis do not have the same requirements.

The other problem I have with this manual page is that it (correctly) links to MetaWiki:Help:Formula for help on math syntax, and then spends 90% of the page showing a few syntax examples.

The real instructions are supposed to be found in the linked Manual:Enable TeX. Alas, even that page fails to deliver—see my other comment here.

I propose we merge/replace this page with the much more useful Mediawiki and LaTeX on a host with shell access plus this other fine but slightly disorganized page.

I shall wait for a couple of weeks and will do that if there are no objections. Thanks. Hopefully acceptable username 01:20, 8 November 2009 (UTC)Reply

I object. This page is referenced from the FAQ as the place to read about the <math> extension. The FAQ states: MediaWiki allows embedded math formulas via [...] texvc [...]. See Manual:Math for setup instructions. In my view, this page is supposed to explain the usage of the <math> tag; it's not full detail on the installation of texvc, nor is it a complete reference for the math syntax. But I think it probably still has a place. I note also that this page is the top ranking for a google search for "mediawiki math syntax". Jdpipe 23:48, 8 November 2009 (UTC)Reply

Thank you.

You say, "This page is referenced from the FAQ as the place to read about the <math> extension". I must disagree with your interpretation. The FAQ is aimed at MediaWiki installers/administrators, not end-users. The question reads, "How do I enable embedded math formulas?", as opposed to "How do I embed mathematical formulae in wikitext once they have been enabled?", and it definitely does not read, "What's the syntax for LaTeX formulae?". The answer in the FAQ, as you quoted, reads (bold mine) "See Manual:Math for setup instructions", and not "end-user instructions".

The official page for "meadiawiki math syntax" is here: MetaWiki:Help:Formula . I don't propose we remove the link to that page from this page, but this should not become a poor-man's duplicate of that page. (And indeed the examples in this page are pretty bad already.)

What I propose is to either point the FAQ to another page, or to change the contents of this page to actually answer the question. Thanks. Hopefully acceptable username 11:34, 14 November 2009 (UTC)Reply

Almost entirely unrelated: What font (typeface) is used?

[edit]

User "nickel@[11317].com" at MyFonts.com would like to know what font (typeface) is used by the MediaWiki/TeX combination to display maths formulae. I also would like to know. See http://new.myfonts.com/WhatTheFont/forum/case/306689/ for more info. 207.65.109.10 03:43, 7 August 2010 (UTC)Reply

Latex2HTML

[edit]

I was wondering if we can replace the current math formula maker by an HTML using a script like javascript? As a start I tried making some simple expressions and found them working perfectly. For example, the following code:

x^{(2sin^2\theta+cos^2\theta)}+ 2 = 0

can be regenerated by JavaScript to HTML equivalent code:

<span style="position:relative; padding-top:57.6px; padding-bottom:0px; background:lightblue;font-family: 'Palatino
Linotype','Book Antiqua',Palatino,serif; font-size:40px; top:57.6px;">x<span style="position:relative; height:32px;
top:-32px;font-size:32px;">(2<i>sin</i><span style="position:relative; height:25.6px; top:-25.6px;font-size:25.6px;">
2</span><i>&#952;</i>+<i>cos</i><span style="position:relative; height:25.6px; top:-25.6px;font-size:25.6px;">2</span>
<i>&#952;</i>)</span>+ 2 = 0</span>

Which in trun becomes: x(2sin2θ+cos2θ)+ 2 = 0



--Email4mobile 09:56, 11 April 2011 (UTC)Reply

Wikipedia <math> ?

[edit]

What is the way Wikipedias are using for math coding?

I am wondering, while I am reading here all the documentation around the TEX or math and the recommended extension. That is the Extension:Math.

It does not look like the Extension:Math could be used in current Wikipedias with the extension having Release status: experimental only (or do they?). I do not understand. Is it experimental? Or is there any other more stable version how to allow <math> to function? Do not tell me, that Wikipedias are running only the experimental version of some extension to allow such an frequently used function. (or does it?)

In the related pages here is written, that from MW version of 1.18, this function was separated from core, to the extension. However; I think the Wikipedias are running usually on relatively new versions of WM.. so that would indicate, that they use really the version, were the math is already not part of the core and so it had to be installed somehow. How?

I do not understand from the documentation, what is needed to allow just this (and no more, no less), what is normal in Wikipedia.

Is wikipedia using the TeX?

As in here?: Manual:Configuration_settings#TeX

it writes: To use inline TeX - and it means in order to use TeX in MediaWiki You need to do the indicated.. (no more no less). And it presumes in the first place, that I already want to use inline TeX. But is that inline TeX exactly what Wikipedia is using, to generate equations from its MediaWiki source code?

Sorry to everyone, for me Wikpedia represents somehow the norm. The easiest way to understand MediaWiki. I do not think I need anythink more special related mathematics or TeX. If this is what Wikipedia is using, I will gladly use it. But I would never guess a thing whether the <math> </math> coding in Wikipedia MWs is TeX or whatever else --Reo On 15:16, 30 August 2011 (UTC)Reply

Indent Math formula?

[edit]

I cannot use : as an indentation with <math>

For example, if I do like this. the latter sections are all messed up:

:<math>
    \operatorname{erfc}(x) =
    \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2}\,dt =
    \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n)!}{n!(2x)^{2n}}
</math>

<br /><br />
To display above formula, put the corresponding latex form inside the tags <math> and </math> like that:<br />

:<syntaxhighlight lang="latex">
<math>
    \operatorname{erfc}(x) =
    \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2}\,dt =
    \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n)!}{n!(2x)^{2n}}
</math>
</syntaxhighlight>
<br />

Failed to parse (Cannot store math image on filesystem.)

[edit]

Hi guys (sorry, forgot my Wiki login, will do this anonymously). I am getting the following error: Failed to parse (Cannot store math image on filesystem.) I can't seem to find information on this specific error anywhere. Here's what I already tried:

  • Set chmod 777 on /images/math (assuming this is the canonical math image file direcory)
  • Set chmod 777 on /extensions/Math/math (for good measure)
  • Explicitly set the full path to:
$wgMathDirectory = "/var/lib/mediawiki/images/math";

$wgMathPath = "/var/lib/mediawiki/images/math";

(I am running on Turnkey Linux's system, which is Debian-based, and upgraded to MW 1.20).

Any clues? I'm all out of ideas.

--Luke Loughead 204.101.124.26 19:36, 13 September 2013 (UTC) (I'll check back here for updates)Reply

UPDATE:

I have also added $wgTmpDirectory = "/var/lib/mediawiki/images/temp"; and set chmod 777 on that directory. Still nothing. Even restarted apache. It would be nice if the error gave a specific directory that it could not write to, eh? --Luke Loughead 204.101.124.26 19:52, 13 September 2013 (UTC)Reply

I encountered the same "Cannot store math image on filesystem" error. It appears that either;
a) $wgUploadPath/$wgUploadDirectory are not being set (they are not in LocalSettings.php - perhaps they should have been generated by wikifolder/mw_config/index.php?) or;
b) their default values are not being set as defined in the mediawiki documentation (http://www.mediawiki.org/wiki/Manual:$wgUploadPath/http://www.mediawiki.org/wiki/Manual:$wgScriptPath; "{$wgScriptPath}/images"/"{$IP}/images").
I managed to get the Mediawiki Math extension working on Ubuntu by performing the following;
1. copy Math extension to wikifolder
sudo chown yourusername /var/www/html
tar xvf Math-xxx.tar.gz
cp -rf Math /var/www/html/wikifolder/extensions/
2. create image folders
cd /var/www/html/wikifolder/images
mkdir math
mkdir tmp
sudo chown -R www-data:www-data *
3. configure LocalSettings.php;
nedit /var/www/html/wikifolder/LocalSettings.php
require_once "$IP/extensions/Math/Math.php";
$wgUploadPath = "{$wgScriptPath}/images";
$wgUploadDirectory = "{$IP}/images";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
4. update mediawiki
cd /var/www/html/wikifolder/maintenance
php update.php
5. compile texvc (texvc must be compiled for the Math extension to work);
sudo apt-get install build-essential dvipng ocaml texlive-fonts-recommended texlive-lang-greek texlive-latex-recommended (install Math extension dependencies)
cd /var/www/html/wikifolder/extensions/Math/math
make
./texvc /home/yourusername/temp /home/yourusername/temp "y=x+2" iso-8859-1 "rgb 1.0 1.0 1.0" (to test texvc is working)
Richardbrucebaxter (talk) 04:53, 11 August 2014 (UTC)Reply
To prevent having to configure LocalSettings.php with $wgUploadPath/$wgUploadDirectory/$wgMathPath/$wgMathDirectory/$wgTmpDirectory (step 3.), enable image uploads during the mediawiki installation Richardbrucebaxter (talk) 03:09, 12 August 2014 (UTC)Reply

Zh translate

[edit]

Can admin give the permission to translate this page of chinese?PikAsriel (talk) 05:19, 3 June 2020 (UTC)Reply