50
$\begingroup$

We'd like to make it easier to cite articles from the literature, on MathOverflow.

I propose adding a single button to the edit toolbar while writing posts, which will pop up a search dialog, allow the user to select a result, and then insert a nicely formatted link to the paper back into the edit box.

The button would appear next to the current four icons for inserting hyperlinks, blockquotes, preformatted text, and images. (We could insert this button ourselves, via our allowed javascript footer, but eventually we'd want SE to insert it natively.)

To get a sense of how the search dialog might work, please look at this prototype. (Obviously this would need some polishing; suggestions for improvements welcome.)

Once a search result has been selected, I propose inserting into the edit box something like:

<span class="citation" authors="Sendak, Maureen and Geisel, Theresa" mrnumber="MR1234567"
      cite="J. Unexpected Results 17 (2015), no. 1, 17-29">
  <a href="http://dx.doi.org/10.1111/2222">A mathematics paper</a>
</span>

which will render simply as the hyperlink A mathematics paper. The hyperlink should be the 'best available URL', e.g. the DOI resolution address, a direct link to the published version, or the link to the corresponding record on MathSciNet.

I would like to include the extra <span> tag around the actual hyperlink for several reasons:

  1. it makes the extra citation data available, in case the user wants to also show the authors or journal reference in the text,
  2. it allows us to render citation links differently via the CSS selector .citation if desired,
  3. it allows us to programmatically detect and reformat citation links after the fact, if desired (e.g. to provide links to your local library's resolver).

There are a number of things we'll need to do:

  • verify we really can add a button to the edit interface
  • pick a 'backend' for the search dialog (the prototype above is a hack; it would be nice to run off MathSciNet or Zentralblatt, etc, but this may require a lot of coordination)
  • design and build the search dialog
  • beta test with some users
$\endgroup$
  • $\begingroup$ I recall similar discussions on meta.MSE, $\endgroup$ – Asaf Karagila Feb 9 '14 at 3:44
  • 1
    $\begingroup$ @AsafKaragila I have looked at the questions that are tagged citation, but I did not find which one you have in mind. The only thing I recall, which is related to this, is DOI support for hyperlinks - a feature-request by Willie Wong on meta.SO. $\endgroup$ – Martin Sleziak Feb 9 '14 at 9:26
  • $\begingroup$ @Martin: Yes, the DOI feature was born from a discussion, and my adamant refusal to open an account on meta.SO, leading Willie to post this request. (It was before the days that it was established that feature requests can be made on any meta.) I should also point out that the situation here is different, because MO is allowed to inject non-malicious scripts into the page, so we can do it independently. $\endgroup$ – Asaf Karagila Feb 9 '14 at 10:21
  • $\begingroup$ @quid: Oh, it might be the case that I was thinking about this thread. (Scott, note how you claimed to be uninterested in implementing this yourself. :-)) $\endgroup$ – Asaf Karagila Feb 9 '14 at 10:31
  • $\begingroup$ @AsafKaragila (Sorry I deleted comment as I were to add something. Yes I think this could be it, see one of your later comments) There is a discussion on tea started also mentioning some to be started discussion on meta.math.SE see tea.mathoverflow.net/discussion/1147/doi-feature Yet in a comment to this later related dicussion you only recall tea and meta.SO meta.math.stackexchange.com/questions/3277/… $\endgroup$ – user9072 Feb 9 '14 at 10:32
  • $\begingroup$ Thank you for the historical research! I'd forgotten so much (even though I'd been part of those conversations). $\endgroup$ – Scott Morrison Feb 9 '14 at 11:05
  • 1
    $\begingroup$ The 'hack' search interface above already recognizes MR numbers, and could very easily be made to recognize arXiv identifiers too. I'm imagining that if you already have text selected when clicking the 'add citation' button, that will be pasted into the search. Thus one could simply type 'in the paper MR12345', highlight the MR12345, click the 'add citation' button, accept the first search result, and be on your way. This sounds really appealing to me! $\endgroup$ – Scott Morrison Feb 9 '14 at 11:07
  • 1
    $\begingroup$ I have a very similar feature request on MSO (meta.stackexchange.com/questions/116397/…). Mine is a bit more focused on life sciences though. $\endgroup$ – Mad Scientist Feb 9 '14 at 12:16
  • 1
    $\begingroup$ By the way, the script is pretty awesome. I got a bit scared when "Iggy Pop" returned ten results. :-) $\endgroup$ – Asaf Karagila Feb 9 '14 at 15:20
  • 1
    $\begingroup$ @MadScientist's request also suggests footnoting the full citation, which I think is a nice idea. $\endgroup$ – Scott Morrison Feb 9 '14 at 20:51
  • $\begingroup$ @AsafKaragila, yes, as written it's intended as a very 'fast and loose' search. If some of your search queries don't match, it still returns the best matches for the others. Notice iggy returns no results $\endgroup$ – Scott Morrison Feb 9 '14 at 20:53
  • 2
    $\begingroup$ Yeah, obviously the "Iggy Pop" search was to poke fun at this pretty cool tool. I also searched for several metal bands. Interestingly most of them (except obvious names like Death and Earth) returned nothing. Abyssic Hate, on the other hand, had four results! :-) $\endgroup$ – Asaf Karagila Feb 9 '14 at 21:11
  • $\begingroup$ It is definitely possible to add buttons to the edit window; for a nice example see MathJax buttons on the edit window in stackapps. $\endgroup$ – Emilio Pisanty Feb 17 '14 at 11:50
  • 1
    $\begingroup$ @EmilioPisanty, thanks for this. Someone (likely me) should adapt the example you linked to do what we want. If that looks okay we can arrange to inject it from the footer. $\endgroup$ – Scott Morrison Feb 19 '14 at 8:43
  • 1
    $\begingroup$ Old request for this feature in MSO, turned up by Shog9: Add explicit support for citing scientific literature. $\endgroup$ – Emilio Pisanty Feb 24 '14 at 22:15
