Manual:$wgUseTeX/ru

From Linux Web Expert

TeX: $wgUseTeX
Enables the use of ‎<math> (TeX) tags.
<translate> Introduced in version:</translate>pre 1.1.0
<translate> Removed in version:</translate>1.18.0 (Gerrit change 615882; git #729ec629)
<translate> Allowed values:</translate>(boolean)
<translate> Default value:</translate>false

This is obsolete in MediaWiki 1.18 and later, replaced by breaking out the feature to the Math extension.

In MediaWiki 1.17 and earlier, enables the use of ‎<math> (TeX ) tags.

To use inline TeX, you need to compile 'texvc' (in the 'math' subdirectory of the MediaWiki package) and have latex, dvips, gs (ghostscript), and convert (ImageMagick) installed and available in the PATH. Please see math/README for more information.

Interpretation

$wgUseTeX is variable in the file LocalSetting.php that needs to be assigned value true in order to allow formulas at the MediaWiki sites. Such a setting has syntax

$wgUseTeX = "true";

Without such a setting, the tags ‎<math> and ‎</math> are not recognized as commands.

Such a setting of this variable is necessary, but not sufficient. A lot of other stuff should be loaded, installed, set-up and adjusted to the custom server by a qualified programmer. This stuff is called extensions. The description of this set-up can be found at Extension:WikiTex .

Detection

The status of the setting required for the $wgUseTeX can be checked with typing in the MediaWiki article any mathematical formulas with the math tags; for example, the following short code:

<math>O</math>

Such a code is supposed to produce the italics character O. At the current set of this wiki, the result looks as:

<math>O</math>

If the variable $wgUseTeX is not set to true, the line appears as it is typed. If the variable is assigned, then the result depends on the setting of other variables and correctness of other files, in particular, those outside the wiki directory.

Diagnostics

The errors of the installation of the required extensions are reported with the red messages

(1) Failed to parse (Cannot write to or create math temp directory)

or

(2) Failed to parse (Missing texvc executable; please see math/README to configure.)

or

(3) Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert):

In the case (1), it may help to make the math directory writable with the command

chmod 777 math

In the case (2), it may help to set variable $wgTexvc in the LocalSetting.php in the following way:

$wgTexvc = '/math/texvc';

In the case (3), one should verify the existence of the commands latex, dvips, gs, and convert at the server, check that they work properely, and assign the corresponding variables in the LocalSetting.php the appropriate values. This is the most difficult and painful part of the installation of MediaWiki.

Check for latex

The existing of latex at the server can be detected with the simple code, for example, let the file 0.tex contains the four lines below:

 \documentstyle[12pt]{article}
 \begin{document}
 $x^2$
 \end{document}

Then, at the command line, the command

latex 0

should produce the file 0.dvi

Check for the dvips

If the dvips is installed, then, after the test above, the command

dvips -o 0.ps 0.dvi

should produce the file 0.ps

Check for the gs

If the check for latex and the check for dvips above did not cause the error messages, then one may test them together with the gs command typing in the command line

gs 0.ps

If at the console, this should produce a frame with image, showing the simple formula, indicating the square of variable x.

Check for the convert

After the tests above, the program convert and be checked with the command

convert 0.ps 0.png

At the correct installation of the convert (if the tests above passed well), the file 0.png should appear, and, in principle, this file already can be glued into the html document (although the formula occupies very small part of the areas of the frame). However, the software is supposed to do such operations automatically, with correct setting, providing the beautiful formula in the displayed text. (Up to year 2011, the vector mode of displaying of mathematical formulas is not realized, so, for wiki, the formulas are stored as png images, and such images are supported by the most of browsers.)

Location

For the use of MediaWiki, the commands mentioned above should be located, id est, the programmed should know the full path to each of them. This can be realized in the command line with commands

which latex
which dvips
which gs
which convert

Each of this commands is supposed to type at the screen the full path to each of the executables required. Let the corresponding outputs are p_1, p_2,p_3 and p_4.

Correction

Yet, there is no robot to perform the automatic installing of the software. Assume that all the directories required have the mode access 777, and the only problem is that MediaWiki cannot find the support for the conversion of formulas to the images. The programmer should find the corresponding variables in the MediaWiki package and assign them the required values. In some cases, this can be done, editing the LocalSetting.php

The names of variable for latex is already known; so, the corresponding line may have format

$wgLatexCommand = "p_1";

however, the p_1 should be substituted to value returned by the which latex command; for example, for some servers, it may have form

$wgLatexCommand = "/usr/texbin/latex";

Unfortunately, the names of other variables that need to be assigned are not yet reported. There is hypothesis, that the correct name for the convert program is

$wgImageMagickConvertCommand = "p_4";

where p_4 should be substituted to the value specific for the custom server; doe example, for some servers, it may have form

$wgImageMagickConvertCommand = "/usr/local/bin/convert";

The confirmation of the name of variable for the path of the program convert and search for the names of variables for the programs dvips and gs may be matter for the future research. The assignment of appropriate values to these variables is expected to make the installation of mediaviki usable.

This text is expected to be updated according to the recommendations of more successful wiki-specialists.

The manual about the use of the variable $wgUseTeX and all the requirement accessories is expected to appear at Manual:$wgUseTeX ; currently there is only a stab there.

См. также