Last modified: 2011-09-14 00:55:32 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 18912 - latex and spanish projects (sine function wrongly displayed)
latex and spanish projects (sine function wrongly displayed)
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Site requests (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://es.wikipedia.org/wiki/Usuario:...
: i18n, patch, patch-need-review
: 14825 (view as bug list)
Depends on: 6722
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-25 17:03 UTC by Pedro Sánchez
Modified: 2011-09-14 00:55 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
png showing the proper spacing for operatorname (19.86 KB, image/png)
2009-05-25 17:03 UTC, Pedro Sánchez
Details
It seems the code adds a { } around \operatorname (or any function taking 1 argument) and runis the spacing. The following patch to the code should fix it. (620 bytes, patch)
2010-12-18 00:13 UTC, Nicholas Longo
Details
Provisional parser tests for 6722 & 18912 (1.89 KB, patch)
2011-09-13 22:56 UTC, Brion Vibber
Details

Description Pedro Sánchez 2009-05-25 17:03:14 UTC
Created attachment 6152 [details]
png showing the proper spacing for operatorname

There's a very frequent and recurrent headache on spanish projects relating to latex: the proper way to typeset "sine funcion" in spanish is "sen", not "sin".

This leads to several inconsistent situations and ugly hacks.
Currently, the common hack is typeset \mathrm{sen} everytime sine function is needed (if not just typeset it on english)
However, the problem is that it breaks spacing in the formula. 

Now, mediawiki's latex loads AMS's classes (amsmath.sty) allowing to use \operatorname in order to solve the problem.
Typing \operatorname{sen} should give proper spacing, as shown here: 

The expected behavior is: http://matmor.unam.mx/~drini/seno.png


-----

Now back to mediawiki: as mentioned, latex's mediawiki  allows "\operatorname" to be used, but although it typesets in roman font, the spacing is bad. See

http://es.wikipedia.org/wiki/Usuario:Drini/seno

The ONLY way to get the proper effect on mediawiki at this moment is to use the ugliest hack
\operatorname{sen\, }


So, this bugs raises the following issues (any of which would solve the problem):
* fix \operatorname parsing to give proper spacing
* allow a definition of \sen globally for spanish projects
* modify \sin   so it typesets "sen" in spanish projects (like latex babel's package does)
* fully allow babel package for texvc (so these sorts of problems won't arise on other languages, and every language gets proper math typesettting)


Now, this is not a bug asking to allow custom latex commands everywhere. 
It's a ***very exceptional case*** since \sin is one of the most widely used commands yet it doesn't get displayed right and poor hacks with wrong spacing that ruin formulas are commonly used.
Comment 1 Nicholas Longo 2010-12-18 00:13:26 UTC
Created attachment 7917 [details]
It seems the code adds a { } around \operatorname (or any function taking 1 argument) and runis the spacing.  The following patch to the code should fix it.
Comment 2 Nicholas Longo 2010-12-19 01:56:40 UTC
*** Bug 14825 has been marked as a duplicate of this bug. ***
Comment 3 Pedro Sánchez 2010-12-19 02:39:58 UTC
A neat way to solve this and a whole class of related international problems would be:

Add \usepackage{language}[babel]
to the sitewide preamble, where language=spanish for spanish wikis

A more useful, albeit more complex
would be creating
MediaWiki:Latex
or something like that where (similarly to MediaWiki:common.css or MediaWiki:Vector.js) custom latex preambles could be set for each wiki
Comment 4 Pedro Sánchez 2010-12-19 02:43:29 UTC
Also, fixing "\operatorname" is not an optimal solution, since it would still be necessary to write \operatorname{sen} EVERYTIME  sine funcion is shown (which may be a dozen times within an article, for hundreds of articles).

The proper (understandably more difficult than a quick hack) would be allowing a wiki to define either own latex commands (custom latex preambles as above) to define \sen  or   correctly set  babel's package language so \sin  shows "sen"  without having to define a new command.
Comment 5 Nicholas Longo 2010-12-19 04:08:36 UTC
Well I agree allowing custom preambles is the way to go, but with what little passing familiarity I have of the code, I think it would require a complete re-write of texvc.  Which is generally needed for many reasons, but I don't think the texvc portion of the code has any developers interested in it.  So it may be a long wait before any serious changes get made.  

I only just started looking at the code, but probably getting it to add simple \DeclareMathOperators would be workable, which would take care of sen.  More general preambles like including new packages pose a problem because the current code try's to independently validate every accepted latex command.  So if you include a new package, you then need to write code for every command that package is supposed to make available.  This is why not all AMS commands work on wiki.
Comment 6 Nicholas Longo 2011-04-26 18:24:34 UTC
A patch has been added that defines \sen and the spacing of \operatorname has been corrected.
Comment 7 Pedro Sánchez 2011-04-26 19:39:29 UTC
This needs to be reopened as it doesn't seem to do what it says on the closing:

http://es.wikipedia.org/wiki/Usuario:Magister_Mathematicae/seno

using said  \sen  causes math errors (undefined function)
Comment 8 Ariel T. Glenn 2011-04-26 21:11:25 UTC
What does this have to do with XML snapshots?
Comment 9 Pedro Sánchez 2011-04-26 21:33:09 UTC
I don't know, I just clicked on reopen and pressed OK
Comment 10 Nicholas Longo 2011-05-02 18:22:36 UTC
I forgot to mention that it was r86962 that fixed this bug in texvc.
Comment 11 Brion Vibber 2011-09-13 19:27:49 UTC
r86962 has been provisionally reverted pending test cases.

It should be straightforward to add a parser test case to confirm that \sen x, \sen{x}, \sen(x) work.

Not sure about confirming the output spacing on \operatorname{sen} x - but I think it'll make a difference to output hash, and therefore the rendered PNG image filename -- which will turn up on parser test output. So that should be able to protect against regression.
Comment 12 Brion Vibber 2011-09-13 22:56:50 UTC
Created attachment 9057 [details]
Provisional parser tests for 6722 & 18912

The \sin{x} forms no longer work as they previously did with r86962 and r87117 in -- this seems to be a nasty regression?

Note that r86962 and r87117 remain reverted on trunk for now.
Comment 13 Brion Vibber 2011-09-14 00:43:21 UTC
Ok, with r87936 and r87941 added in that's fixed up -- was hard to tell what revs connected to what. :) Looking good so far, should be merged shortly.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links