Extension:Math/advancedSettings/pt-br

A extensão Math fornece suporte para renderizar fórmulas matemáticas on-wiki via texvc e outros backends. Uma visão geral do que pode ser feito atualmente com esta extensão é encontrada na documentação da Wikipedia em inglês.

Modos de saídas matemáticas
A escolha do modo de renderização depende fortemente da quantidade de formula matemática que o wiki usa, bem como da possibilidade de instalar os pré-requisitos e dependências necessários.

Processamento no lado do cliente, e.g. via JavaScript no navegador do usuário, é lento.

A renderização do lado do servidor pode ser feita no servidor host do wiki ou usando um host de renderização público, e.g. latexml.mathweb.org.

Existem as seguintes opções possíveis de configuração:


 * sem acesso da linha de comando para o servidor


 * Nenhuma renderização ('source', antes de julho de 2015: MW_MATH_SOURCE)
 * (obsoleto): processamento do lado do cliente com MathJax (MW_MATH_MATHJAX)
 * Renderização do lado do servidor com Mathoid ('mathm', antes de julho de 2015: MW_MATH_MATHML), que é o modo de renderização usado nos projetos da Wikimedia no futuro.
 * renderização do lado do servidor com LaTeXML ('latexml', pre-julho de 2015: MW_MATH_LATEXML)


 * com acesso de linha de comando para o servidor
 * renderização do lado do servidor com LaTeX ('png', pre-julho de 2015: MW_MATH_PNG)

Se vários modos estiverem ativados, os usuários conectados poderão definir uma preferência pessoal no painel de exibição de sua página de preferências de usuário.

On a shared host with no shell access
Use MathJax or MathML (with SVG fallback).

Additional steps
The following steps are required for server-side LaTeX to PNG conversion.

A quick note about texvc
The TeX validator and converter texvc takes formulae and produces formatted output in HTML, MathML, and PNG images. Input data is parsed and scrutinized for safety.

On a shared host with a limited shell access
On a shared host with limited command line access, (e.g. under jailshell) compiling with all the dependencies won't be possible. As a workaround compiling texvc will have to be done offline. Use  to to identify the OS of the shared host, and install the same offline. This can be done via a USB boot drive, live CD, virtual machine on a desktop PC or whichever you prefer. Then for example in Ubuntu, all dependencies can be installed using:

Get the Math extension and make texvc etc.:

Upload the  archive to the host and extract the required files  into the $IP/extensions/Math folder.

To test texvc is working (see texvc usage), e.g.:

On a host with full shell access
Compile texvc and texvccheck:

On a (virtual) private server
In some Linux distributions texvc and texvccheck come already built in the MediaWiki Math packages.

See Comparison of extensions in distributions.

For example in Debian or Ubuntu to install it and any other packages on which it depends: (MediaWiki, Math, texvc and texvccheck ) or (just texvc)

Configuration
Please make sure to put the configuration after, otherwise the MW_MATH_XXX constants will be undefined.

Client-side rendering with MathJax
From 1.19/1.20, the Math extension supports rendering via MathJax, a client-side JavaScript library for parsing latex or mathml code and producing in-browser representation using the browser's native support for HTML+CSS, or MathML, or SVG.

This can render math expressions more sharply (using subpixel antialiasing) and larger (scaling up for zoomed view, printing, or high-resolution screens).

Set $wgUseMathJax to enable MathJax rendering mode; it is still somewhat experimental. Users will have a check box on their preferences that will enable MathJax, or set MathJax to the default mode as shown below.


 * Settings (MW 1.19 - 1.22)


 * Settings (MW 1.23 - 1.25)

See also How to modify the MathJax contextual menu.

If you have a wiki where MathJax is the only available rendering mode, and wish to force it to be enabled, add the following to LocalSettings.php instead of the above:
 * Forcing MathJax as the only rendering option (MW 1.23+)

This will switch on MathJax by default for all anonymous users and those without preferences saved for the Math extension. Note that if registered users had an alternate rendering mode selected, it will be necessary for them to open Preferences > Appearance and click Save for the new forced setting to take effect. Articles should advise users about the requirement for JavaScript to be enabled in order to see formulae (e.g. through a template for articles including TeX formulae).

MathJax localization
MathJax is an upstream project, but its user interface is translated at translatewiki.net, the same website where MediaWiki and its extension are translated. Translations made there are exported to the MathJax source code, and they will be used in the MediaWiki extension, too. For more information about translating MathJax's menus see translatewiki:Translating:MathJax.

Server-side rendering with Mathoid
Beginning from MW 1.23+ you can use a Mathoid server that uses MathJax to convert texvc input on the server side to MathML+SVG rendering. Mathoid is the rendering mode that is going to be used on future Wikipedia. For that the following settings are recommended:

Check out Mathoid to find instructions how to run your own Mathoid server. After enabling the MathML rendering mode you have to run the database update script again to create the required table.

Server-side rendering with LaTeXML
A convenient option to render LaTeX is to use the LaTeXML web service. This service converts LaTeX to high quality MathML.


 * Settings (MW 1.22) most or all of the 1.23+ settings also work


 * Settings (MW 1.23+)

A short guide to install LaTeXML on your own server can be found here: Install LaTeXML

After enabling the LaTeXML rendering mode you have to run the database update script again to create the required table.

Server-side rendering with LaTeX
To use your local webserver to convert the texvc input to PNG images via a local LaTeX installation and OCAML based translation from texvc to LaTeX you have to install texvc.

Installation of texvc

 * 1) If MediaWiki does not have write permissions to , see config items below  ,   and   you will have to grant them with e.g. *)


 * 1) Compile texvc


 * Install the required prerequisites and dependencies
 * Switch the directory
 * Compile texvc
 * Compile texvc
 * Compile texvc

To make the rendering of mathematical formulas possible with the Collection extension texvc must be installed in PATH (see the alternative installation methods just below)


 * Alternatively install the mediawiki math packages


 * 1)  (MediaWiki, Math, texvc and texvccheck) or
 * 2)  (just texvc)

Starting with Debian 8.5 the respective packages were removed. See the CHANGELOG - 2016-06-04.

List of all configuration settings
The following variables can be defined in LocalSettings.php after calling :

Purging pages that contain equations
Specifying the URL-parameter action=purge does not force the math equation to re-render the math tags. If a complete re-rendering of the math tags is desired the URL-parameter action=purge&mathpurge=true has to be passed. Be aware that this might cause side effects with other pages since the math extension uses the hash of the input TeX-input-string as the caching key. e.g. if you would force the re-rending with mathpurge option for a page containing the equation $E=mc^2$, the new rendering result would be used on all other pages containing $E=mc^2$ after the individual page caches are invalidated.

Error reporting
If something is wrong with the math extension you can report that at Phabricator. In addition you should check how your problem relates to the automated unit tests that are generated from the page CoverageTest.

MathJax errors
MathJax has more bugs than latex. So please check if it's an MediaWiki Bug or a MathJax problem. If it's a MathJax problem that has been fixed you might consider to port the change to MediaWiki version of MathJax. Therefore a development environment is required. Just cherrypick the change from MathJax and apply it to the modules/MathJax folder in the Math extension. Afterwards you can submit your change for review.

CSS para o MathML com SVG modo fallback
By default, MathML is only exposed to accessibility tools. However, you can force visual rendering with the following style:

You can then easily change the style of MathML formulas e.g. to set the math font:

is added to get the same font appearance for the entire article text. If you do not want to change your main font, then leave this out. Do not forget to remove the comma, as well!

Histórico
A extensão de matemática foi uma parte do núcleo do software MediaWiki até 1,18. Consulte o bug relacionado T16202 no Phabricator.

MW_MATH_MATHML/MW_MATH_LATEXML foi implementado para executar a geração de MathML em vez de texvc porque texvc é muito pobre em criação de MathML. Veja a opção histórica "MathML se possível (experimental)".

Desenvolvimento
Uma introdução à análise do código para a extensão está disponível a partir da extensão matemática http://www.formulasearchengine.com/review.

Da versão wmf1.25 compositor é requerido. Se você não pode executar o compositor em seu ambiente de desenvolvimento certifique-se de copiar os módulos necessários para sua  pasta. Deve haver pelo menos -folder que permita a conclusão automática para os comandos debug no seu IDE.

Veja também

 * Extension:SimpleMathJax, uma maneira alternativa para fornecer suporte para renderização fórmulas matemáticas na wiki, sem texvc ou látex.
 * texvc - descrição do texvc
 * Texvc PHP Alternativo
 * Se você estiver em um host compartilhado e não for possível compilar texvc ou um servidor mimetex em locais novos, você pode seguir as instruções no Látex em um host compartilhado para obter a extensão matemática instalada e funcionando. Esse cenário é típico de ambientes de hospedagem compartilhadas.
 * Outra alternativa é usar Látex com ferramentas Google Chart.
 * Extensão:Math/Roadmap para o desenvolvimento
 * Manual:Enable_TeX/problemas
 * Manual:Math
 * Mathoid
 * Mathoid

Fórmulas de renderização Wikis com MathJax
Esta lista MediaWiki wiki usando opção MathJax a extensão matemática, (mas não aqueles que utilizam outras extensões MathJax).


 * BlueSpice para MediaWiki, e demo wiki
 * SklogWiki, termodinâmica e mecânica estatística