Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work out some story for exporting citations to Latex #7

Open
takluyver opened this issue Nov 2, 2014 · 10 comments
Open

Work out some story for exporting citations to Latex #7

takluyver opened this issue Nov 2, 2014 · 10 comments

Comments

@takluyver
Copy link
Owner

People will inevitably want to export notebooks to Latex, despite my misgivings about it. This will involve turning the citations into latex \cite{foo} commands (see the citation filter in nbconvert), possibly re-keying them, and creating a bibtex file with the corresponding citation data.

For creating the bibtex file: I've not yet found a tool that will convert CSL JSON to bibtex. Pandoc-citeproc does the other way. Bibutils goes between various citation format, but not CSL JSON, and it's GPLed, so I'd rather avoid it if possible. Is there something out there to do it? Is Bibtex simple enough that we can do it ourselves?

Zotero can import CSL JSON and export Bibtex, so it must have the necessary code, but I don't know how easy it would be to pull it out.

Failing anything else, references can be re-downloaded from the Zotero web API in Bibtex format, but then all the citations must be in Zotero, and in one user/group library. That's how citations are inserted, but at present, once they're in the document, it doesn't matter where they came from, and it would be nice to preserve that abstraction.

@bramtayl
Copy link

It would be slightly more preferable to use biblatex (more features). I use this to export biblatex: https://github.com/ZotPlus/zotero-better-bibtex.

Citations are handled within markdown by RMarkdown:
http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html

@cwerner
Copy link

cwerner commented Jun 10, 2016

Hi. Is there any news on this issue (exporting to PDF/ Latex)? Would be super-interested in this...

@takluyver
Copy link
Owner Author

I got a good tip for converting to bibtex (presumably biblatex too) the other day: there are CSL files for bibtex, so we can convert CSL JSON to bibtex by rendering with a bibtex 'style'. I'm just on the way back from an electronic publishing conference, which has inspired me to get back to developing cite2c. My first priority will probably be supporting different citation styles in the live notebook, but after that nbconvert integration is the next thing.

@cwerner
Copy link

cwerner commented Jun 10, 2016

Cool.

Thanks for the heads-up

On 10 Jun 2016, at 13:33, Thomas Kluyver [email protected] wrote:

I got a good tip for converting to bibtex (presumably biblatex too) the other day: there are CSL files for bibtex, so we can convert CSL JSON to bibtex by rendering with a bibtex 'style'. I'm just on the way back from an electronic publishing conference, which has inspired me to get back to developing cite2c. My first priority will probably be supporting different citation styles in the live notebook, but after that nbconvert integration is the next thing.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #7 (comment), or mute the thread https://github.com/notifications/unsubscribe/ANQyV3r4c3OiSVak9f9v_2zhu6EpWvFuks5qKUudgaJpZM4C19Hc.

@cwerner
Copy link

cwerner commented Jun 11, 2016

Hi again.

Just another quick question if you don’t mind? I’m currently implementing the proposed workflow from here:

http://blog.juliusschulz.de/blog/ultimate-ipython-notebook

This works, but I was wondering if there is a way to use my trusty bibtex citeckeys instead of these crazy Zotero keys?!? I’m not a Zotero user per se but rather importing my bibtex library to Zotero in order to pull it in via your cite2c script…

Thanks man,
C

On 10 Jun 2016, at 13:34, Christian Werner [email protected] wrote:

Cool.

Thanks for the heads-up

On 10 Jun 2016, at 13:33, Thomas Kluyver <[email protected] mailto:[email protected]> wrote:

I got a good tip for converting to bibtex (presumably biblatex too) the other day: there are CSL files for bibtex, so we can convert CSL JSON to bibtex by rendering with a bibtex 'style'. I'm just on the way back from an electronic publishing conference, which has inspired me to get back to developing cite2c. My first priority will probably be supporting different citation styles in the live notebook, but after that nbconvert integration is the next thing.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #7 (comment), or mute the thread https://github.com/notifications/unsubscribe/ANQyV3r4c3OiSVak9f9v_2zhu6EpWvFuks5qKUudgaJpZM4C19Hc.

@takluyver
Copy link
Owner Author

Sorry, there isn't a way to do that. Zotero IDs provide consistent, unique identifiers, and since you shouldn't need to write them by hand, there isn't a strong pressure for them to be especially memorable.

Thanks for the link, though - it's cool to see that @jcfschulz has already worked out a way to export to Latex. I'll try to use that as a starting point.

@jcfschulz
Copy link

Hi,
we have a more worked out version of my blog post above already on github:
https://github.com/schlaicha/jupyter-publication-scripts

The automatic install scripts are not perfect, but since I was switchting jobs recently, I didn't have time yet. Also the devel branch is I think more bug free than the master branch. Feel free to post any bugs, we will try our best to fix them.

Greetings, J

@takluyver
Copy link
Owner Author

Thanks for the info :-) I'll try to work it into cite2c so that it's one thing to install for citations in notebooks.

@jcfschulz
Copy link

Great. iirc the only file you need to include is https://github.com/schlaicha/jupyter-publication-scripts/blob/master/extensions/pre_cite2c.py. Not the added dependency on the unicode_tex module, which correctly masks the non-ascii characters, since bibtex doesn't work with uff-8.

Also I remember, there is still a bug considering the year. Not all zotero entries have this in the way I implemented, this has to be fixed at some stage.

If you still have an older version of jupyter-notebook, also keep this jupyter/nbconvert#193 upstream bug in mind.

@cwerner
Copy link

cwerner commented Jun 13, 2016

Cool that’s some development happening there…

Let me know if you need someone for testing stuff.

On 13 Jun 2016, at 13:59, jcfschulz [email protected] wrote:

Great. iirc the only file you need to include is https://github.com/schlaicha/jupyter-publication-scripts/blob/master/extensions/pre_cite2c.py https://github.com/schlaicha/jupyter-publication-scripts/blob/master/extensions/pre_cite2c.py. Not the added dependency on the unicode_tex module, which correctly masks the non-ascii characters, since bibtex doesn't work with uff-8.

Also I remember, there is still a bug considering the year. Not all zotero entries have this in the way I implemented, this has to be fixed at some stage.

If you still have an older version of jupyter-notebook, also keep this jupyter/nbconvert#193 jupyter/nbconvert#193 upstream bug in mind.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #7 (comment), or mute the thread https://github.com/notifications/unsubscribe/ANQyV8bzyM10mX2tkgvce0HUQrAI5UkAks5qLUYZgaJpZM4C19Hc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants