jkitchin / org-ref

org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.
GNU General Public License v3.0
1.36k stars 243 forks source link

Undefined links #165

Closed Nicholas-Autio-Mitchell closed 8 years ago

Nicholas-Autio-Mitchell commented 8 years ago

First of all - thanks for this extremely helpful package!

This is likely a setup question, not a bug.

I have used the setup described in the README, and am able to call up a list of my references from a .bib file from within an org file (helm view). Selecting one inserts it as expected, e.g. cite:jkitchin2016

However, when I export to to pdf via Latex, I get "undefined citation" error messages. This is almost certainly a problem with my setup, but given I can get as far as the helm-selection-insert, I can't understand where the problem comes from. I admit I am new to Latex, so maybe I am missing something simple - I have however followed instructions from org-ref.

Any pointers on where to look for the cause?

jagrg commented 8 years ago

Have you added your bib file to the actual org document? It should look something like this: bibliography:file.bib (or this: \bibliography{file}).

Nicholas-Autio-Mitchell commented 8 years ago

Yes, I tried both ways. Actually if I hadn't have done that then I would not have been able to call up the list of references to choose from using C-c ].

Does the export to latex need a pointer to the bib file in another place within emacs? I have the default path in my .emacs file set, as shown in the org-ref guide. On 24 Mar 2016 16:23, "Jonathan Gregory" notifications@github.com wrote:

Have you added your bib file to the actual org document? It should look something like this: bibliography:file.bib (or this: \bibliography{file}).

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jkitchin/org-ref/issues/165#issuecomment-200884613

jagrg commented 8 years ago

Yes, I tried both ways. Actually if I hadn't have done that then I would not have been able to call up the list of references to choose from using C-c ].

Not really. You should be able to insert citations on any org file. Is your bib file in the same directory as the org file?

Nicholas-Autio-Mitchell commented 8 years ago

It isn't actually in the same directory as the org file, hence why I needed a path specified for org to find the entries. I did put it in the same directory to test it, but was getting the same error.

I have a bibliographystyle specified. Are there perhaps any other headers that must be ibckuded in the org file?

I forgot to mention I am using org-mode 8.2.10, in case that is an issue? On 24 Mar 2016 16:50, "Jonathan Gregory" notifications@github.com wrote:

Yes, I tried both ways. Actually if I hadn't have done that then I would not have been able to call up the list of references to choose from using C-c ].

Not really. You should be able to insert citations on any org file. Is your bib file in the same directory as the org file?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jkitchin/org-ref/issues/165#issuecomment-200897041

aydemirfb commented 8 years ago

Have you checked your .tex file, can you compile the tex file yourself?

Once I had the error that \bibliography{file} was not in the preamble as it should have been. (I use biber & biblatex).

Nicholas-Autio-Mitchell commented 8 years ago

I checked and \bibliography{file} is included at the end of the generated .tex file! However I wasn't able to compile the file myself from there because I have no master file defined. This isn't normally necessary when exporting directly from org-mode, so I have never done that before. Must I?

Nicholas-Autio-Mitchell commented 8 years ago

@jagrg

Yes, I tried both ways. Actually if I hadn't have done that then I would not have been able to call up the list of references to choose from using C-c ].


Not really. You should be able to insert citations on any org file. Is your bib file in the same directory as the org file?

I meant to say, the helm-view does appear, regardless of whether a bib file is specified or not, but my personal references do not appear if no file is specified - only the org-ref options to search via other tools.

jagrg commented 8 years ago

Indeed. You should try compiling the tex file yourself. That might give you a more detailed information of what the error is. You might be missing the citation package. Try this:

#+LATEX_HEADER: \usepackage[square,sort,comma,numbers]{natbib}
#+LATEX_HEADER: \bibpunct{(}{)}{;}{a}{,}{,}
#+LATEX_HEADER: \setcitestyle{notesep={: }}
Nicholas-Autio-Mitchell commented 8 years ago

I added those headers and then compiled from org-mode to create the .tex file. I then compiled the .tex file, (first through BibTex, then Latex) which completed, but contained the same error in the log:

No file 5_Empirical_Studies.bbl. Package natbib Warning: There were undefined citations. 7 LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. )

Do I need to do something special to get that .bbl file? If so, why isn't org-mode already doing it? ;-)

aydemirfb commented 8 years ago

You should compile 4 times in this order latex bibtex latex latex when compiling your tex file, or try latexmk -pdf -f yourfile.tex

for org-latex export, check this question

jkitchin commented 8 years ago

It is my guess also that your org-latex-pdf-process does not run bibtex. You can see a working setup for that variable here: https://github.com/jkitchin/jmax/blob/master/jmax-org.el#L461

Other solutions probably work too.

jkitchin commented 8 years ago

You do have to specify a bibliography link (and sometimes a bibliographystyle) link in your org file to generate legitimate latex that can be compiled.

You might try running M-x org-ref-debug and posting the output.

It provides a lot of information that might be helpful in debugging.

M-x org-ref will give you some information about your org-file, e.g. if there is missing information.

Nicholas Mitchell writes:

Yes, I tried both ways. Actually if I hadn't have done that then I would not have been able to call up the list of references to choose from using C-c ].

Not really. You should be able to insert citations on any org file. Is your bib file in the same directory as the org file? I meant to say, the helm-view does appear, regardless of whether a bib file is specified or not, but my personal references do not appear if no file is specified - only the org-ref options to search via other tools.


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/jkitchin/org-ref/issues/165#issuecomment-200911671

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

Nicholas-Autio-Mitchell commented 8 years ago

A mixture of two things have made it work!

Adding the linked lines of code from John's .org file, including bibtex %b and makeindex %b (I already had three pdflatex commands with -shell-escape), and secondly including a bibliographystyle:my_style within the org file [e.g. my_style = plain].

It was these two together that were necessary, as I had actually tried both separately to begin with.

Thanks for the helpful and amazingly quick response, from three people - simply awesome.

I do plan to simply reinstall everything using the "jkitchin" setup very soon; however, with a deadline coming up I don't have time to deal with the potential debugging etc. due to system differences.

Thanks again!

On 24 March 2016 at 18:19, John Kitchin notifications@github.com wrote:

You do have to specify a bibliography link (and sometimes a bibliographystyle) link in your org file to generate legitimate latex that can be compiled.

You might try running M-x org-ref-debug and posting the output.

It provides a lot of information that might be helpful in debugging.

M-x org-ref will give you some information about your org-file, e.g. if there is missing information.

Nicholas Mitchell writes:

Yes, I tried both ways. Actually if I hadn't have done that then I would not have been able to call up the list of references to choose from using C-c ].

Not really. You should be able to insert citations on any org file. Is your bib file in the same directory as the org file? I meant to say, the helm-view does appear, regardless of whether a bib file is specified or not, but my personal references do not appear if no file is specified - only the org-ref options to search via other tools.


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/jkitchin/org-ref/issues/165#issuecomment-200911671

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

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jkitchin/org-ref/issues/165#issuecomment-200934486

thecsw commented 6 years ago

Thanks!