• Home   /
• Archive by category "1"

“Normal” use of BibTeX from LaTeX

To create a bibliography for your document, you need to perform a sequence of steps, some of which seem a bit odd. If you choose to use BibTeX, the sequence is:

First: you need a BibTeX bibliography file (a file) — see “creating a BibTeX file”.

Second: you must write your LaTeX document to include a declaration of the ‘style’ of bibliography, citations, and a reference to the bibliography file mentioned above. So we may have a LaTeX file containing:

\bibliographystyle{plain} ... Pooh is heroic~\cite{Milne:1926}. ... Alice struggles~\cite{Carroll:1865}. ... \bibliography{mybooks}
Note: we have bibliography style plain, above, which is nearly the simplest of the lot: a sample text, showing the sorts of style choices available, can be found on Ken Turner’s web site: http://www.cs.stir.ac.uk/ kjt/software/latex/showbst.html

Third: you must process the file.

latex myfile
As LaTeX processes the file, the command writes a note of the style to the file; each command writes a note of the citation to the file, and the command writes a note of which file is to be used, to the file.

Note that, at this stage, LaTeX isn’t “resolving” any of the citations: at every command, LaTeX will warn you of the undefined citation, and when the document finishes, there will be a further warning of undefined references.

Fourth: you must run BibTeX:

bibtex myfile
Don’t try to tell BibTeX anything but the file name: say (because you know it’s going to read the file) and BibTeX will blindly attempt to process .

BibTeX will scan the file; it will find which bibliography style it needs to use, and will “compile” that style; it will note the citations; it will find which bibliography files it needs, and will run through them matching citations to entries in the bibliography; and finally it will sort the entries that have been cited (if the bibliography style specifies that they should be sorted), and outputs the resulting details to a file.

Fifth: you run LaTeX again. It warns, again, that each citation is (still) undefined, but when it gets to the command, it finds a file, and reads it. As it encounters each command in the file, it notes a definition of the citation.

Sixth: you run LaTeX yet again. This time, it finds values for all the citations, in its file. Other things being equal, you’re done… until you change the file.

If, while editing, you change any of the citations, or add new ones, you need to go through the process above from steps 3 (first run of LaTeX) to 6, again, before the document is once again stable. These four mandatory runs of LaTeX make processing a document with a bibliography even more tiresome than the normal two runs required to resolve labels.

To summarise: processing to resolve citations requires: LaTeX; BibTeX; LaTeX; LaTeX.

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=usebibtex

Ubuntu Forums > The Ubuntu Forum Community > Other Discussion and Support > Education & Science > [SOLVED] Kile - completion for bibliography entries

PDA

View Full Version : [SOLVED] Kile - completion for bibliography entries

tekkenlord

December 6th, 2008, 12:48 AM

Hello all. Does anyone know if there is a way to configure Kile such that when I type "\cite{" it will popup a list of the authors I have in a bib file?

As an example, if my bib file has a single entry like:

@ARTICLE{tekkenlord:2008
author = {AUTHOR_NAME},
title = {TITLE},
journal = {JOURNAL_NAME},
}

then ideally I would like to type in Kile

"\cite{tek"

and get the completion of the word "tekkenlord:2008" which is the key entry for that article?

I have done an extensive google search and found that this feature supposedly is already implemented, but it does not work for me.

Another suggestion ( http://www.linuxquestions.org/questions/linux-desktop-74/kile-bibtex-507168/ ) was to include the bib file in the same directory of the tex file, this did not work either.

If any has this feature working, I would greatly appreciate his help! Thanks in advance.

tekkenlord

December 6th, 2008, 01:16 AM

Never mind, I found the solution. For those interested, these are the steps I followed:

1) Create a new Project
2) Copy or create a link to the bib file in the directory that the Project was created

That's it. Now, just type \cite{}, move te cursor between the curly brackets and press Ctrl-Space to get a full list of your key entries.

morgengenuss

February 9th, 2009, 03:19 PM

thanks a lot! that did the trick for me too!
(i switched to kile from a different editor, therefore didn't create a project-file in the first place)

Mander

February 23rd, 2009, 12:54 AM

This still isn't working for me and I don't know why. The .bib file and the project are in the same directory, and always have been. I recall it working before but I had to reinstall Ubuntu, and ever since I haven't been able to get this to work.

Are you two using Gnome or KDE? I wonder if that has anything to do with it.

tekkenlord

March 5th, 2009, 11:21 PM

Sorry for the late reply, I have not been checking the thread lately. I am using KDE 3.5.10. Strange that it doesn't work for you...

March 15th, 2009, 11:05 AM

This auto-complete feature is also not working for me. I am using KDE 4.2. I created a project, in which my bib-file is included, but the bibtex entries to not pop up as options.

tekkenlord

March 22nd, 2009, 03:03 PM

For those who have problems with the auto-completion feature:

You have to make sure of three things:

1) You have to create a new project

