LaTeX-Old-Version/C2/Inside-story-of-Bibliography/English

From Script | Spoken-Tutorial
Revision as of 14:37, 29 November 2012 by Pravin1389 (Talk | contribs)

Jump to: navigation, search

Welcome to a tutorial on creating bibliography entries. I will be using BibTeX for this purpose. Bibtex is a stand-alone utility separate from LaTeX. In this tutorial we will see, how to produce a pdf file that you see now. The first page shows the title. Let us go to the second page, where we have the text. The references are numbered from one through six, and in the next page, up to eleven. Note that these references are also listed alphabetically. You can see it here. Let us next see the source file that we used for this purpose. Let us go through this. It is clear that it does not have the references as we can see from browsing through. We don’t have this information present in the source file.

So where are the references? They are in the file ‘ref’. Actually the filename is ‘ref.bib’. That is the default for this command – bibliography. There you are, ‘ref.bib’. let us see what is contained in ref.bib. It has reference information under different categories, for example, it has book, tech-report, in proceedings, miscellaneous, as well as article. We will come back to this file shortly and explain it. Let us now concentrate on the procedure to create the reference list in the output. Let us put the references.tex back, the source file, let’s go to the top of this page. Let us first get a listing of the files whose prefixes – references. There you are. Let us first delete all files except references.tex. Let us confirm this, so we have only references.tex. Now let me compile this. On compilation, we get the warning message that there are some undefined references, some citations are missing. We see that there are new files that the pdf.tex command has created as we can see now. There are some new files in addition to the references.pdf, we have a file called references.log, as well as references.aux. Let us first see the files references.log. It has a lot of information, as a matter of fact, it has all the messages that appear over here. Let’s just go down and see. There is a lot of information, as well as these warnings which appear here as well. There is of course a warning that some fonts are missing often we can live with this short-comings. The warning that some references are missing, some citations are missing, are however important to us. We will now proceed to address these warnings.

Let us now open the other file, namely, references.aux. It has several citations command. Where do these come from? All the arguments of the citation appeared in the ‘cite command’ in the source file. As we can see now. Let me open it here. Let’s go down, there is a scroll for it, source file. See for example, I have this ‘cite vk 79’, that vk79 comes here. ‘cite tk 80’, it comes here and so on. Also this bibstyle-plain, also comes in the source file here, you go up, bibliography style – plain, that plain appears here. The aux file also stores variable names, suppose for example I include a label for this section. Let me go here. Okay, let me do this without a label, so for example, let’s delete this, let me compile this. Let me re-open this file and note that we no longer have this. So the moment I put a label here, ‘label – sec arya’. Save this, compile this, open this. Then you come to this file, to re-open this file. And note that, we have this command, new label sec arya, this label is the same label that we had here and this one says that it is section 1, as it appears here, and this 2 refers to the page number – this document’s page is 2.

During the next compilation. Latex reads the aux file and loads the label information. This is why we need two compilations to get the labels correct. Let me explain how the references list is created, now is the time to use BibTeX. We give the command BibTeX references here. Let’s give the command – BibTeX references. This takes the input from references.aux as mentioned here, says that, here for example it says references.aux is used. It says that it uses a style file called plain.bst. as given by this plain command and the date of ref.bib, this we already explained, ref.bib, database file number 1 is ref.bib. Recall that we used plain style and ref bib in the source file. Let us see what files are now created, okay, that is what new files are created because of this command BibTeX.references. Let’s list this. You find that, in addition to the files we saw previously, we have two new files, references.blg and references.bbl. the file references.blg, has formatting information, let’s see this, you can see that it has some formatting information. Let me quit this. And let me see what this file bbl has. References . bbl, So it has this information, the references that we saw earlier. Referecences.bbl has the cited references in the same order as we finally want in the pdf file. Normally, one would not have to change these files manually or even view them however.

In this last compilation, we also got a warning, references.bbl is not found. As we can see in the references.log file. Let’s open this file here. Okay, let’s look for – so for example it says, no file references.bbl. So this is what happened in the previous compilation. But now, using BibTeX we have now created the file references.bbl. So let us compile once again. Now the warnings are different, it says that ‘label’s may have changed’. As a matter of fact, the moment we compile this file references.bbl is read, and those references are loaded here. And this order is the same order, that we saw in references.bbl. For example, you can see that now. See the example, the first reference is Chang and Pearson, here also Chang and Pearson. Alright. But of course this information is not correct yet, we are not citing them properly. So let us compile – so this is something we have stated before, you compile it once more, it will become alright. How do we explain this, let’s go and see the file references. aux and note that in addition to the citation messages we had before we have extra references – it says bibcite cp82 and so on. This says that the bibliography item with the label cp82 is reference 1. So we can see this for example, we can just open this, let’s open the source file again – let me search for cp82. There you are, this is cp82. And the corresponding reference is here and this appears in this citation.

