# MediaWiki r86962 - Code Review

 Repository: MediaWiki Revision: < r86961‎ | r86962 (on ViewVC)‎ | r86963 > Date: 18:17, 26 April 2011 Author: thenub314 Status: resolved (Comments) Tags: brion, math, needs-parsertests Comment: The following changes enhance the way texvc handles space around mathematical function names when translating to HTML; adds support for the sen, the Spanish name for sin; and corrects a bug that eliminates spacing around \operatorname{...} in the resulting png. More specifically, texvc now dectect whether or not a standard function such as is followed by a delimitier such as (, {, [ etc. and adds a space or not as appropriate. This issue The code has been reorganized to include a list of standard LaTeX commands whose spacing rules are the same, and treates them all on an equal footing. It similarly treats functions defined for mediawiki in the same way it treats standard latex functions. One addition function is added, \sen, and others can be added easily if necessary. Finally LaTeX generated by texvc contained to many braces which altered the spacing created by the command \operatorname, this has now been corrected. These last two changes address the issues raised in bug 18912 and the chaning in translation to HTML address most, but not all, of the issues raised in bug 6722 . Modified paths: /trunk/extensions/Math/math/lexer.mll (modified) (history) (diff) /trunk/extensions/Math/math/texutil.ml (modified) (history) (diff)

## Sign-offs

UserFlagDate
Thelema314inspected14:13, 29 August 2011

## Follow-up revisions

Rev.Commit summaryAuthorDate
r96990Revert changes to texvc that provide no test cases or examples of what they'r...brion19:00, 13 September 2011
r96993MFT r96990: provisional revert of texvc changes that don't come with any test...brion19:07, 13 September 2011
r97034* (bug 6722) Spacing fixes for math functions with/without parens...brion00:49, 14 September 2011

#Comment by Thenub314 (talk | contribs)   19:43, 2 May 2011

Revision r87117 corrects a small bug introduced in this change. which results to not inserting a space after the function name when no braces are used. That is if the input was ${\displaystyle \sin x}$ the the code sent to LaTeX was \sinx.

#Comment by Thelema314 (talk | contribs)   14:13, 29 August 2011

This looks like a good refactoring of many \foo commands into a smaller set of code. I'm surprised about extra { } in latex producing misrendering, but guess it's possible.

#Comment by Brion VIBBER (talk | contribs)   18:47, 13 September 2011

Needs parser tests to confirm the change and prevent regressions.

#Comment by Brion VIBBER (talk | contribs)   19:03, 13 September 2011

Provisionally reverted in r96990 pending test cases.

#Comment by Brion VIBBER (talk | contribs)   22:52, 13 September 2011

This seems to stop things in the pattern \sin{x} from working; I see \sin{...}, \cos{...}, and \tan{...} in 583 equations on en.wikipedia.org, such as on w:en:Anomalous Diffraction Theory

#Comment by Brion VIBBER (talk | contribs)   00:50, 14 September 2011

Reapplied in r97034 along with test cases & some friends; a couple more revs that hadn't been obviously connected resolve this issue.