emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to get BibTeX to work with Org mode LaTeX export?
@ 2013-05-18  7:09 Omid
  2013-05-18  8:28 ` Yury Bulka
  2013-05-18 16:33 ` Thomas S. Dye
  0 siblings, 2 replies; 8+ messages in thread
From: Omid @ 2013-05-18  7:09 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2884 bytes --]

I have posted a question to tex.stackexchange.com on "How to get BibTeX to
work with Org mode LaTeX export?" Here is a link to it:
http://tex.stackexchange.com/questions/114864/how-to-get-bibtex-to-work-with-org-mode-latex-export.
I thought this mailing list might be the best place to ask for help about
it. Thanks in advance for your time.

For ease of reference, here is the question again:

I am trying to get Emacs (24.3.1), Org-mode (8.0.3, from ELPA) and BibTeX
(from TeX Live 2012) to work together. I have followed the instructions
under the Bibliography section in
http://orgmode.org/worg/org-tutorials/org-latex-export.html but after
exporting the document to LaTeX, compiling to PDF, and opening the result
(with key sequence C-c C-e l o in the latest Org mode) I see a question
mark instead of a citation (i.e., [?]) which means that the reference was
not resolved by LaTeX. In fact, checking the Org PDF LaTeX Output buffer, I
see the following warning:

LaTeX Warning: Citation `Tappert77' on page 3 undefined on input line 43.

No file org-bib-test.bbl.
[3] (.//org-bib-test.aux)

LaTeX Warning: There were undefined references.

It looked to me that probably Org-mode was looking for a .bib file with the
same base name as the .org file but renaming the .bib file and updating the
\bibliography line did not solve the problem.

Here are two minimal .org and .bib files that together can be used to
reproduce the behavior described above:

org-bib-test.org

* Tests
** Test1 slide
   - This is test1 \cite{Tappert77}.

\bibliographystyle{plain}
\bibliography{org-bib-test-refs}

The following, using #+LATEX_HEADER, gives the same result:

org-bib-test.org

#+LATEX_HEADER: \bibliographystyle{plain}
#+LATEX_HEADER: \bibliography{org-bib-test-refs}

* Tests
** Test1 slide
   - This is test1 \cite{Tappert77}.

org-bib-test-refs.bib

@incollection {Tappert77,
AUTHOR = {Tappert, Fred D.},
TITLE = {The parabolic approximation method},
BOOKTITLE = {Wave propagation and underwater acoustics ({W}orkshop,
              {M}ystic, {C}onn., 1974)},
PAGES = {224--287. Lecture Notes in Phys., Vol. 70},
PUBLISHER = {Springer},
ADDRESS = {Berlin},
YEAR = {1977},
MRCLASS = {76.41 (86.41)},
}

Currently I am using the following ugly hack to get the references
resolved: I generate the .bbl file from the .bib file (using a minimal .tex
file) and then I \include the resulting .bbl file directly in my .org file.
This is rather cumbersome and of course requires that I regenerate the .bbl
file every time I make a change to the .bib file. Although this process can
be automated in Emacs by writing a lisp function to encapsulate these
actions, I'd rather solve the problem than streamline a hack.

I have checked the .tex file generated by Org mode. It does have the
following necessary lines exported in it:

\bibliographystyle{plain}
\bibliography{org-bib-test-refs}

-Omid

[-- Attachment #2: Type: text/html, Size: 3472 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  7:09 How to get BibTeX to work with Org mode LaTeX export? Omid
@ 2013-05-18  8:28 ` Yury Bulka
  2013-05-18  8:40   ` Omid
  2013-05-18 14:17   ` Nick Dokos
  2013-05-18 16:33 ` Thomas S. Dye
  1 sibling, 2 replies; 8+ messages in thread
From: Yury Bulka @ 2013-05-18  8:28 UTC (permalink / raw)
  To: Omid; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3607 bytes --]

I believe you should put the \bibliographystyle and \bibliography commands
at the end of the document before \end{document}.

Next, to compile the file, you should first run pdflatex YOURFILE.tex, then
run bibtex YOURFILE (without extension or with .aux), and then again
pdflatex, possibly twice.

This can be done by first exporting to LaTeX and then compiling manually.

I think you can also adjust the variable `org-latex-to-pdf-process' in
order to include a bibtex command (not tested yet) in the org pdf export
procedure.

Good luck!


2013/5/18 Omid <omidlink@gmail.com>

