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.

Ok, I've experienced weird behavior with TeXstudio. I want to add bibliography directly to .bib file while using biblatex. People seem to do in this way. I don't want bibliography inside of the .tex file, but want to separately modify the .bib file - this is the condition

\addbibresource{jobname.bib}

\begin{filecontents}{\jobname.bib}
  @article{JoeDoe2012,
    Author = {Joe Doe},
    Year = {2012},
    Title = {My article's title},
    Journal = {My journal's title},
    Editor = {Ben Editor},
    URL = {http://webpage.com},
  }

\end{filecontents}

In TeXstudio, in order to update (say after adding second item in filecontents), you have to delete all the files except .tex every time . Recompiling dozen times - no reaction, no update. Adding item directly to .bib file - no reaction, no update again after recompiling. During these operations it complains that another .bib file with project name already exists - adding entries there gives no result either. It breaks also when you just try add .bib file without filecontents directly to a .tex file now giving annoying error:

I have no clue what `\addbibresource` command is

Yes, after you've executed it twice with filecontents, same as saying I don't understand what is water while drinking Pepsi. The result is always unresolved references.

In TeXnicCenter it seems that connection occurs after you add two of these and then remove filecontents - now you are able to edit .bib file and recompiling gives you updated results.

I've always wanted to use TeXstudio due to GUI stuff but it keeps me failing over and over again.

share|improve this question
1  
I'm a bit confused about your workflow. Generally you shouldn't use filecontents to manage your .bib file; that's only for when it's crucial that the TeX file contains the bibliography file itself. Normally you would use a GUI reference manager for the .bib file and every time you save that file, the next time you run bibtex or biber those changes will be reflected in your document. –  Alan Munn Apr 21 '13 at 14:32
    
A miscellaneous points: (1) Without \usepackage{filecontents}, you can't update what's in the environment and get it written to the created filecontents file; loading the package is therefore highly recommended. (2) You probably mean \addbibresource{\jobname.bib} (note the slash before jobname!): this tells biblatex that the bibliography file it is looking for will have the same name as the .tex file, but with the extension .bib. –  jon Apr 21 '13 at 18:19
add comment

1 Answer

It seems to me the easiest way of doing this is by creating a seperate .bib file, for example you can open a new window in your editor, paste your code

@article{JoeDoe2012,
    Author  = {Joe Doe},
    Year    = {2012},
    Title   = {My article's title},
    Journal = {My journal's title},
    Editor  = {Ben Editor},
    URL     = {http://webpage.com},
    }

and save as for example jobname.bib (I wouldn't use backslashes in the filename, this can lead to problems when refering to it in your .tex file) in the same folder as your .tex file is in.

You said

I have no clue what \addbibresource command is

This becomes apparent in the following example file, where it is used to include the bibliography that you enclosed using \begin{filecontents}...\end{filecontents}:

\documentclass{article}
\usepackage[backend=bibtex,style=numeric]{biblatex}
\addbibresource{jobname.bib}
\begin{document}

This statement has a checkable source \cite{JoeDoe2012}.

\printbibliography
\end{document}

The backend=bibtex argument is used to tell biblatex to use bibtex (you could also use biber, which is often preferred) and style=numeric is used to number the citations. The argument \printbibliography simply prints the bibliography at that position.

It might (dependent on which editor you use) be necessary to run pdfLaTeX->BibTeX->pdfLaTeX->pdfLaTeX. If you don't see any updates, it might be useful to delete all output files (.aux, .bbl, etc) before recompiling.

share|improve this answer
1  
Clickable citations can by the way be created by using the package hyperref, for example in the form \usepackage[hidelinks]{hyperref} to avoid red boxes around the citation. –  Betohaku Apr 21 '13 at 15:20
    
Welcome to TeX.sx! –  Peter Jansson Apr 21 '13 at 15:20
    
@Betohaku What you give is a nice explanation of the bibtex workflow with standard latex. However the questioner is askng about biblatex, so you should extend your answer to cover that. –  Andrew Swann Apr 21 '13 at 15:42
    
@AndrewSwann Thank you, it has now been added. –  Betohaku Apr 21 '13 at 16:34
    
I am a little busy atm, but I will try to follow all the guidelines and try it again. If it succeeds I will accept. –  Aubergine Apr 23 '13 at 19:36
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.