Now that this information, namely that this reference cp82, appears as item number 1 in the reference list is available in the file references.aux. So if I re-compile it, now this information comes automatically here. Now we can also see that the warnings are all gone. What LaTeX has done is to take the reference number information from references.aux and assign to the labels of the cite command in the source file namely these from here. We will now see the file that contains the references namely, ref.bib. let’s come here, ref.bib, let’s go to the top of this page. In Emacs editor, it is possible to use the entry types to choose a reference that we want to add. For example, say for example there is something called entry types. So in Emacs editor, it is possible to create this and the moment you invoke this ‘article in journal’ type I get an empty record which I can fill up. If your editor does not have this capability, no sweat! You can manually create these entries. For the time being let me undo this, I don’t want this. It is possible to define strings and use them as variables in the file ref.bib. For example, the string JWC, denotes John Wiley and Songs Limited, Chichester - which has been used in some references. For example in this reference. Each reference has a key word, that appears at the very beginning of the record. For example, I have this reference, this record has KMM07 and that appears here as well. As a matter of fact, I have referred to this record through this key word.

Now I will explain, how using BibTeX it is possible to accommodate different types of referencing. Before we make changes, let us recall that the references here are all in alphabetical order. For example, B. C. Chang and Pearson, number 1, it appears here. The first reference that is mentioned is 3, then 2, then 11, and so on, that is because, the referencing here is alphabetical. Let us change the bibliography style to, let me make this, let me make the bibliography style to u-n-s-r-t. Which provides unsorted reference list as used in IEEE journals. On compiling once, references.aux gets updated with the style information. Now it will have u-n-s-r-t. On executing BibTeX, with a command BibTeX.references, the reference list is created in the references.bbl. note that it would have created references.bbl. But this will be as per the new style which is u-n-s-r-t. Now we compile references.tex. Note that the ordering has changed now. The references are not in alphabetical order, but here is a complaint, that labels may have changed, re-run to get cross references right, let us re-run this, that warning message is gone and note that now the referencing here is as per the sequence in which they are referred to in the source. For example, reference 1, is the one that is referred first, reference 2 is referred the second time, 2nd, 3rd, 4th, 5th and so on.

We will now create references as required by computer science journals. So let us come here, and call this ‘alpha’, let me compile this once, let me do a BibTeX; let me compile it once more. So this has changed but the referencing here has not changed. There is a complaint saying that labels have changed. If I compile once more, this is exactly the same. For example, you have B C Chang and Pearson so that has CP82, which is here. So now the referencing of these entries are also here. There is a large number of other referencing styles on the web.

I will now show a style that is used by ifac and chemical engineering journals. First, add Harvard to use-packages command, as I show now. Also change the style to ifac. These are implemented through two files, namely Harvard,sty and ifac.bst. These files are on the web and one can download them. On compiling this now, pdf-LaTeX-references, executing BibTeX, compiling it twice. We get the reference list as shown here, where the references are arranged alphabetically without serial numbers. Serial numbers have disappeared. Referencing is by explicit addressing of author names, for example, here it says, Vidyasagar 1985, and year. We can see the references on the next page also, there you are, it is alphabetical. When this referencing style is used, the cite command puts the entire reference within the brackets. For example, look at the source file. Here you are, let’s come here, the text book by cite KMM07 produces ‘the textbook by (Moudgalya, 2007b)’. Here the name Moudgalya should not come within the brackets, only the year should come in the brackets. This is taken care of by the command cite-as-noun. Let me save this. Compile this. There you are. Now the name Moudgalya has come outside the brackets, only the years has come within the brackets. This cite-as-noun fixes this problem. It is important to note that cite-as-noun is a command that is specific to the referencing style that we used now. It may not work with other referencing styles.

As mentioned earlier, there is a large number of referencing styles. One only needs to download the appropriate sty and bst files. In this example I used, Harvard.sty and ifac.bst files. If you think carefully, you will realize that in all of the above, we have not changed the database of the references, namely ref.bib, at all. That is the beauty of BibTeX. Although we have spent a lot of time explaining the procedure to create the references list, the actual procedure to be followed by the end user is extremely simple. One, create the database, namely the .bib file. Get the .sty and .bst files. Many of them may already be available on your installation. Compile source file once, execute pdf LaTeX, compile the source file twice more. Wouldn’t you agree that this is an extremely simple procedure. Wont this make you say, Long live Bibtex and Latex! This brings us to the end of this tutorial. Thanks for listening. This is Kannan Moudgalya signing off. Good-bye.

Contributors and Content Editors

Chandrika, Nancyvarkey, Pravin1389