> I have posted a question to tex.stackexchange.com on "How to get BibTeX
> to work with Org mode LaTeX export?" Here is a link to it:
> http://tex.stackexchange.com/questions/114864/how-to-get-bibtex-to-work-with-org-mode-latex-export.
> I thought this mailing list might be the best place to ask for help about
> it. Thanks in advance for your time.
>
> For ease of reference, here is the question again:
>
> I am trying to get Emacs (24.3.1), Org-mode (8.0.3, from ELPA) and BibTeX
> (from TeX Live 2012) to work together. I have followed the instructions
> under the Bibliography section in
> http://orgmode.org/worg/org-tutorials/org-latex-export.html but after
> exporting the document to LaTeX, compiling to PDF, and opening the result
> (with key sequence C-c C-e l o in the latest Org mode) I see a question
> mark instead of a citation (i.e., [?]) which means that the reference was
> not resolved by LaTeX. In fact, checking the Org PDF LaTeX Output buffer, I
> see the following warning:
>
> LaTeX Warning: Citation `Tappert77' on page 3 undefined on input line 43.
>
> No file org-bib-test.bbl.
> [3] (.//org-bib-test.aux)
>
> LaTeX Warning: There were undefined references.
>
> It looked to me that probably Org-mode was looking for a .bib file with
> the same base name as the .org file but renaming the .bib file and updating
> the \bibliography line did not solve the problem.
>
> Here are two minimal .org and .bib files that together can be used to
> reproduce the behavior described above:
>
> org-bib-test.org
>
> * Tests
> ** Test1 slide
>    - This is test1 \cite{Tappert77}.
>
> \bibliographystyle{plain}
> \bibliography{org-bib-test-refs}
>
> The following, using #+LATEX_HEADER, gives the same result:
>
> org-bib-test.org
>
> #+LATEX_HEADER: \bibliographystyle{plain}
> #+LATEX_HEADER: \bibliography{org-bib-test-refs}
>
> * Tests
> ** Test1 slide
>    - This is test1 \cite{Tappert77}.
>
> org-bib-test-refs.bib
>
> @incollection {Tappert77,
> AUTHOR = {Tappert, Fred D.},
> TITLE = {The parabolic approximation method},
> BOOKTITLE = {Wave propagation and underwater acoustics ({W}orkshop,
>               {M}ystic, {C}onn., 1974)},
> PAGES = {224--287. Lecture Notes in Phys., Vol. 70},
> PUBLISHER = {Springer},
> ADDRESS = {Berlin},
> YEAR = {1977},
> MRCLASS = {76.41 (86.41)},
> }
>
> Currently I am using the following ugly hack to get the references
> resolved: I generate the .bbl file from the .bib file (using a minimal .tex
> file) and then I \include the resulting .bbl file directly in my .org file.
> This is rather cumbersome and of course requires that I regenerate the .bbl
> file every time I make a change to the .bib file. Although this process can
> be automated in Emacs by writing a lisp function to encapsulate these
> actions, I'd rather solve the problem than streamline a hack.
>
> I have checked the .tex file generated by Org mode. It does have the
> following necessary lines exported in it:
>
> \bibliographystyle{plain}
> \bibliography{org-bib-test-refs}
>
> -Omid
>

[-- Attachment #2: Type: text/html, Size: 4590 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  8:28 ` Yury Bulka
@ 2013-05-18  8:40   ` Omid
  2013-05-18  9:36     ` Jay Kerns
  2013-05-18 14:17   ` Nick Dokos
  1 sibling, 1 reply; 8+ messages in thread
From: Omid @ 2013-05-18  8:40 UTC (permalink / raw)
  To: Yury Bulka; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 4027 bytes --]

- The \bibliographystyle and \bibliography commands are at the end of the
document.
- The question is about how to get Org mode to do the whole job, as there
is a command for it which is supposed to do exactly that but it doesn't.


On Sat, May 18, 2013 at 4:28 AM, Yury Bulka <yurkobb@gmail.com> wrote:

> I believe you should put the \bibliographystyle and \bibliography commands
> at the end of the document before \end{document}.
>
> Next, to compile the file, you should first run pdflatex YOURFILE.tex,
> then run bibtex YOURFILE (without extension or with .aux), and then again
> pdflatex, possibly twice.
>
> This can be done by first exporting to LaTeX and then compiling manually.
>
> I think you can also adjust the variable `org-latex-to-pdf-process' in
> order to include a bibtex command (not tested yet) in the org pdf export
> procedure.
>
> Good luck!
>
>
> 2013/5/18 Omid <omidlink@gmail.com>
>
>> I have posted a question to tex.stackexchange.com on "How to get BibTeX
>> to work with Org mode LaTeX export?" Here is a link to it:
>> http://tex.stackexchange.com/questions/114864/how-to-get-bibtex-to-work-with-org-mode-latex-export.
>> I thought this mailing list might be the best place to ask for help about
>> it. Thanks in advance for your time.
>>
>> For ease of reference, here is the question again:
>>
>> I am trying to get Emacs (24.3.1), Org-mode (8.0.3, from ELPA) and BibTeX
>> (from TeX Live 2012) to work together. I have followed the instructions
>> under the Bibliography section in
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html but after
>> exporting the document to LaTeX, compiling to PDF, and opening the result
>> (with key sequence C-c C-e l o in the latest Org mode) I see a question
>> mark instead of a citation (i.e., [?]) which means that the reference was
>> not resolved by LaTeX. In fact, checking the Org PDF LaTeX Output buffer, I
>> see the following warning:
>>
>> LaTeX Warning: Citation `Tappert77' on page 3 undefined on input line 43.
>>
>> No file org-bib-test.bbl.
>> [3] (.//org-bib-test.aux)
>>
>> LaTeX Warning: There were undefined references.
>>
>> It looked to me that probably Org-mode was looking for a .bib file with
>> the same base name as the .org file but renaming the .bib file and updating
>> the \bibliography line did not solve the problem.
>>
>> Here are two minimal .org and .bib files that together can be used to
>> reproduce the behavior described above:
>>
>> org-bib-test.org
>>
>> * Tests
>> ** Test1 slide
>>    - This is test1 \cite{Tappert77}.
>>
>> \bibliographystyle{plain}
>> \bibliography{org-bib-test-refs}
>>
>> The following, using #+LATEX_HEADER, gives the same result:
>>
>> org-bib-test.org
>>
>> #+LATEX_HEADER: \bibliographystyle{plain}
>> #+LATEX_HEADER: \bibliography{org-bib-test-refs}
>>
>> * Tests
>> ** Test1 slide
>>    - This is test1 \cite{Tappert77}.
>>
>> org-bib-test-refs.bib
>>
>> @incollection {Tappert77,
>> AUTHOR = {Tappert, Fred D.},
>> TITLE = {The parabolic approximation method},
>> BOOKTITLE = {Wave propagation and underwater acoustics ({W}orkshop,
>>               {M}ystic, {C}onn., 1974)},
>> PAGES = {224--287. Lecture Notes in Phys., Vol. 70},
>> PUBLISHER = {Springer},
>> ADDRESS = {Berlin},
>> YEAR = {1977},
>> MRCLASS = {76.41 (86.41)},
>> }
>>
>> Currently I am using the following ugly hack to get the references
>> resolved: I generate the .bbl file from the .bib file (using a minimal .tex
>> file) and then I \include the resulting .bbl file directly in my .org file.
>> This is rather cumbersome and of course requires that I regenerate the .bbl
>> file every time I make a change to the .bib file. Although this process can
>> be automated in Emacs by writing a lisp function to encapsulate these
>> actions, I'd rather solve the problem than streamline a hack.
>>
>> I have checked the .tex file generated by Org mode. It does have the
>> following necessary lines exported in it:
>>
>> \bibliographystyle{plain}
>> \bibliography{org-bib-test-refs}
>>
>> -Omid
>>
>
>

[-- Attachment #2: Type: text/html, Size: 5276 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  8:40   ` Omid
@ 2013-05-18  9:36     ` Jay Kerns
  2013-05-18 14:37       ` Nick Dokos
  2013-05-18 21:36       ` Omid
  0 siblings, 2 replies; 8+ messages in thread
From: Jay Kerns @ 2013-05-18  9:36 UTC (permalink / raw)
  To: Omid; +Cc: Yury Bulka, emacs-orgmode

Hi Omid,

On Sat, May 18, 2013 at 4:40 AM, Omid <omidlink@gmail.com> wrote:
> - The \bibliographystyle and \bibliography commands are at the end of the
> document.
> - The question is about how to get Org mode to do the whole job, as there is
> a command for it which is supposed to do exactly that but it doesn't.
>

Have you tried (something like) the following in your init file?

(setq org-latex-pdf-process (quote ("texi2dvi --pdf --clean --verbose
--batch %f" "bibtex %b" "texi2dvi --pdf --clean --verbose --batch %f"
"texi2dvi --pdf --clean --verbose --batch %f")))

You can read more about this variable (and customize it) with

C-h v org-latex-pdf-process RET

I hope this helps,

-- 
Jay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  8:28 ` Yury Bulka
  2013-05-18  8:40   ` Omid
@ 2013-05-18 14:17   ` Nick Dokos
  1 sibling, 0 replies; 8+ messages in thread
