2

I am writing my thesis in LyX. It's a collection with 3 separate .bib files with jab ref. I inserted the three bib file in three different places. But the pdf output seem to only use the first bib file at all three different places. I can merge the bib file into one. I am just curious if there is a way to avoid doing that.

4

This assumes you have already set up your LyX document to use biblatex (with Biber). Please see the LyX wiki for more. In short you will have to have

  1. Biber set up (No Bibliography is printed and citations shown bibtex key) via "Document→Settings→Bibliography" or "Tools→Preferences→Output→LaTeX"
  2. Call biblatex in the preamble. Go to "Document→Settings→LaTeX Preamble" and load biblatex with all the needed options

    \usepackage[style=authoryear,backend=biber,refsection=section]{biblatex}
    

    for example

  3. Add your .bib file to the preamble. Go to "Document→Settings→LaTeX Preamble" and add a call to \addbibresource{full/path/of/your/bib/file}. Note that you will have to give an absolute path, relative paths are only supported for files in the local texmf tree.

    If you want a per-chapter bibliography, all you need to do is to add the refsection option to the biblatex call in "Document→Settings→LaTeX Preamble".

  4. Insert a BibTeX bibliography "Insert→List/TOC→BibTeX Bibliography..." in a note (see BibLaTex, Biber and Lyx: how to resolve \bibliographystyle error?), but still using the correct database. This is to make sure that LyX finds the citations.

  5. Add \printbibliography in an ERT block.


If you want a per-section bibliography, call biblatex in the preamble with

\usepackage[style=authoryear,backend=biber,refsection=section]{biblatex}

The document then is straightforward. Each section will be in its own refsection.

You will need one \printbibliography in the ERT block for each chapter

LyX screenshot

gives

pdf output


Manual refsections are as easy as well. You just need to make sure to not call biblatex with anything other than refsection=none (not giving the argument is equivalent to refsection=none), that is important since refsections cannot be nested.

You will just have to insert \newrefsection and \begin{refsection}...\end{refsection}in ERT blocks in the appropriate places.

LyX example with manual refsections

gives

pdf output of the "manual" example

  • Thanks a lot for the detailed answer. I did every step. But there still seem to be some errors. It says package biblatex error: nested refsection environment. I used \begin{refsection} at the beginning of chapter one,ended that refsection at the end of chapter one. and used \newrefsection at chapter 2. – Yan Song Mar 11 '16 at 18:21
  • 1
    @YanSong If you use refsection=section as in the first example there is no need for manual refsections. Everything will be done per \section (or \chapter if you choose refsection=chapter.) Otherwise I would need to see what you are doing. You can't have \begin{refsection}\newrefsection\end{refsection}. – moewe Mar 11 '16 at 18:33
  • Ok. I figured out what's wrong. Since I used refsection in the preamble, I don't need to manually set it again. I removed the begin refsection and the document is compiling. But the output pdf does not have any citations shown at all now. – Yan Song Mar 11 '16 at 18:34
  • @YanSong Can you compile a normal biblatex example without problems, i.e. is LyX set up correctly to deal with biblatex and Biber? – moewe Mar 11 '16 at 18:37
  • A minimal working example failed. I need to check what's wrong. – Yan Song Mar 11 '16 at 18:47
1

You can add all three files in the one place. In the dialogue box just keep clicking on the "add" button, even though there's one already there. But then you get a single bibliography typeset into your document. Is that what you want? Having three different bibliography sections might be more complicated.

  • I was hoping to get three different bibliography sections. This is a essay based thesis so it makes more sense to have a reference section for each paper. – Yan Song Mar 11 '16 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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