jkitchin / jmax

Johns customizations to maximize emacs
185 stars 59 forks source link

org-ref bibliography file definition in export to tex and in main org file #34

Closed Xparx closed 9 years ago

Xparx commented 9 years ago

I started prototyping a document and played with inserting citation links with org-ref. Unfortunately I ran in to some problems.

I have setup org-ref for my default bibliography in ~/research/bibliography.bib as well as for reftex. If I only insert cite: links this works as expected and I can click the links and open pdf links etc.

If I try to export my document to a latex file with the org export command (C-c C-e) then the resulting tex file will not have any links to any bibliography files as expected. Now if I add the bibliography key: bibliography:~/research/bibliography.bib this will exports to the tex file, however it seems tex does not support the ~ character for linking to $HOME. There are two ways to remedy this that I have found, either add "\string" in front of the link, or add/copy a link in ~/texmf/bibtex/bib/ to your bib file which makes it possible to just add "bibliography" to the tex file loosing the path from the end.

However, doing any of these two solutions breaks org-ref linking to the bibliography and org-ref can no longer find the bibliography file.

What I want to avoid is to have to copy my global bibliography to the local directory with the org file while still being able to export to latex. Have I missed some detail of how to deal with this issue? Is there a smart way already to avoid this and still being able to export to tex with a global bib file, and if not could this be fixed with an expand file name for "~" in the bibliography link?

jkitchin commented 9 years ago

does it work if you use an absolute path to your bibliography?

John


John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu

On Mon, Sep 22, 2014 at 10:58 AM, Andreas notifications@github.com wrote:

I started prototyping a document and played with inserting citation links with org-ref. Unfortunately I ran in to some problems.

I have setup org-ref for my default bibliography in ~/research/bibliography.bib as well as for reftex. If I only insert cite: links this works as expected and I can click the links and open pdf links etc.

If I try to export my document to a latex file with the org export command (C-c C-e) then the resulting tex file will not have any links to any bibliography files as expected. Now if I add the bibliography key: bibliography:~/research/bibliography.bib this will exports to the tex file, however it seems tex does not support the ~ character for linking to $HOME. There are two ways to remedy this that I have found, either add "\string" in front of the link, or add/copy a link in ~/texmf/bibtex/bib/ to your bib file which makes it possible to just add "bibliography" to the tex file loosing the path from the end.

However, doing any of these two solutions breaks org-ref linking to the bibliography and org-ref can no longer find the bibliography file.

What I want to avoid is to have to copy my global bibliography to the local directory with the org file while still being able to export to latex. Have I missed some detail of how to deal with this issue? Is there a smart way already to avoid this and still being able to export to tex with a global bib file, and if not could this be fixed with an expand file name for "~" in the bibliography link?

— Reply to this email directly or view it on GitHub https://github.com/jkitchin/jmax/issues/34.

Xparx commented 9 years ago

Yes that works. Both org-ref and latex compiling works if an absolute path is supplied. This could be a working solution for now. It does make the document less agnostic between my machines and user names though.

regards Andreas

jkitchin commented 9 years ago

what do you think would be better: an absolute file expansion, or relative file name expansion?

John


John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu

On Mon, Sep 22, 2014 at 7:23 PM, Andreas notifications@github.com wrote:

Yes that works, both org-ref and latex compiling works if an absolute path is supplied. This could be a working solution for now. It does make the document less agnostic between my machines and user names though.

regards Andreas

— Reply to this email directly or view it on GitHub https://github.com/jkitchin/jmax/issues/34#issuecomment-56458489.

Xparx commented 9 years ago

I can't see any obvious reasons to picking one over the other but it seems to me that an absolute path would be somewhat more transparent, and if you auto complete the path in the org-ref link this is probably what you enter anyway.

jkitchin commented 9 years ago

ok, I have pushed an expand-file-name on the link export so it should put an absolute path in for you.

Xparx commented 9 years ago

Thank you!