Jump to content

Community Wishlist Survey 2017/Editing/Automatically create a reference id for pictures with a label

From Meta, a Wikimedia project coordination wiki

Automatically create a reference id for pictures with a label

  • Problem:

There is a problem, when an article has e.g. different pictures included. To address the pictures within the article, an unambiguous reference to the picture is necessary.


  • There are three pictures in the article, with the captions: "Figure 1: xyz", "Figure 2: abc", "Figure 3: klm".
  • In the text they are referenced with fig. 1, fig. 2, and fig. 3.
  • Now another picture is added between fig. 2 and fig 3.
  • The former figure 3 has to be renamed to figure 4, and the new figure gets the number 3.
  • This procedure is difficult and prone to errors, when there are dozens of figures in the article.
  • Who would benefit:

Editors of article with a large number of figures.

  • Proposed solution:
  • A figure, which should get a number, is provided with a unique label. (e.g. in the example above "xyz", "abc", "klm")
  • The figure gets a certain number for each label.
  • The labeled figure's caption starts with "Figure ###", where ### is the number of the label.
  • In the text fig. "abc" is replaced by fig. ###.
  • More comments:
  • Phabricator tickets: T7600


  • An example of something like this can be seen in Scholarpedia. They use <figref>Particle-path.png</figref> to insert a reference to an image. —TheDJ (talkcontribs) 17:44, 29 November 2017 (UTC)[reply]
  • This is kind of a weird proposal. The use of figure references is kind of unknown on most wikis, or used only rarely. It doesn't seem like a very high-value proposal. --Izno (talk) 03:46, 30 November 2017 (UTC)[reply]
    It is perhaps like the en:Chicken or the egg causality dilemma. If it is hard to implement a correct caption for figures, it is no wonder, that there are so few examples. Once it is easy to reference a certain figure correctly, more authors might consider using it. And that is why there is this wishlist: To identify the need for such a feature. --Boehm (talk) 22:55, 30 November 2017 (UTC)[reply]
    Doubtful that this is an egg. Or a chicken. The more likely reason it is unused is because everyone puts their images next to the text they want to highlight, or gives the image a detailed caption that should and does make a linking tool unnecessary. --Izno (talk) 02:14, 1 December 2017 (UTC)[reply]
    Indeed, authors put their images next to the text and refer to the image e.g. as the image on the left. But in some articles there are more than one figures on the left, and on the mobile version there is no left or right at all. It is a bad style to reference the figures that way. In wikibooks it is the most common way to address the figures with a unambiguous number, like in classical books. --Boehm (talk) 18:16, 1 December 2017 (UTC)[reply]
    We already have a unique label for every figure on the wiki: the filename. Do you want to be able to make a (local?) alias for it? Would a redirect do?
    I think numbering figures is archaic in an environment with hyperlinks, but I am well aware that Wikipedia is often used in environments without hyperlinks, like print.
    In hypertext, I recently referenced a figure with <ref>[[:File:Penn NY original floor.jpg|Photo]], 2015</ref>. This would not work in a print-out, as although the picture is in the article the filename of it would be hidden in print. Writing (see [[:File:Infographical Marvelousness|figure of I.M.]]) would also not work in print. We can already refer to sections: {{Crossreference|selfref=no|(for an illustration, see also the diagram of Infographical Marvelousness, the topmost image on the left in [[#Section|Sectionname]])}}. This would work in print.
    I'd support an extension of this to do internal linking to figures as well as sections, for off-wiki reusabilty (what do print-out conversions do now? anyone know?). You could then have (see [[#File:Infographical Marvelousness|figure of I.M.]]), and when it was exported for print it would re-format to add the description of the (relative?) location of [[#File:Infographical Marvelousness]] and optionally a figure number of the same file, both calculated on-the-fly (the former would also simplify the "See *" templates at Wikipedia:Template:See above, but this might not be worth the processing). Dynamically numbering the figures as you went to print would seem to make more sense than cluttering a hypertext version with them. Any what-you-see-is-what-you-mean editor will automatically number figures for you, so I entirely agree that shuffling them manually is silly. HLHJ (talk) 05:55, 8 December 2017 (UTC)[reply]
    • "We already have a unique label": No, we just have a unique label for a file. If files are used multiple times (e.g. a logo, or a reference picture, which is compared to different modifications) it is no more unique.
    • Some figures have no captions, therefore they don't need a figure number, which they would get in case of the file name label.
    • "Would a redirect do?": No, a redirect is nice to have, and an unambiguous reference number is essential.
    • "I think numbering figures is archaic": The same is valid for numbered citations, which a used in every article. Do you really think that numbering citation is archaic?
    • We need in addition to a label a figure counter. This can not be realized with any of your solutions.
    • "so I entirely agree that shuffling them manually is silly.": Yes it is. And thousands of authors are doing this silly thing in lack of an automatic numbering, which any other text editing software can do despite the wikimedia.
    --Boehm (talk) 20:38, 8 December 2017 (UTC)[reply]
  • This is interesting, but on a slightly higher level. We lack a mechanism to reference a lot of things on the page, and put some kind of highlight on that thing. The problem isn't really to renumber the sequence, that can be fixed pretty easily, the problem is to create the in-page references in a consistent way. Note also that some of the in-page references should be automatically generated, and some of those should also have some kind of visual anchor. This can be described as a smart anchor-template, but not quite. It needs to interface with the parser to work properly, and probably it would imply changing some extensions. — Jeblad 23:26, 10 December 2017 (UTC)[reply]