3) Include the package "natbib" (\usepackage{natbib}) and finally insert the command \bibliography{your_bib_filename}

Please try that and post back.

Mander

March 26th, 2009, 10:38 AM

Sorry, I haven't been paying much attention to this thread, either!

I've been using a project in Kile (using natbib and keeping the bibtex file in the same directory) for a long time, but just to see what would happen I created a new project (with the same files). Still no dice.

But I think I may have figured out the problem.

My academic supervisors complained when I gave them a draft with all of the bibliography attached, so I have been using the \nobibliography command so that the citations show up in the text where they are supposed to, but the list at the end isn't generated. I just tried changing this back to \bibliography and now it works.

Although I swear I tried that before and it didn't work, so it's possible that creating a new project also magically solved the problem.

Anyway, it works now!

SorryGoFish

March 30th, 2009, 03:12 PM

Another thing to note is in your Settings (Kile>Complete) you have to type the number of characters set in "Thereshold."

tigru

August 21st, 2009, 02:59 PM

Hi - I have an additional question concerning the same subject:

completion works fine for me, but I miss some commands as I use biblatex.

\textcite[text]{keylist},
\textcite{keylist},
\citep{keylist}

and a couple of others to latex-document.cwl.

The effect is that the commands are now shown as proposals for completion but no keylist appears. Is there another file where I have to create a link between command and the keylist?

Thanks in advance for any kind of help

tigru/juergen

tigru

August 21st, 2009, 10:59 PM

Wow... I found some hint on dante.org and downloaded the files biblatex-dev.cwl and biblatex.cwl. After restoring my latex-documents.cwl (which is now exactly as before my "operation"), I now really have some new commands working. But unexpectedly all biblatex-commands seem to work perfectly (including offering me a keylist of Literature keys) except for \textcite. Does anybody know this "bug" (or whatever it may be?)

tigru/Jürgen

cathalcummins

October 19th, 2009, 03:43 PM

I'm using Kile 2.0.1 to PDFlatex my documents. I use kbib to manage my references.

My references are contained in:

/home/cathal/Documents/College/LaTeX/BibTeX/References.bib

Here is an example of a typical .tex document

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[a4paper]{report}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{subfigure}
\usepackage{polynom}
\usepackage{graphics}
\usepackage{wrapfig}
\usepackage{amssymb}
\usepackage{amsmath}
\bibliographystyle{plain}

\begin{document}

Some things\cite{Szekeres2004} need to be referenced so the individuals get credit for their work.

\bibliography{/home/cathal/Documents/College/LaTeX/BibTeX/References.bib}
\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If I run my Quickbuild;

PDFLaTeX >> BibTeX >> PDFLaTeX >> PDFLaTeX

I get the "Finished with exit status 2" error. However, if I run the regular PDFLaTeX command (from the toolbar) the references come up and no errors.

I don't understand why BibTeX is even needed...

Also, I have tried the following;

2. Copy References.bib into the TeX folder.

3. Create a "Project" and "Add files" and choose "References.bib".

And still can't get the autocomplete to come up on citation. I know it's not a big deal, but I've spent a good few hours on this now and, frankly, I'm determined to get it working!

Any ideas, particularly on the autocomplete thing...?

All the best,

February 9th, 2010, 02:46 PM

I'm using Kile 2.0.83 on ubuntu, and also can't get autocomplete working for my \cite{xxx} commands. Works fine for everything else, but the only place it would be genuinely hugely useful is with the cite commands - my bibliography file is huge and searching through it is cumbersome. In previous versions of kile I've had it working briefly here and there, but its never really worked particularly well for long. I've been looking around online, and the only solutions I keep finding entail adding a symbolic link to the bibliography file from my local directory (where the .tex file is located), adding it to the same project as the tex file, and refreshing the tree. Still nothing though.

Does anyone have any idea how to get this feature working? I can't see why it would be such a problem, winedt used to do it without even blinking!

turiontzukosson

August 23rd, 2010, 02:31 PM

You have to use \bibliography{mybib.bib} somewhere in the project. And you have to enter the file name literally. It is not possible to use a command like \newcommand{\pathtomybib}{mybib.bib} and then \bibliography{\pathtomybib}.