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 5600 - Request for feature: automatic figure and equation (formula) numbering
 Summary: Request for feature: automatic figure and equation (formula) numbering
 Status: Product: REOPENED MediaWiki extensions Unclassified Component: Extensions requests (Other open bugs) unspecified All All Low enhancement with 3 votes (vote) --- Nobody - You can work on this! Show dependency tree / graph

 Reported: 2006-04-16 13:24 UTC by CyrilB 2014-09-04 16:52 UTC (History) 11 users (show) billinghurstwiki daniel dirk.hunniger gwicke he7d3r+bugs jackmcbarn+wmbz jitseniesen marcoil p858snake peter.krautzberger physik --- --- ---

Attachments

 CyrilB 2006-04-16 13:24:58 UTC Hi, I'm struggling with figure numbering in articles, because it has to be done manually at the moment. An automatic figure numbering system in the way of the cite.php extension would make it a lot simpler and would avoid errors when modifying an article. An identical system for equations would also be great. The LaTeX code for this is very simple (at least from the user point of view!): the \label{} is placed wherever you need to refer to the label (and is respectively replaced at compilation-time by "(1)" or "figure 1"). I have no real idea of the amount of work such an extension would require (I had a look at Cite.php, and I can imagine it is quite a lot...), but I think it is of great importance for long wikipedia articles (and might even be mandatory for wikibooks!). What do you think? Cyril Edward Z. Yang 2006-05-22 02:27:46 UTC It shouldn't be too difficult. The biggest problem is forcing the system to treat the resulting output as wikitext too... nothing on surmountable though. A few cleverly placed global counters and a developer with SVN access to spearhead it should make it work out. I could volunteer to write preliminary code. CyrilB 2006-05-22 13:08:22 UTC I guess this enhancement is feasible, as this kind of feature exists in many softwares, and its requirements look pretty close to those of the current "cite" plugin. However, I don't know anything about MediaWiki or php, so I would spend ages trying to implement it myself, and I would end up with a mix of security holes and bugs... So please, if you think you could work on it, this feature would be really helpful for long articles in wikipedia and wikibooks. Cyril p858snake 2010-07-05 02:58:05 UTC Perhaps this could be done as a extension. Moving to extension requests. Helder 2013-04-22 00:56:06 UTC This feature was also requested recently by a new user on Portuguese Wikibooks: [[wikibooks:pt:Tópico:Utilizador Discussão:Rpez/Oi!/resposta (4)]] Dirk Hünniger 2013-08-23 19:49:55 UTC For Debian there is the mediawiki2latex package. It gives you the latex source. There you can easily enable the equation numbering. physikerwelt 2014-09-03 17:27:16 UTC Is there a reason not to use templates for numbered equations. Id's in the \latex style can be assigned by the id attribute of the math element. physikerwelt 2014-09-03 17:28:12 UTC oups I wanted to write Id's in the \label style can be assigned by the id attribute of the math element. Helder 2014-09-03 17:35:09 UTC That will not automatically generate the numbering, I think. physikerwelt 2014-09-03 18:08:07 UTC OK. I was thinking there are templates that can benefit from css based numbering. If that's not the case I'm happy to fix that problem. The math extension can not look outside of the math tag. There is a hook that could be used wfRunHooks( 'MathFormulaRendered', array( &$renderer, &$renderedMath, $parser->getTitle()->getArticleID(),$parser->nextLinkID() ) );// Enables indexing of math formula In practice \$parser->nextLinkID() creates numbers 0 to n. But I think that's not guaranteed to be the case in the future. For example http://demo.formulasearchengine.com/index.php/Spectrum_%28functional_analysis%29#math22 is the 23'th math tag that has been processed on that page. Like MathSearch it would be simple to develop an extension that adds a custom tag for numbered equations. But I'm not sure if that's a feature that should go to the Math extension. If you think that's a feature that should go to the math extension I'm happy to implement that... should not be hard at all. physikerwelt 2014-09-03 18:11:10 UTC PS: It would be great if someone would use the https://www.mediawiki.org/wiki/Extension:Math/Roadmap#Wanted_features page. So we can see if something is really a wanted feature of if it's just an outdated bug from 2006... that's what I thought at a first look Helder 2014-09-03 18:34:56 UTC The main problem we need to solve is to provide a wiki equivalent syntax for the following simple feature of LaTeX, so that Mathematic and Physics books can be written collaboratively on Wikibooks projects: [[b:Some book/Chapter 1]] -------------------------------------- Let $$\label{foobar} x = 1 + 2.$$ Equation \eqref{foobar} is known as... -------------------------------------- [[b:Some book/Chapter 2]] -------------------------------------- By \eqref{foobar}, it follows that... -------------------------------------- The automatically numbering is necessary not only for formulas in a single page, but also for several pages (chapters) of a single book. However, since not even s work like that yet (see bug 10092), a first step would be to allow cross references like the ones above in a single page. Not having something like this prevent us from importing good quality content to Wikibooks projects. physikerwelt 2014-09-03 19:13:40 UTC I see different problems. The label problem and the numbering and and numbered label generation problem. That might be independent of the Math extension since it applies to images as well. I created a test page here https://en.wikipedia.org/wiki/User:Physikerwelt/bug5600#foobar to demonstrate what works today. Basically the link could be replaced by an interwiki link to [[w:User:Physikerwelt/bug5600#foobar]] to be a global reference. I think a template should replace [[w:User:Physikerwelt/bug5600#foobar]] by [[w:User:Physikerwelt/bug5600#foobar|equation reference]] A global table of all equations is desired. I see that a table of all equations would be helpful here. I implemented that for the MathSearch extension. (Recently I updated the fact that the references link to revisions and not pages. Just to be sure...) But before we start to implement something we should exactly describe what we want to achieve. For me it's still not clear what this bug is about. Helder 2014-09-03 19:58:17 UTC The main point is that the label for the link [[#foobar]] should be generated automatically, based on the number of equations (in the current page/book/etc). E.g. it would be like [[#foobar|1]] in that page (since that is the first formula, and this number "1" should increase/update automatically - as in LaTeX - if another formula is added before it). Jackmcbarn 2014-09-03 20:00:45 UTC Any sort of counter like this would inherently be a side effect, which we're trying to move away from. Helder 2014-09-03 20:33:19 UTC Copying below the relevant conversation from today on #mediawiki-parsoid: didn't we have a change in the way references (from Cite) are automatically numbered? Any chance of using something similar to fix this? https://bugzilla.wikimedia.org/show_bug.cgi?id=5600#c9 (change = using CSS or something) the link above is to a feature request: automatic figure and (math) equation numbering helderwiki that feature is not yet there. but, WIP. cite auto-numbering helderwiki: visual numbering is fairly easy with CSS it's already used for Parsoid content gwicke: subbu|coffee could you add any input to that bug? See the use case I mentioned on https://bugzilla.wikimedia.org/show_bug.cgi?id=5600#c11 helderwiki: it sounds like you'd like to reference formulas too, which goes beyond what CSS counters can do you probably want to specify an id on the math tag ...[/itex] which would just translate to that HTML id in the output & can be displayed with CSS Added one more comment at https://bugzilla.wikimedia.org/show_bug.cgi?id=5600#c13 gwicke: yeah, for one hand we want the numbering of the formulas to be added automatically (which could be done with CSS, I think), but it should be possible to reference these formulas by name in the wikitext, and "something" should be able to label it accordingly to the same (CSS?) number it's possible to display either a counter or a label using css jackmcbarn: could you elaborate what you mean by "side effect" in that context? WONTFIXING something like that would mean no Mathematics on Wikibooks projects... It is sad to hear that. helderwiki: nobody said wontfix helderwiki: adding an equation at the top of the page would mean all of the rest of them would get renumbered gwicke: i did oh, missed that well, numbering for display is fine with css jackmcbarn: that is exactly the feature from tex which we are lacking in wikitext for linking you want stable ids helderwiki: deliberately so it would be like Cite all over again and which is preventing us from convincing a few teachers to writte their books on Wikibooks collaborativelly helderwiki: I don't see a problem really helderwiki: if you can find a css way to do that, you can do it, but what you asked for in the report would mean the parser would have to be in charge of numbering, which can't happen gwicke: the problem is they don't just want numbers on the equations. they want to be able to say "figure 1", etc. dynamically from the prose exactly! that's what the problem is ah.. so not figure foobar but by referring to these formulae/figures by their labels/ids In latex source, it is like "foobar", but once we compile the document, the labels are generated automatically helderwiki, jackmcbarn: that's definitely harder gwicke: wouldn't it be equivalent to another Cite? is the numbering absolutely needed? yep. it is the way it works on Physics and Math texts nowadays (outside wikis) "figure foo" could work from a functional pov there is always JS helderwiki: if you know of any way to do it that would let you add an equation to the top of a page, and only have to parse it rather than reparse the entire page, then it'll be doable js would probably be the least bad solution yeah, if CSS doesn't work & those labels absolutely need to be numbered rather than named.. it's worth considering the trade-offs carefully though where is the patch (WIP?) of the CSS implementation for the numbering of Cite refs? also, can I copy this log to Bugzilla? helderwiki: the CSS for that is deployed hmm... it seems I missed that :-) helderwiki: http://git.wikimedia.org/blob/mediawiki%2Fcore/8fde6c3da0eed6cdadb8372397c338ca04bf3a38/resources%2Fsrc%2Fmediawiki.skinning%2Fcontent.parsoid.less#L13 for auto-numbered external links helderwiki: so it seems that it's not yet deployed for Cite helderwiki, for cite, marcoil is working on it and said he will have soemthing on friday. do we have things like "mw:ExtLink" in the HTML already? in Parsoid HTML, yes that's the HTML you see when you use VE or Flow ok its not used on normal page views yet, right? not yet, yes we are working on it ;) Helder 2014-09-03 20:56:30 UTC The problem of referencing the content generated automatically by CSS without using JavaScript is discussed here: http://stackoverflow.com/q/16453488 physikerwelt 2014-09-03 22:11:13 UTC I think it gives a wrong impression to mark this bug as wontfix. It's just not a problem of the Math extension. It's a more general problem: We can create a new bug that describes what we really want. What I got is: " Replace labels of links to an named HTML entities by an auto-generated subsequent number. " Jackmcbarn 2014-09-03 22:17:27 UTC (In reply to physikerwelt from comment #17) > Replace labels of links to an named HTML entities by an auto-generated > subsequent number. That would also be WONTFIX, for the same reason (unless you did it with JavaScript or something else hacky like that). physikerwelt 2014-09-03 22:58:07 UTC I have no inside knowledge about WikiSource, but the title of the project indicates that the feature is required. All sources contain numbered equations, figures, tables etc. It is a major requirement to the MediaWiki software that those numbers will be added automatically. Technical limitations and performance optimizations are of minor importance. So I can not understand the conclusion that this short coming will not be fixed (wontfix). Jitse Niesen 2014-09-04 09:15:36 UTC How is Cite going to work around the restriction "Any sort of counter like this would inherently be a side effect, which we're trying to move away from." (comment 14). In particular, in the following extract the footnote numbers of both tags have to be coincide and the links have to go to the same footnote: Some statement.Details of source 1 ... Another statement supported by the same source. It would be helpful if the constraint on side effects is explained somewhere so that we know what we have to work around (or overturn). Helder 2014-09-04 12:03:30 UTC Reopening since this is a necessary feature (even if its only possible implementation is based on JS) physikerwelt 2014-09-04 12:45:01 UTC Do you think this issue is specific to the math extension. If not please change the product and component. Jackmcbarn 2014-09-04 12:46:46 UTC (In reply to Jitse Niesen from comment #20) > How is Cite going to work around the restriction "Any sort of counter like > this would inherently be a side effect, which we're trying to move away > from." (comment 14). > > In particular, in the following extract the footnote numbers of both > tags have to be coincide and the links have to go to the same footnote: > > Some statement.Details of source 1 > ... > Another statement supported by the same source. > > It would be helpful if the constraint on side effects is explained somewhere > so that we know what we have to work around (or overturn). Parsoid includes its own implementation of Cite as an extra parsing pass, which gets used instead of the "real" Cite. Building and maintaining that is a lot of work for the Parsoid team, and it's the only way things with side effects can work under Parsoid. physikerwelt 2014-09-04 12:57:11 UTC I would say that's good news. I think there is a way to separate the counter and reference generation from the cite extension. That said it would reduce he maintenance effort for the Parsoid team in the future. billinghurst 2014-09-04 14:13:17 UTC removing wikisource, has not been a required functionality, and would generally be hard coded to match a work, especially where individual pages are being replicate, and would need anchors Jitse Niesen 2014-09-04 16:52:40 UTC At least conceptually it should be possible to use Cite for formulas. The following wikitext in fact gives something close to what we want. A standard limit is : $\lim_{x\to0} \frac{\sin x}{x} = 1$ We can proof using l'Hopital's rule. The main difference is that puts the contents in a footnote, while we want it to appear at the same location - this should actually simplify matters. Thus, if we could add an extra attribute to the ref tag like contentsLocation=here and get the Cite extension to honour this attribute, we're in business. Then there is some styling to get right but that should not be too much of a problem. The same mechanism can also be used to refer to tables. To be clear, this gives only the possibility to refer to equations on the same page, not on other equations. Are there any issues with this?

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