KarlHegbloom / zotero-texmacs-integration

Integration of the Juris-M or Zotero reference manager with TeXmacs for using CSL citation styles in documents.
Other
17 stars 2 forks source link

Drop-in BibTeX replacement #2

Closed retorquere closed 8 years ago

retorquere commented 8 years ago

Hey Karl,

I'm trying to understand what this utility does. You say it parses the aux file and produces a bbl file. Is that all there's to replacing BibTeX? Can you walk me through what it does roughly? I'm interested in creating a drop-in replacement that would be distributable through npm, bundling citeproc, so it could work both with and without Zotero running, mainly as a potential solution for https://github.com/retorquere/zotero-better-bibtex/issues/482. I had been looking at https://github.com/nzhagen/bibulous because I fthought python would be easier for me to read than scheme, but I just don't grok the whole bibtex process.

KarlHegbloom commented 8 years ago

This will read a simple .aux file created by TeXmacs and produce a .bbl for the bibliography. It will only work for numbered or authorDATE style labels right now. It does not format labels for them, only the bibliography. So, an in-text citation style won't work right with it. I have not spent enough time on learning how BibTeX can do that for styles that do it. I think that for that you need BibLaTeX, is that correct? It would not be very difficult to make this handle that case. It's just a matter of what JSONRPC method you access, and thus what the output looks like.

Read the Notes.md file for what I've learned about TeXmacs. I don't know how LaTeX or it's BibLaTeX styles actually create the in-text label. For TeXmacs, there's a binding between a \label{symbol} and a value for that symbol. Calling \set-binding{symbol}{label} will set it. The document does not update instantly, but if you click on the in-text label, it will change to the new value. I suppose that perhaps LaTeX has a similar mechanism for setting the value of the in-text citation?

It would be cool if Guile's implementation of ECMAscript could run citeproc.js. I bet it can be made to, with some effort. I don't have time for it right now. I am preparing for a custody trial, so my son can come live with me.

KarlHegbloom commented 8 years ago

This package is going to be an interface between TeXmacs and Juris-M / Zotero that will work like the OpenOffice / LibreOffice integration does. It will use the same connection port and protocol. I was going to use your cayw and schmod interfaces, but changed my mind. It will probably require a modification to the Zotero xpcom/integration.js that I've asked them about, to add the option to change it's output format to one set by a (for now) invisible preference, so that I can make it output latex instead of rtf. Otherwise I have to try and make an rtf translator. I might end up switching to using Better BibTeX for Zotero and cayw + schmod instead, and let TeXmacs drive that instead of letting Zotero drive TeXmacs the way the connector works now.

Any ideas?

retorquere commented 8 years ago

Wow, rough deal. I understand you putting your attentions with your son first -- I previously thought you were prepping a case for your academic pursuits.

