Extensão:Math
![]() Estado da versão: estável |
|
---|---|
![]() |
|
Implementação | Marcação |
Descrição | Permite a renderização de fórmulas matemáticas |
Autor(es) |
|
Última versão | continuous updates |
Política de compatibilidade |
Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | >= 1.40.0 |
Modifica o banco de dados |
Sim |
Tabelas | math mathoid mathlatexml |
Licença | GNU GPL (Licença Pública Geral) 2.0 ou superior |
Download | |
|
|
<math> |
|
Quarterly downloads | 373 (Ranked 31st) |
Public wikis using | 7,934 (Ranked 18th) |
Para traduzir a extensão Math, verifique sua disponibilidade no translatewiki.net | |
Problemas | Tarefas em aberto · Relatar um bug |
A extensão Math fornece suporte para renderização de 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 está disponível na documentação da Wikipédia em inglês.
More information about installing and configuring this extension, including for older versions, can be found at Extensão:Math/advancedSettings .
Ver matemática
A extensão Math tenta entregar MathML saída, com fallback para imagens em SVG (convertendo caracteres para tags <path>) ou PNG (pelo menos preferencialmente). Dependendo dos recursos do dispositivo que você está usando, o tipo de saída é escolhido. O suporte matemático básico funciona para todos os navegadores. No entanto, para um processamento ideal, pode ser necessária uma afinação específica:
- Para Firefox ou outros browsers Gecko, é necessário instalar a extensão Native MathML extension e math fonts.
O suporte de acessibilidade é fornecido por NVDA, VoiceOver ou Orca. Além disso, o NVDA requer o plugin MathPlayer para ler matemática. - For Safari or other WebKit browsers, you may also install math fonts and enable native MathML rendering by inserting some CSS rules into the custom style sheet of your browser preference.
Accessibility support is provided by the VoiceOver screen reader but not by Orca yet. - For Chrome you must insert some CSS rules into the custom style sheet of your browser preference in order to get accessibility support via ChromeVox or visual rendering via the MathJax plugin.
- Em algumas versões do Internet Explorer, é possível usar MathPlayer como uma tecnologia assistiva.
Instalação
- Baixe e coloque o(s) arquivo(s) num diretório chamado
Math
na sua pastaextensions/
. - Adicione o seguinte código ao final do seu arquivo
LocalSettings.php
:wfLoadExtension( 'Math' );
- Execute o script de atualização que criará automaticamente as tabelas de banco de dados necessárias a essa extensão.
- Para ver as matemáticas além de uma saída de texto simples, siga as instruções abaixo para ativar vários modos de saída de matemática.
- If you have problems for represent formulas when trying to use RESTBase, you can try using the following patch
Concluído – Navegue à página Special:Version em sua wiki para verificar se a instalação da extensão foi bem sucedida.
Instalação com Vagrant:
- Se estiver usando o Vagrant , instale com
vagrant roles enable math --provision
You should additionally go to the page Special:MathStatus to see whether all of the components of the Math extension now work. Para qualquer problema que você veja, a melhor opção é criar uma tarefa em https://phabricator.wikimedia.org
Unfortunately, there is no well tested guide on installing Mathoid and RESTBase to work with the Math extension, but there is at least a working draft. Extension:Math/RESTBase please contribute.
In addition, there is a Guide for Installing and Setting up MediaWiki with RESTBase and Mathoid in MW1.28.
Math output modes
The setting $wgMathValidModes holds an array with the names of output modes that can be used for rendering. If multiple modes are enabled, logged-in users can set a personal preference in the appearance pane of their user preferences page.
You can also use the $wgDefaultUserOptions setting to set which of these modes should be the default, e.g.:
$wgDefaultUserOptions['math'] = 'mathml';
Mathoid
Mode: 'mathml'
Para MW 1,23 e superior, você pode usar um servidor Mathoid que usa MathJax para converter a entrada texvc no lado do servidor para renderização MathML + SVG. Esta é a opção mais recomendada; Mathoid é o modo de renderização que está na Wikipedia. This is the most recommended option; Mathoid is the Math rendering mode used on Wikipedia.
Mathoid as a service
"Mathoid as a service" is the recommended approach for the Math extension, and the default one. If you do not add any additional settings to LocalSettings.php, Math will use the Beta cluster's Mathoid and RESTBase services to do all math formula rendering. The default settings are:
// Definir MathML como opção de renderização padrão
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathFullRestbaseURL = 'https://wikimedia.org/api/rest_';
$wgMathMathMLUrl = 'https://mathoid-beta.wmflabs.org';
Confira Mathoid para encontrar instruções sobre como executar seu próprio servidor Mathoid.
Mathoid's CLI interface
You can instead run Mathoid as a command-line utility on the local server. To use this approach, the following settings are recommended:
// Set MathML as default rendering option
$wgDefaultUserOptions['math'] = 'mathml';
// Please create a config.yaml in advance. Templates are in the Mathoid repository.
$wgMathoidCli = ['/path/to/mathoid/cli.js', '-c', '/path/to/mathoid/config.yaml'];
// Raise MediaWiki's memory limit to 1.2G for mathoid.
$wgMaxShellMemory = 1228800;
If you run MediaWiki in a system containing SELinux and you get the message Mathoid cli '/path/to/mathoid/cli.js' is not executable
in the error log, you can run the following to make sure that the Apache server allows to change system limits:
setsebool -P httpd_execmem 1 setsebool -P httpd_setrlimit 1
LaTeX
Versão MediaWiki: | ≤ 1.39 |
Mode: 'png'
Since MediaWiki 1.32, this mode will also require a Mathoid server to work. In older versions, it requires installing texvc and texvccheck, which may require the most setup work.
LaTeXML
Mode: 'latexml'
Uses the LaTeXML utility. The rendering is done via an online service (set with $wgLaTeXMLUrl, which has a default value of https://latexml.formulasearchengine.com/convert).
No rendering
Mode: 'source'
This mode will forward the Latex input without rendering, presenting it in a <span>
element, surrounded by $ :formula $.
Make sure to set $wgMathDisableTexFilter to 'always' (see below) if you only want the raw latex formula, else an error will appear due to the failed check for PNG depictions.
Todos os parâmetros de configuração
Nome da configuração | Valor padrão | Descrição |
---|---|---|
$wgMathValidModes | [ 'source', 'mathml' ]
|
Defina o modo permitido no servidor. |
$wgMathDisableTexFilter | 'never'
|
Opção para desativar o filtro tex. Se definido como verdadeiro, qualquer expressão do LaTeX será analisada, isso pode ser um risco potencial de segurança. Se definido como false somente um subconjunto dos comandos TeX é permitido. Consulte a wikipedia Ajuda: Matemática para obter mais detalhes. Use "sempre" para desativar esse recurso. |
$wgMathFullRestbaseURL | false | A extensão matemática obtém a configuração padrão do Editor Visual, se disponível. Detalhes. |
Tracking categories
The extension creates a number of tracking categories to detect errors and deprecated features. The exact name of the categories is determined by pages in the MediaWiki namespace.
MediaWiki page | Default | Description |
---|---|---|
MediaWiki:Math-tracking-category-error | Category:Pages with math errors | Pages where there is a syntax error in the formula causing the rendering to fail |
MediaWiki:Math-tracking-category-render-error | Category:Pages with math render errors | Pages where there has been a temporary error in the rendering pipeline causing the rendering to fail. These normally fix themselves |
MediaWiki:Math-tracking-category-texvc-deprecation | Category:Pages that use a deprecated format of the math tags | Pages which use deprecated texvc syntax like $ % \and \or \part \ang \C \H \bold \Bbb\ \pagecolor , which should be replaced by more standard LaTeX \$ \% \land \lor \partial \angle \Complex \mathbb{H} \mathbf \mathbb (removed) respectively. See Extension:Math/Roadmap .
|
MediaWiki:Math-tracking-category-mhchem-deprecation | Category:Pages that use a deprecated format of the chem tags |
Deprecated chemical markup, see Extension:Math/Roadmap#Step 1 Part C: Manual fixing of mhchem syntax. |
Tips and tricks
- You can use the Firefox MathML copy addon to copy formulae to other applications such as Microsoft Word (video), or Google docs with the g(Math) plugin (video)
- You can override the user preferred and default rendermode by adding the
forcemathmode
attribute to the<math>
element. e.g. to force an image being rendered<math forcemathmode="png">...</math>
. - All images of rendered formula are stored in a cache and not automatically recreated if the page is viewed or edited. To force the re-rendering of all formulas of a page, purge using the
?action=purge&mathpurge=true
action. For example the URL https://en.wikipedia.org/w/index.php?title=Integral&action=purge&mathpurge=true will force re-rendering of the w:Integral article. Afterwards you need to bypass your browser cache so that the new created images of the formulas are actually downloaded.
Relatório de erros
Se algo está errado com a extensão de matemática você pode denunciar isso em Phabricator. Além disso, você deve verificar como seu problema se relaciona com os testes de unidade automatizada que são gerados a partir da página CoverageTest.
Leitura adicional
Confira Extensão:Math/advancedSettings para versões antigas e mais informações.
Subpages
- Math/Announcement
- Math/CoverageTest
- Math/CustomizationHook
- Math/Displaystyle
- Math/Help:Formula
- Math/Hooks/MathAfterTexvc
- Math/Hooks/MathFormulaPostRender
- Math/Hooks/MathFormulaRendered
- Math/Hooks/MathRenderingResultRetrieved
- Math/Inputtypes
- Math/MathJaxMenu
- Math/MathJax testing
- Math/Popups
- Math/RESTBase
- Math/Roadmap
- Math/T140217
- Math/T167569
- Math/T1835557
- Math/T183559
- Math/T218295
- Math/T247697
- Math/T305613
- Math/T317065
- Math/T32215
- Math/T325625
- Math/T86450
- Math/T87007
- Math/TeX-header
- Math/Unique Ids
- Math/Url2Image
- Math/Wikibooks-20160516
- Math/additionalAnnotationTypes
- Math/advancedSettings
- Math/advancedSettings/de
- Math/advancedSettings/de-formal
- Math/advancedSettings/en
- Math/advancedSettings/es
- Math/advancedSettings/fr
- Math/advancedSettings/ja
- Math/advancedSettings/pl
- Math/advancedSettings/pt-br
- Math/advancedSettings/tr
- Math/annotation.js
- Math/bug/35189
- Math/bug/38641
- Math/bug/48032
- Math/bug/49210
- Math/bug/54818
- Math/bug/69554
- Math/bug/75285
- Math/chemrm
- Math/da
- Math/de
- Math/de-formal
- Math/en
- Math/es
- Math/fr
- Math/hu
- Math/id
- Math/ja
- Math/ko
- Math/math table
- Math/mathlatexml table
- Math/mathoid table
- Math/modifyMenu.js
- Math/newFeatures
- Math/pl
- Math/pt-br
- Math/ru
- Math/tr
- Math/uk
- Math/vi
- Math/yue
- Math/zh
Ver também
- Extension:Math/Roadmap
- Mathoid
- Extensão:SimpleMathJax - an alternative way to provide support for rendering mathematical formulas on-wiki, without texvc or LaTeX
- Texvc PHP Alternative
- Manual:Enable TeX/problems
- Manual:Math
![]() | Esta extensão está sendo usado por um ou mais projetos da Wikimedia. Isto significa que, provavelmente, a extensão é estável e funciona bem o suficiente para ser utilizada em sites de alto tráfego. Procure pelo nome dessa extensão nos arquivos de configuração CommonSettings.php e InitialiseSettings.php da Wikimedia para verificar onde ela foi instalada. Uma lista completa das extensões instaladas numa wiki em particular podem ser visualizadas na página Special:Version da wiki. |
![]() | This extension is included in the following packages and/or wiki farms: This is not an authoritative list. Some wiki farms/hosts may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Extensions bundled with MediaWiki 1.38/pt-br
- Stable extensions/pt-br
- Tag extensions/pt-br
- GPL licensed extensions/pt-br
- Extensions in Wikimedia version control/pt-br
- GetPreferences extensions/pt-br
- LoadExtensionSchemaUpdates extensions/pt-br
- MaintenanceRefreshLinksInit extensions/pt-br
- ParserAfterTidy extensions/pt-br
- ParserFirstCallInit extensions/pt-br
- ParserOptionsRegister extensions/pt-br
- ResourceLoaderGetConfigVars extensions/pt-br
- SpecialPage initList extensions/pt-br
- UserGetDefaultOptions extensions/pt-br
- WikibaseClientDataTypes extensions/pt-br
- WikibaseRepoDataTypes extensions/pt-br
- All extensions/pt-br
- Extensions used on Wikimedia/pt-br
- Extensions included in BlueSpice/pt-br
- Extensions included in Canasta/pt-br
- Extensions included in Fandom/pt-br
- Extensions included in Miraheze/pt-br
- Extensions included in ProWiki/pt-br
- Extensions included in wiki.gg/pt-br
- Extensions included in WikiForge/pt-br
- Extensions included in Telepedia/pt-br
- TeX/pt-br
- Math display extensions/pt-br
- Extensions with VisualEditor support/pt-br