Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Need more LaTeX help. (BibTeX related)

Options
  • 09-11-2009 12:26pm
    #1
    Closed Accounts Posts: 6,609 ✭✭✭


    Hello, I can't get bibtex to do what it is supposed to do. I have been using the Wikibooks guide to LaTeX and literally following it word-for-word and I get errors that don't appear for the author. I will give a very simple example:
    \documentclass[11pt,a4paper,oneside]{report}
     
    \begin{document}
    This is a latex test document\cite{flamed09}.
    \pagebreak
    @book{flamed09,
        author    = "Flamed Diving",
        title     = "The LaTeX Companion",
        year      = "1993",
        publisher = "Addison-Wesley",
        address   = "Reading, Massachusetts"
    }
    \bibliographystyle{plain}
    \bibliography{flamed09}
    \end{document}
    

    Ok, so I understand that I need to run Latex, then Bibtex, then Latex twice according to:

    http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Why_won.27t_LaTeX_generate_any_output.3F

    However, as I run Bibtex, I always get a message saying that there is no database for flamed09.

    So, where am I going wrong with this example above?


Comments

  • Closed Accounts Posts: 8,983 ✭✭✭leninbenjamin


    you're trying to use an external file there yet you've the bibtex in the document.

    this line:
    \bibliography{flamed09}

    is looking for a file called flamed09.bib that also contains a reference called flamed09.

    Put the references in a new file, and link to it like above. Only the citations should be in the document file itself.

    Oh and you have to run Bibtex on the bib file itself before it can be used for citations.


  • Moderators, Computer Games Moderators, Technology & Internet Moderators, Help & Feedback Category Moderators Posts: 25,083 CMod ✭✭✭✭Spear


    As a general comment we have a LaTeX subforum now.

    http://boards.ie/vbulletin/forumdisplay.php?f=1286


  • Closed Accounts Posts: 8,983 ✭✭✭leninbenjamin


    Spear wrote: »
    As a general comment we have a LaTeX subforum now.

    http://boards.ie/vbulletin/forumdisplay.php?f=1286

    oooh, it got approved? nice.


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    you're trying to use an external file there yet you've the bibtex in the document.

    this line:
    \bibliography{flamed09}

    is looking for a file called flamed09.bib that also contains a reference called flamed09.

    Put the references in a new file, and link to it like above. Only the citations should be in the document file itself.

    Oh and you have to run Bibtex on the bib file itself before it can be used for citations.

    Sorry, I'm not sure I quite follow. Where do I put these \bibilography commands, if not in the document itself? Just open a new file and put this in?
    @book{flamed09,
        author    = "Flamed Diving",
        title     = "The LaTeX Companion",
        year      = "1993",
        publisher = "Addison-Wesley",
        address   = "Reading, Massachusetts"
    }
    \bibliographystyle{plain}
    \bibliography{flamed09}
    

    Would this now be my flamed09.bib?






    *p.s. to mods, please move this to the new forum.


  • Closed Accounts Posts: 8,983 ✭✭✭leninbenjamin


    Sorry, I'm not sure I quite follow. Where do I put these \bibilography commands, if not in the document itself? Just open a new file and put this in?
    @book{flamed09,
        author    = "Flamed Diving",
        title     = "The LaTeX Companion",
        year      = "1993",
        publisher = "Addison-Wesley",
        address   = "Reading, Massachusetts"
    }
    \bibliographystyle{plain}
    \bibliography{flamed09}
    

    Would this now be my flamed09.bib?






    *p.s. to mods, please move this to the new forum.

    Sorry, i should have been clearer:

    the references
    @book{flamed09,
        author    = "Flamed Diving",
        title     = "The LaTeX Companion",
        year      = "1993",
        publisher = "Addison-Wesley",
        address   = "Reading, Massachusetts"
    }
    
    becomes the .bib file.

    these commands
    \bibliographystyle{plain}
    \bibliography{flamed09}
    
    remain in the document.

    the \bibliography command is actually linking directly to flamed09.bib and telling the document to use this file for compiling the citations.

    You have to run the BibTeX compiler on the .bib file before you compile the document.


  • Advertisement
  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    Ok, I think I follow. Unfortunately I don't have LaTeX in front of me, so I will give it a go at home.

    :)


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    Ok, I got that to work, thanks for the help.

    However, is it possible to use references from one bib file, say flamed09.bib on another tex file?

    What I mean is, if one was writing a Phd, but had a few spin-off papers from it, could all papers draw references from the one bib file? Does that bib file need to be in the same folder?


  • Registered Users Posts: 8,452 ✭✭✭Time Magazine


    Ok, I got that to work, thanks for the help.

    However, is it possible to use references from one bib file, say flamed09.bib on another tex file?

    What I mean is, if one was writing a Phd, but had a few spin-off papers from it, could all papers draw references from the one bib file? Does that bib file need to be in the same folder?

    Yes. You're doing an MA, right? Then start a references.bib file now and put everything in there. Then you'd have something like:
    \bibliographystyle{plain}
    \bibliography{references}
    

    Also it's a good idea to install natbib. You can do that by including
    \usepackage{natbib}
    
    between the \documentclass command and \begin{document}.

    Natbib, among other things, allows for better citation and nicer styles than the very ugly plain. By changing to \bibliographystyle{aer} for example, and copying and pasting the relevant aer.bst file into your LaTeX folder (and then refreshing the LaTeX database, but that might happen automatically), the citations and bibliography will come out in the pretty American Economic Review style.


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    Useful info, thanks!

    p.s. Yeah, I'm doing an MA. I'm already gathering references for my thesis, so I thought it best to start compiling them on bibtex now.


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    Ok, I have run into another issue here. I can get bibtex to work perfectly, so long at the bib file has the same name as the tex file. Does this have to be the case? Does the file in which I will be writing my thesis have to be called references.tex?

    For example, when I run latex on something like this:
    \documentclass[11pt,a4paper,oneside]{report}
     
    \begin{document}
    This is a latex test document\cite{flamed09}.
    \pagebreak
    \bibliographystyle{plain}
    \bibliography{references}
    \end{document}
    

    and then run my saved 'references.bib' file using bibtex:
    @book{flamed09,
        author    = "Flamed Diving",
        title     = "The LaTeX Companion",
        year      = "1993",
        publisher = "Addison-Wesley",
        address   = "Reading, Massachusetts"
    }
    

    I get:
    I couldn't open the file name 'C:\users\...\references.aux'
    

    So, what am I missing?


  • Advertisement
  • Closed Accounts Posts: 8,983 ✭✭✭leninbenjamin


    Ok, I have run into another issue here. I can get bibtex to work perfectly, so long at the bib file has the same name as the tex file. Does this have to be the case? Does the file in which I will be writing my thesis have to be called references.tex?

    I'm almost certain there's a way around this, but I never figured it out, sorry. For my thesis I just had a thesis.tex and a thesis.bib.
    Yes. You're doing an MA, right? Then start a references.bib file now and put everything in there. Then you'd have something like:
    \bibliographystyle{plain}
    \bibliography{references}
    

    Also it's a good idea to install natbib. You can do that by including
    \usepackage{natbib}
    
    between the \documentclass command and \begin{document}.

    Natbib, among other things, allows for better citation and nicer styles than the very ugly plain. By changing to \bibliographystyle{aer} for example, and copying and pasting the relevant aer.bst file into your LaTeX folder (and then refreshing the LaTeX database, but that might happen automatically), the citations and bibliography will come out in the pretty American Economic Review style.

    How dare you sir! There is good reason plain is the default, it's the most manageable reference system in place (to the end user i mean). I've always despised institutions like the APA, or AER for demanding such stupid extensions to such a beautifully simple system. Don't needlessly complicate it!


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    Ok, I got it to work in a rather convoluted way. Simply create a dummy file called references.tex and do all the bibtex stuff, as usual. Then save all of it, and go to the containing folder. Delete all of the files called reference except bib, aux and bbl (not sure about last one).

    Anyway, you have your references bibtex database created, and you can now link other tex files to it.


  • Registered Users Posts: 687 ✭✭✭lostinsuperfunk


    jabref is a useful tool to manage bibtex databases. It has a graphical interface which prevents you from making formatting errors in the .bib file.
    It can also import references from online databases (e.g. ScienceDirect and Web of Knowledge) and exchange references with other software such as EndNote.

    There should be no problem using document files and bibliography files with different names e.g. thesis.tex and myreferences.bib.

    To compile the document you would type
    latex thesis
    bibtex thesis (not bibtex myreferences!)
    latex thesis

    thesis.tex should contain the line
    \bibliography{myreferences}

    As long as everything is in the same folder it should work.


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    latex thesis
    bibtex thesis (not bibtex myreferences!)
    latex thesis

    Where do you type this?


  • Registered Users Posts: 8,452 ✭✭✭Time Magazine


    Into the command prompt. Start > Run > cmd, if you're on XP or later. You'll need to move to the correct directory (using the cd command) before you compile the documents.

    ProTeXt and the like have buttons for shortcuts, but the above is essentially what it's doing.


  • Closed Accounts Posts: 6,609 ✭✭✭Flamed Diving


    Cool.


Advertisement