I am writing my master thesis using Lyx and I don't know how it would be the best way to set up my bibliography due to the requirements by the university. The Bibliography has to be arranged alphabetically making subsections for each source type and has to use the Harvard Referencing System including the citation style (author,year). As I advance writing I have tried out to find the best way, but I have struggled to find out how it would be the best way. How would you guys do it and what would I have to do to be able to implement it. I am building up my .bib file and try to use natbib but it does not work. I appreciate any suggestions, as it is my first time using Lyx and I wrote my Diploma thesis in physics about 8 years ago.
1 Answers
If I understand you correctly, you can do this with biblatex, which is a quite new LaTeX package for dealing with bibliographies. As LyX hasn't built in support for this in the GUI yet, there is some initial setup required. The information in this answer comes from two sources:
Setting up LyX for biblatex
You have to install a biblatex module, which is can be downloaded at http://wiki.lyx.org/uploads/BibTeX/biblatex.module Place the biblatex.module file in the layouts folder in the LyX user directory, the location of which is listed in Help --> About LyX. Reconfigure and restart LyX.
Change document settings
Go to Document --> Settings, and do the following:
Under Modules, add the Biblatex-citation-styles module.
Under Bibliography, change
Processor to biber
Citation to Natbib, and Natbib style to Author-year

Under LaTeX Preamble, add the following:
\usepackage[style=authoryear, natbib=true]{biblatex} \addbibresource{path/to/your/bibfile.bib}of course changing the path to the bib-file. I think you need the complete path, and the file ending must be included.
In the document
To be able to use the LyX GUI to add citations, you have to trick LyX to search that file by first adding a LyX Note with Insert --> Note --> LyX Note, and then do Insert --> List/ToC --> BibTeX bibliography with the cursor inside the note.
Add an unnumbered (or numbered, depending on requirements) chapter (or section, if you're using an article-class) heading, called Bibliography or References, or whatever you like. Then you have to add something like
\printbibliography[type=book,title={Books},heading=subbibliography]
\printbibliography[type=article,title={Articles},heading=subbibliography]
\printbibliography[nottype=book,nottype=article,title={Miscellaneous},heading=subbibliography]
in an ERT (Insert --> TeX Code, or Ctrl + L) where you want to print the reference lists. Note the type=<reference type>, which defines that the reference list printed there has only one type of source, and the title=Something that changes the heading of the reference list. You have to add one \printbibliography for each type of source.
heading=subbibliography causes the heading to be typeset with a heading that is one level below the highest level. That is, section for book or report classes (where chapter is the highest), or subsection for article classes (where section is the highest).
In the last one nottype is used instead, which prints everything that does not have the specified entry type. Note there is one such for article, one for book.
Image example. Here I added three citations from biblatex-examples.bib, one book, one article, and one something else:
- 206,688

biblatexI think. See http://wiki.lyx.org/BibTeX/Biblatex for how to usebiblatexin LyX, and http://tex.stackexchange.com/questions/6959/sorting-the-bibliography-by-entry-type for the problem of sorting by type. You also wantstyle=authoryearin the options tobiblatex. – Torbjørn T. Nov 21 '13 at 11:34