21
$\begingroup$

We now have a prototype for inserting citations!

See it in action in this video tutorial.

It currently requires you to install a user script, and has only been tested on the Chrome browser.

To get started, open Chrome, and click on this link to download the user script. Once you've downloaded it, go to the "Window" menu in Chrome and select "Extensions". Drag and drop the downloaded user script file into the Extensions tab, and click "Add".

Now, visit MathOverflow and start asking a new question (or starting answering an existing question). You'll see at the top of the edit box there's a button labelled \cite. Click this, and a search dialog will pop up. (If you've selected text in the edit window, this will automatically be copied into the search dialog.) The search dialog accepts titles, authors, and citation data in any combination. You'll see one or more best matches, and often a preview of the PDF in the right pane. If you see what you want, select it in the left pane, and a nicely formatted citation will be inserted back in the edit box!

Here are some screenshots of the script in action.

enter image description here enter image description here enter image description here enter image description here

$\endgroup$
  • 1
    $\begingroup$ Is it possible to make the citation link text more than just the title? I would prefer a more comprehensive link text, with authors, journal, year, etc. It is easy to delete this or simplify it, for those who don't want it, but a bit harder to add it in. Also, I guess the literature search doesn't seem to include the math arxiv? $\endgroup$ – Joel David Hamkins Mar 10 '14 at 16:28
  • $\begingroup$ @JoelDavidHamkins, I think this can be arranged pretty easily. The search tool returns all this data, so it's just a matter of tweaking the javascript that inserts the link. I'll ask Manish to do this. I can include all the arxiv readily enough, but I'm going to wait on resolving another issue. $\endgroup$ – Scott Morrison Mar 10 '14 at 22:22
  • 2
    $\begingroup$ Another idea might be to make the article title the link, but to have the rest of the citation information such as author and journal etc. available inside the <cite> object as (unlinked) mere text. $\endgroup$ – Joel David Hamkins Mar 12 '14 at 0:14
  • $\begingroup$ @JoelDavidHamkins What do you think of this, for the linkification? (A quick way to test this for one page is to disable the citation userscript in chrome://extensions and copy the code from the above link into the JS console; Ctrl-Shift-J) The entire block now inserts the citation, however you can click on a preview link and have the preview load inline. $\endgroup$ – Manishearth Mar 15 '14 at 10:08
  • $\begingroup$ @Manishearth, I am very sorry, but I evidently I am not capable of implementing your script properly. Perhaps you can just provide a sample output? $\endgroup$ – Joel David Hamkins Mar 16 '14 at 0:23
  • $\begingroup$ @joel here. There's a chance I broke something yesterday (I linked you to the non-stable branch of the code which is not guaranteed to work), I'll have a look in a while. Thanks. $\endgroup$ – Manishearth Mar 16 '14 at 3:55
  • $\begingroup$ @Manishearth, looks great, if I understand what you are saying. $\endgroup$ – Joel David Hamkins Mar 16 '14 at 11:37
  • $\begingroup$ @JoelDavidHamkins, I've just added some screenshots, showing how it works and the updated linking style. $\endgroup$ – Scott Morrison Mar 16 '14 at 13:04
  • $\begingroup$ We need to sort a few things out in the background, but hopefully this is going to be ready soon! $\endgroup$ – Scott Morrison Mar 16 '14 at 13:04
  • 1
    $\begingroup$ Fantastic! This is exactly the kind of thing I had had in mind with my suggestion. $\endgroup$ – Joel David Hamkins Mar 16 '14 at 13:05
  • $\begingroup$ So when can we expect a FF script? $\endgroup$ – Asaf Karagila Mar 16 '14 at 19:37
  • $\begingroup$ Great! Tested in Firefox and GreaseMonkey and seems to work (I needed to allow javascript from herakuapp.com). By the way can you add also Theoretical Computer Science to the list of the sites that the script works on? $\endgroup$ – Kaveh Mar 17 '14 at 5:55
  • 1
    $\begingroup$ @Kaveh the best place to report issues is here, but pinging me here is fine too. (Somehow I missed this). I think Scott's backend is acting strange in this case. I'll try rehosting it this weekend if possible and look into it (no guarantees though, I'm not too familiar with the backend). $\endgroup$ – Manishearth Apr 11 '14 at 10:14
  • 1
    $\begingroup$ @Manishearth This extension no longer works for me in Chrome, since Chrome won't let me enable it, as it is not "from the Chrome store". Is there any way to get it working again? Can it be made available at the Chrome web store? $\endgroup$ – Joel David Hamkins Jun 27 '14 at 13:51
  • 1
    $\begingroup$ @JoelDavidHamkins There are some solutions to the problem here and here. I shall try to publish this to the play store, maybe as an unlisted app, next week when I'm not travelling so much. $\endgroup$ – Manishearth Jun 27 '14 at 16:21
5
$\begingroup$

Seems like a very useful feature to me. I am not an expert on HTML and co; but wouldn't the cite element be more appropriate than a general span tag?

As far as I know, you can still use all the other attributes that you were already using. The benefit would be a more semantic markup, which is good for SEO, and for custom stylesheets of users (or say specific browsers).

You could still keep the .citation class, but it would even be less necessary. (Though I can imagine you want someway to distinguish between tags inserted by this button, and cite-tags inserted manually by users.)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .