Feature request: Magic citations as in papers

When I used Papers, I really loved the Magic Citations feature, where, in any application you could double-click the control key and it would bring up a search bar for your Papers database, providing the matches to that search. Then, when you selected the reference you wanted you could select how you wanted to insert the reference, as a bibtex citekey, as a full bibliographic entry or as a papers citation. It was a great feature.
«1
  • Better BibTex for Zotero has some version of this feature. It doesn't produce formatted references, but does to citekeys and other relevant format.
    https://github.com/retorquere/zotero-better-bibtex/wiki/Cite-as-you-Write
    It requires a bit of set-up, but then works very smoothly.
  • What is a papers citation?
  • edited November 20, 2017
    The Papers3 app has a feature where you can call up the citation picker from within any application to search your database and insert citekeys or formatted references (and a few other options).
    http://pfw.mekentosj.com/kb/read-write-cite/magic-manuscripts

    http://support.papersapp.com/mac/manual#http://support.mekentosj.com/kb/cite-write-your-manuscripts-and-essays-with-citations/magic-citations-on-papers-3-for-mac

    @emilianoheyns Would it be possible to an option to copy a formatted bibliography for the items in a pre-selected CSL style to BBT CAYW feature?
  • Possible, yes, please open a github issue and I'll look into it. On that page you linked to I see {Kaplan:8RPYwYR+}, what does that do?
  • (why would someone want a formatted citation rather than a scannable-cite citation?)
  • That is the Papers3 citation key. Papers3 inserts placeholders like that until the user manually chooses a Format Citations option which applies the CSL style.

    The use case for inserting a formatted citation is if you are working in, say, an email client or web browser and want to paste a reference to article without having to switch to Zotero, search, and use Quick Copy.

    Papers can also Quicklook the PDF for an item from their citation picker. Does the BBT picker include the Show in My Library button? Could that be added (I will put this on GitHub)?
  • It should be possible to leave the picked references highlighted; I think Zotero has a mechanism for that. I can't tell whether the picker searches for attachments; I have no idea what it does really, I just pop it up, and grab the results when it closes. What that happens between those two events -- no idea, as it's not relevant to BBT (and I'd love to keep it that way).
  • @skiss BetterBibTeX 5.0.45 has been updated to include the option to return formatted references.

    On a Mac, you can use Automator to make a keyboard shortcut to bring up the Zotero picker from any application.

    In Automator, create a new Service. Set the service to receive "no input" in "any application". Then, tell it to "Run AppleScript" and enter this code:
    on run

    tell application "System Events"
    set activeApps to name of application processes whose frontmost is true
    set activeApp to item 1 of activeApps
    set currentClipboard to the clipboard
    set curlOutput to (do shell script "curl 'http://localhost:23119/better-bibtex/cayw?format=formatted-bibliography'";)
    set the clipboard to curlOutput
    end tell
    activate application activeApp
    tell application "System Events"
    keystroke "v" using {command down}
    delay 1
    set the clipboard to currentClipboard
    end tell

    end run


    Save the workflow and open System Preferences. Choose Keyboard -> Shortcuts -> Services. Find your Zotero workflow and assign a keyboard shorcut to it.
  • formatted-citation and formatted-bibliography have been added to BBTs CAYW. It stretches the scope a bit because it really doesn't have anything to do with BBTs citekeys, but it was easy to add.
  • Appreciate the addition.
  • (the "Show in my library button is part of the Zotero picker, which I call but do not otherwise touch, so yes, that still works)
  • @emilianoeheyns BBT is only updating to 5.0.44 for me.
  • That will be .46 then on account of an oversight on my part.
  • Man applescript is one funky language. It makes me think of a mix of COBOL and INTERCAL.
  • Yeah, it is definitely weird...
  • @bwiernik @skiss I think I have found and easier way to use the automator. Similar to bwiernik suggestion, first we need to create a service but we use the "run shell script" option instead of applescripts, then we could input this code:

    open http://localhost:23119/better-bibtex/cayw\?format\=latex\&clipboard\=yes

    and follow the rest of bwiernik instructions.

    What do you think about this?
  • @mddavila the applescript also pastes the results in the app that was running when you called up the picker and restores the clipboard to what it had before the picker puts its data in the clipboard.
  • edited April 18, 2018
    This should work out of the box: no script, no plugin. Today inserting citation is a mess except on MS Word and Libre Office.

    I should be able to set a global shortcut that launches the zotero picker and insert a citekey in any document. This would finally make zotero compatible with Scrivener, markdown editors, Google Drive, and so on...

    I agree, the Paper 3 implementation with their "magic citation" (using universal citekey) is almost *perfect*. Following what they did can set standard for citation key that works when you collaborate with others even when using different citation manager. They published the implementation for the citekey part: https://github.com/cparnot/universal-citekey-js

    A "universal picker" is definitely my top wanted feature.
  • I gave it a stab, but I think that proposal needs a ton of work before it's useful: https://forums.zotero.org/discussion/comment/302067#Comment_302067
  • @gagarine but my offer in that same thread stands -- if you're willing to test, I can get you a build that generates them. If you can also get Mekentosj to actively take up the lead on breathing life into this (I certainly won't, and that proposal has apparently sat there for 4 years without moving), I'll gladly join.
  • The developer is no longer at Papers and Papers is getting folded into Readcube. I wouldn't get my hopes up on that front.
  • edited April 18, 2018
    Readcube has no interest in bibtex whatsoever. I polled them when I was headed into the Z5 port (TBH, I seriously considered switching ref managers at the prospect of the port), but you can only reach their level 1 support, and they are, to put it kindly, not equipped to talk to engineers. Plus they have a client for "PC/Mac", but that "PC" needs to be running Windows or MacOS. A PC running Linux doesn't count. Lame.

    That "universal citekeys" idea as carried by cparnot is, in other words, dead. I'm open to discuss another tack that addresses the problems mentioned in https://forums.zotero.org/discussion/comment/302067#Comment_302067, but someone else will a) have to take point, while b) still accepting I will have strong opinions on the matter.
  • edited April 18, 2018
    I agree with @emilianoeheyns 's observations on the "universal citekey" proposed by Papers.

    There are different moving parts to solve the problem of editor agnostic citing:
    - an interface to search and cite "at the OS level" (a global shortcut)
    - some kind of citekey
    - a way to transform the citekey in citation
    - a way to transform citation back to citekey

    I think the system should not be fixed to a given citekey systems, but the user should be able to choose what kind of citekey he wants to use. So the problem of the universal citekey can be solved after.

    A lot of things are already done and other projects try to solve similar problems like https://retorque.re/zotero-better-bibtex/

    Sadly, I really have no time for working on that right now. But I can spend a couple of hour for testing.
  • The bbt key generator works, that's not the problem. If you and your collabs use bbt, a stable key can potentially be derived from the internal alphanumeric id. The problem remains that titles change, and non zotero (or non synced zotero) clients are out of the loop. For universality you need something like the mekentosj proposal, but it's no good doing this in isolation. At least one other ref mgr would have to be actively involved, plus users who actually need this. Without those, it's merely an (pardon the pun) academic exercise, and I don't have time for that right now. If someone takes point, I'm game.
  • edited April 18, 2018
    Plus a global shortcut doesn't really make sense. A global shortcut requires coordination with all of the other running apps, on every different platform ,and even if you manage that, what would it do? Where would it deliver the data to, and in what format? These are all workarounds for the fact that editors don't want to offer the plumbing to build a clean interop. Word/libre office offer the plumbing, and hey, it works. Lyx and texstudio offer the plumbing, and those work. Tools like Scrivener don't - and the only reason it doesn't is because outfits like L&L can't be arsed to create a plug-in system, or an API of any kind.
  • edited April 18, 2018
    I mean a global shortcut for Zotero so you can call the Zotero picker from any software without the need of a plugin. Like that: http://support.readcube.com/support/solutions/articles/30000024001-magic-citations-on-papers-3-for-mac (again it works without plugins)

    Their is millions of applications providing global shortcuts. Like MacPass that let you enter passwords in browser without having any plugin https://github.com/MacPass/MacPass/wiki/Autotype#global-autotype

    It works by simply writing the text or search and replace. It works with almost any application without the need to a specific API.
  • edited April 21, 2018
    Ah, like so. Papers lets you pick while Papers is open,then lets you select an application to paste in to? The first part could be handled by Zutilo. The second part, I don't know. it would involve getting a list of active applications, let you select one,and it will paste into that, correct? I see how that would be useful, but it's something that can be built on top of zotero/bbt, it's not something I'm looking to build into bbt myself (although I'd accept a pull request which did). It involves too much platform specific work and UI, two things I'm not keen on.
  • I have this working with the CWYW picker and a simple script with Auto script on Linux, pasting the text returned by the picker to the current document.

    It's a perfectly reasonable solution, but I don't see any way of doing this without completely separate code for each OS.
  • edited April 18, 2018
    @emilianoeheyns yes like that :). On Paper, the main program don't even need to run (certainly do a call directly in the DB and use some shared library)

    There is different ways of achieving this. You can know the last active windows. I believe you can also avoid taking the full focus (floating windows, like a virtual keyboard for example). In fact, it should work pretty much like a virtual keyboard (on-screen keyboard).

    That requires some OS level code. But the custom part can certainly be pretty small, no? But I'm not a system programmer...
  • I have no idea, and no burning desire to find out. Running it without having zotero adds more complexity; it's possible to access the DB while zotero is not running (it wouldn't necessarily be fun given the normalization in the DB, but doable), but when Zotero is running,the DB is locked for other programs. You'd have to check and handle access of the DB (direct or indirect), and act appropriately. That's not an insignificant amount of work. It'd be a *lot* less work for L&L to call into zotero, and I don't see them moving...
Sign In or Register to comment.