Calling citeproc (which is what you're doing, albeit via json-rpc) should allow you to get both the citations and the bibliography.

I've looked into using the Zotero-plugin protocol myself, but it was more work than just calling up the picker, so that's where I went. But the protocol they use is not super-complicated, and it should be slightly cleaner. But just having an invisible option to change output format is not the end of the road; you also need to have the LaTeX output format in Zotero in much the way you proposed in your pull request. That in itself is not impossible, natch, but we've been waiting for a simple extra field to store the LaTeX citation key for years, and that hasn't materialized yet. And that's simpler than what's on the table here.

RTF to LaTeX... possible, but if you don't have to go there, I'd spend my energy elsewhere. Much better to get another output format into Zotero.

KarlHegbloom commented 8 years ago

Take a look now, if you like. My connector for TeXmacs works. I have not done more work on the drop-in for bibtex. The connector works just like the one for LibreOffice.

retorquere commented 8 years ago

If I understand correctly, this speaks the wire protocol of the existing word processor extensions. That's neat, I couldn't get it to work myself. But this will work then regardless of whether you have bbt installed, which is a win. Are there other benefits? If there are, I might deprecate the cayw interface in favor of this.

Your readme mentions you need to have a patched version of zotero, what exactly have you patched? I might be able to monkey-patch it in so you wouldn't need to maintain a separate version of zotero just to get this integration to work. How have the zotero authors responded to your request?

KarlHegbloom commented 8 years ago

It requires Better BibTeX for Zotero for the bbl output format, as well as a patched copy of the integration.js in Juris-M or Zotero that enables it to use that output format. I tried to make it work with rtf, but it's not easy and I gave up. Just look at the pull request from my fork of zotero. The change is simple. I would rather not monkey patch it.

I might pull the X-X-X hack out of the conditional on bbl, to make it work for rtf also. It let's me set an abbreviation to X-X-X to make it delete that string and the space following it. Setting an abbreviation to empty just makes it take the default.

I'm looking at the bibliography settings it stores in the document that are set by the editBibliography dialog, and at the documentation to citeproc.js, thinking about extending this integration interface to allow having multiple bibliography fields, so one for federal cases, one for state, one for journal articles and books, etc. to better organize the tables of authorities.

I want to make a configuration pane for switching it between TeXmacs (bbl) and LibreOffice (rtf) mode.

I also need to implement end notes, but that's lower priority since I don't plan to use them myself.

I think I have some changes to the bbl format that I need to send a pull request for, soon.

On Mon, May 23, 2016, 01:47 retorquere notifications@github.com wrote:

If I understand correctly, this speaks the wire protocol of the existing word processor extensions. That's neat, I couldn't get it to work myself. But this will work then regardless of whether you have bbt installed, which is a win. Are there other benefits? If there are, I might deprecate the cayw interface in favor of this.

Your readme mentions you need to have a patched version of zotero, what exactly have you patched? I might be able to monkey-patch it in so you wouldn't need to maintain a separate version of zotero just to get this integration to work. How have the zotero authors responded to your request?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/KarlHegbloom/zotero-texmacs-integration/issues/2#issuecomment-220909501

retorquere commented 8 years ago

I can't find your pull request, nor do I see your name in the history of integration.js on your own fork. Monkey-patching isn't preferable, of course, but I just figured if you wanted to get this into the hands of others, I could help you get there faster, especially since in the current config, BBT is required anyhow.

Not entirely where the X-X-X hack lives, but from your description, it's fairly contained, so that should be OK.

Your pull request on BBT is still unmerged BTW, as you asked me to hold off. In the interim, some things have changed, so if you could merge my latest master before the final merge request, that'd help me to review the changes.

KarlHegbloom commented 8 years ago

It's not on the default branch.

On Mon, May 23, 2016, 03:33 retorquere notifications@github.com wrote:

I can't find your pull request, nor do I see your name in the history of integration.js on your own fork. Monkey-patching isn't preferable, of course, but I just figured if you wanted to get this into the hands of others, I could help you get there faster, especially since in the current config, BBT is required anyhow.

Not entirely where the X-X-X hack lives, but from your description, it's fairly contained, so that should be OK.

Your pull request on BBT is still unmerged BTW, as you asked me to hold off. In the interim, some things have changed, so if you could merge my latest master before the final merge request, that'd help me to review the changes.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/KarlHegbloom/zotero-texmacs-integration/issues/2#issuecomment-220932258

KarlHegbloom commented 8 years ago

Ok. Need sleep first.

On Mon, May 23, 2016, 05:18 Karl Hegbloom karl.hegbloom@gmail.com wrote:

It's not on the default branch.

On Mon, May 23, 2016, 03:33 retorquere notifications@github.com wrote:

I can't find your pull request, nor do I see your name in the history of integration.js on your own fork. Monkey-patching isn't preferable, of course, but I just figured if you wanted to get this into the hands of others, I could help you get there faster, especially since in the current config, BBT is required anyhow.

Not entirely where the X-X-X hack lives, but from your description, it's fairly contained, so that should be OK.

Your pull request on BBT is still unmerged BTW, as you asked me to hold off. In the interim, some things have changed, so if you could merge my latest master before the final merge request, that'd help me to review the changes.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/KarlHegbloom/zotero-texmacs-integration/issues/2#issuecomment-220932258