From: Nick Dokos @ 2013-05-18 14:17 UTC (permalink / raw)
  To: emacs-orgmode

Yury Bulka <yurkobb@gmail.com> writes:

>
> I think you can also adjust the variable `org-latex-to-pdf-process' in
> order to include a bibtex command (not tested yet) in the org pdf
> export procedure.
>

N.B: the variable has been renamed in org-mode 8 - it is now called
org-latex-pdf-process.

-- 
Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  9:36     ` Jay Kerns
@ 2013-05-18 14:37       ` Nick Dokos
  2013-05-18 21:36       ` Omid
  1 sibling, 0 replies; 8+ messages in thread
From: Nick Dokos @ 2013-05-18 14:37 UTC (permalink / raw)
  To: emacs-orgmode

Jay Kerns <gjkernsysu@gmail.com> writes:

>> - The question is about how to get Org mode to do the whole job, as there is
>> a command for it which is supposed to do exactly that but it doesn't.
>>
>
> Have you tried (something like) the following in your init file?
>
> (setq org-latex-pdf-process (quote ("texi2dvi --pdf --clean --verbose
> --batch %f" "bibtex %b" "texi2dvi --pdf --clean --verbose --batch %f"
> "texi2dvi --pdf --clean --verbose --batch %f")))
>
> You can read more about this variable (and customize it) with
>
> C-h v org-latex-pdf-process RET
>
> I hope this helps,

