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
820 stars 392 forks source link

Get citations (in \citep{Zack1900,Aaron2022}) sorted by year and not author name #231

Closed TorkelE closed 2 years ago

TorkelE commented 2 years ago

Hello, I have been trying a lot for this, but not reached anywhere. If I cite two papers in a single \citep{}, they get ordered by the name of the author:

In addition, there are also several review articles on the subject \citep{2005Raser,2006Samoilov,2008Raj,2010Altschuler,2014Tsimring}.

image

I would prefer to have it ordered by the year of publication, but can not get it to work. I use this document class:

\documentclass[a4paper,12pt,times,authoryear,print,index]{Classes/PhDThesisPSnPDF}

but I think that is the only change from the original.

GR8DAN commented 2 years ago

I use a modified version of this template and have not noticed this issue with my simplified version. My differences are:

In preamble.tex from line 110 these lines:

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

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

% Add `custombib' in the document class option to use this section
\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

%\RequirePackage[backend=biber, style=numeric-comp, citestyle=numeric, sorting=nty, natbib=true]{biblatex}
%\addbibresource{References/references} %Location of references.bib only for biblatex, Do not omit the .bib extension from the filename.

\fi

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

Have been swapped for:

% *************************** Bibliography  and References ********************
% -- replaced current style with modern Harvard style
\usepackage{natbib} % Bibliography management
% Use 'numbers' option in natbib if you want a numbered Bibliography
% \usepackage[numbers]{natbib} % Numbered Bibliography
\bibliographystyle{apalike} % Harvard style

And in thesis.tex from line 151 these lines:

% ********************************** 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{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

% 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}

Have been swapped for:

% ********************************** Bibliography ******************************
\begin{spacing}{0.9}
\cleardoublepage
\bibliography{References/references} % Bibliography comes from references.bib file

\end{spacing}

You can also site each item individually in the required order and suppress the brackets using the \citealp option, find examples here, then add the brackets back in.

TorkelE commented 2 years ago

Thanks, this was useful.

Yes, I went through and customised the citing/bibliography and now it works :)