Kézikönyv:$wgUseTeX

From mediawiki.org
This page is a translated version of the page Manual:$wgUseTeX and the translation is 90% complete.
TeX: $wgUseTeX
A ‎<math> (TeX) címkék engedélyezése.
Bevezetve:pre 1.1.0
Eltávolítva:1.18.0 (Gerrit change 615882; git #729ec629)
Megengedett értékek:(boolean)
Alapértelmezett érték:false

Részletek

A beállítás a MediaWiki 1.18 és későbbi verziójában nem használt, funkcionalitása a Math kiterjesztésbe került át.

A MediaWiki 1.17 és korábbi verzióiban a változó engedélyezi a ‎<math> (TeX ) címkék használatát.

A TeX használatához szükséges a 'texvc' fordítása (a MediaWiki 'math' könyvtárában), továbbá szükséges hozzá a latex, dvips, gs (ghostscript) és convert (ImageMagick) telepítése és a PATH-ben történő definiálása. További információkért lásd a math/README fájlt.

Interpretáció

A $wgUseTeX a LocalSetting.php-ban definiált változó, melynek true értéke szükséges a matematikai formulák megjelenítéséhez. A beállítás szintaxisa:

$wgUseTeX = "true";

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

Ez a beállítás a működéshez szükséges, de nem elégséges. Számos más dolog betöltésére, telepítésére, beállítására és a szerver egyedi paramétereihez való igazítására van szükség egy hozzáértő által. Ezeket kiterjesztéseknek hívjuk. A beállítás leírását a Extension:WikiTex lapon találod.

Felismerés

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>

A kódnak a dőlt O betűt kell megjelenítenie. A wiki jelenlegi beállításaiban ez a következőképpen néz ki:

Ha a $wgUseTeX értéke nem true, a beírt kód nyers szövegként jelenik meg. Ha a változó hozzá van rendelve a beállításhoz, az eredmény más változók és fájlok helyességén, többek közt a wiki könyvtárán kívül eső állományokén múlik.

Diagnosztika

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.

A LaTeX meglétének ellenőrzése

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

A dvips meglétének ellenőrzése

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

dvips -o 0.ps 0.dvi

should produce the file 0.ps

A gs meglétének ellenőrzése

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.

A konvertáló meglétének ellenőrzése

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.)

Telepítési hely

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.

Javítás

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 Kézikönyv:$wgUseTeX ; currently there is only a stab there.

Lásd még