kks32 / phd-thesis-template

A LaTeX / XeLaTeX / LuaLaTeX PhD thesis template for Cambridge University Engineering Department (CUED)
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/
MIT License
824 stars 397 forks source link

Biblatex #204

Open lkwa2 opened 4 years ago

lkwa2 commented 4 years ago

I think the biblatex bit doesn't work, even with the natbib lines commented and cleaning aux files between using natbib/biblatex (both of which should ideally be mentioned in the comments explaining how to transition between the two). I did my thesis a while back (thanks for the great template!) and noted down a couple of other minor comments:

lkwa2 commented 3 years ago

Someone asked whether I managed to get biblatex to work: the answer is no, I gave up and used natbib (I didn't want to spend time working out how to carefully adjust the .cls file as I think would have been required).

Soczawa commented 3 years ago

That might've been me, but I quickly figured out why it didn't work. At least in my case, the issue was not with the template, but with my editor. By default, it was using BibTeX instead of Biber as the bibliography tool. I found the solution here: https://tex.stackexchange.com/questions/154751/biblatex-with-biber-configuring-my-editor-to-avoid-undefined-citations/154754#154754

Adampultz commented 2 years ago

I managed to get biblatex to work, after hours of trying. I am working in Overleaf and had to recompile from scratch to make it work the first time. Also, please not, that you need to add your own address for your reference.bib file. In this code I also did natbib=false, but making it true will still work

In thesis.tex:

% ********************************** Bibliography ******************************
\begin{spacing}{0.9}

% To use the conventional natbib style referencing
% Bibliography style previews: http://nodonn.tipido.net/bibstyle.php
% Reference styles: http://sites.stat.psu.edu/~surajit/present/bib.htm

% \bibliographystyle{apalike}
% \bibliographystyle{authoryear}
%\bibliographystyle{unsrt} % Use for unsorted references  
% \bibliographystyle{plainnat} % use this to have URLs listed in References
\cleardoublepage
% \bibliography{References/references} % Path to your References.bib file
% \addbibresource{References/references.bib}

% If you would like to use BibLaTeX for your references, pass `custombib' as
% an option in the document class. The location of 'reference.bib' should be
% specified in the preamble.tex file in the custombib section.
% Comment out the lines related to natbib above and uncomment the following line.

\printbibliography[heading=bibintoc, title={References}]

\end{spacing}

In preamble.tex:

% *************************** Bibliography  and References ********************

%\usepackage{cleveref} %Referencing without need to explicitly state fig /table

% Add `custombib' in the document class option to use this section
% \setcitestyle{aysep={}}
\ifuseCustomBib
%   \RequirePackage[square, sort, numbers, authoryear]{natbib} % CustomBib

% If you would like to use biblatex for your reference management, as opposed to the default `natbibpackage` pass the option `custombib` in the document class. Comment out the previous line to make sure you don't load the natbib package. Uncomment the following lines and specify the location of references.bib file

\usepackage[natbib=false,backend=biber,sorting=nyt,style=authoryear, citestyle=authoryear-icomp, doi=false,isbn=false]{biblatex}
\setlength\bibitemsep{\baselineskip}

% \RequirePackage[backend=biber, style=authoryear, sorting=nyt, natbib=true]{biblatex}
% \bibliography{References/references} %Location of references.bib only for biblatex
\addbibresource{References/references.bib}

\fi

% changes the default name `Bibliography` -> `References'
\renewcommand{\bibname}{References}