If texi2dvi works, then there is no need for a three-element list: just
the first invocation of texi2dvi should be enough to do the job.

If texi2dvi does *not* work, then a three-element list is necessary (but
not necessarily sufficient): an invocation of pdflatex, followed by
bibtex, followed by (at least) another invocation of pdflatex (followed
by more invocations of pdflatex if there are still complaints).

-- 
Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  7:09 How to get BibTeX to work with Org mode LaTeX export? Omid
  2013-05-18  8:28 ` Yury Bulka
@ 2013-05-18 16:33 ` Thomas S. Dye
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas S. Dye @ 2013-05-18 16:33 UTC (permalink / raw)
  To: Omid; +Cc: emacs-orgmode

Omid <omidlink@gmail.com> writes:

>
> I am trying to get Emacs (24.3.1), Org-mode (8.0.3, from ELPA) and BibTeX
> (from TeX Live 2012) to work together. I have followed the instructions
> under the Bibliography section in
> http://orgmode.org/worg/org-tutorials/org-latex-export.html but after

I've changed the title of this document to indicate that it was written
for the old exporter, Org Mode < 8.0.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to get BibTeX to work with Org mode LaTeX export?
  2013-05-18  9:36     ` Jay Kerns
  2013-05-18 14:37       ` Nick Dokos
@ 2013-05-18 21:36       ` Omid
  1 sibling, 0 replies; 8+ messages in thread
From: Omid @ 2013-05-18 21:36 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Jay Kerns

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

Hi Jay,

Thanks for your suggestion, and thank you to all for your help. With a
minor modification (changing "--clean" to "--build=local", since otherwise
texi2dvi does not see my other included files unless I use "-I") it does
solve the problem, except for the efficiency, as Nick pointed out.
I think the only alternative would be to call a Makefile through a lisp
function in this variable.
For some reason, Org export to LaTeX (and full compilation) feels a little
sluggish to me; the export to LaTeX (.org => .tex) part must be quick and
the rest of compilation doesn't much have to do with Org. I could probably
use only one invocation of "texi2dvi --pdf --clean --verbose --batch %f"
and treat the PDF as a draft and then every once in while do a full
compilation.

Do you, or anyone else, have any comments or any other suggestions for
speeding things up?

--
Omid


On Sat, May 18, 2013 at 5:36 AM, Jay Kerns <gjkernsysu@gmail.com> wrote:

> Hi Omid,
>
> On Sat, May 18, 2013 at 4:40 AM, Omid <omidlink@gmail.com> wrote:
> > - The \bibliographystyle and \bibliography commands are at the end of the
> > document.
> > - The question is about how to get Org mode to do the whole job, as
> there is
> > a command for it which is supposed to do exactly that but it doesn't.
> >
>
> Have you tried (something like) the following in your init file?
>
> (setq org-latex-pdf-process (quote ("texi2dvi --pdf --clean --verbose
> --batch %f" "bibtex %b" "texi2dvi --pdf --clean --verbose --batch %f"
> "texi2dvi --pdf --clean --verbose --batch %f")))
>
> You can read more about this variable (and customize it) with
>
> C-h v org-latex-pdf-process RET
>
> I hope this helps,
>
> --
> Jay
>

[-- Attachment #2: Type: text/html, Size: 2334 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-18 21:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-18  7:09 How to get BibTeX to work with Org mode LaTeX export? Omid
2013-05-18  8:28 ` Yury Bulka
2013-05-18  8:40   ` Omid
2013-05-18  9:36     ` Jay Kerns
2013-05-18 14:37       ` Nick Dokos
2013-05-18 21:36       ` Omid
2013-05-18 14:17   ` Nick Dokos
2013-05-18 16:33 ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).