Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am collaborating with another author using email to exchange latest version of the document. Is it possible to include the bibliography in the LaTeX file, so that we don't have to keep two files in synch? (however I would still like it to be in BibTeX format, I know you can have manual \bibitems in LaTeX files)

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

You can include it using the filecontents environment:

\begin{filecontents}{example.bib}
% File contents here
\end{filecontents}
\documentclass{article}
...

This will extract the file only if it does not already exist locally. (You'll see this approach used a lot for examples on sites such as this one. It's handy for small snippets but is more awkward when things get very long.)

share|improve this answer
3  
@Joseph: it makes more sense to load the package filecontents first and then writing the file. Then one can also edit the exported file and it will be updated, otherwise not. –  Herbert Feb 3 '11 at 21:27
    
@Herbert. I only ever use filecontents for a 'one-shot' unpack, so I will take your word for this. –  Joseph Wright Feb 3 '11 at 21:30
1  
@Joseph: and you never had typos in your "one shots" ;-) you are a lucky man –  Herbert Feb 3 '11 at 21:31
    
@Herbert. No, but I just delete the file (eventually, when I remember). I use filecontents for examples, so am usually attempting to keep additional packages down to a minimum. –  Joseph Wright Feb 3 '11 at 21:32
    
@Joseph, is it possible to add this content at the end of the file (an not at the beginning)? That's where bibliography usually goes anyway... –  Grzenio Feb 4 '11 at 11:35
show 1 more comment

You should use a revision control system for multiple author documents. There are a lot of programs like subversion or git or ... That makes the email exchange superflous and you get a backup system, too.

share|improve this answer
    
You are assuming that the co-authors are comfortable with this. That's fine if they are programmers, but if they are not then LaTeX alone may well be 'quite enough computer stuff'. –  Joseph Wright Feb 3 '11 at 21:26
    
No, I didn't assume that. I said, that it is really comfortable for multiple authors. –  Herbert Feb 3 '11 at 21:29
    
Again, I'll take your word for it: my co-authors get annoyed at me if I mention using anything other than Word (and I mean Word only: OpenOffice is already considered dangerous.) –  Joseph Wright Feb 3 '11 at 21:35
    
Most VCSes have some GUIs nowadays (or so I'm told), so it really shouldn't be that difficult if they are already comfortable with handling TeX. Otherwise, on can always at least use this technique to keep files in sync at one side. –  Caramdir Feb 3 '11 at 21:51
    
I was thinking about this (I am using mercurial just for myself), but it seems a bit too complicated to set up just to write 20 page long paper with this person. I agree its the best solution if we decide to work together on more projects. –  Grzenio Feb 4 '11 at 11:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.