Natbib year-author citation sort order

Natbib year-author citation sort order

Post by Jens Berge » Fri, 26 Sep 2003 02:38:21



You have to play with the presort function. You could place

year field.or.null sortify

before the 'author.*.sort' functions:

FUNCTION {presort}
{ calc.label
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
year field.or.null sortify
" "
*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% label sortify
%% " "
%% *
type$ "book" =
type$ "inbook" =
or
'author.editor.sort
{ type$ "proceedings" =
'editor.organization.sort
{ type$ "manual" =
'author.organization.sort
'author.sort
if$
}
if$
}
if$
" "
*
%% year field.or.null sortify
%% *
%% " "
%% *
title field.or.null
sort.format.title
*
#1 entry.max$ substring$
'sort.label :=
sort.label *
#1 entry.max$ substring$
'sort.key$ :=
}

At least, plainnat.bst has a second SORT command, which has to be
disabled too (IMO), because it sorts again by labels:

% FUNCTION {bib.sort.order}
% { sort.label 'sort.key$ :=
% }

% ITERATE {bib.sort.order}

% SORT

I haven't tested this extensively.


HTH,


Jens

P.S. Oren Patashnik sent me these functions for debugging years ago:

FUNCTION {before.sort} { "BEFORE SORT:" top$ }
EXECUTE {before.sort}
FUNCTION {print.sort.keys} {sort.key$ top$}
ITERATE {print.sort.keys}

SORT

FUNCTION {after.sort} {"AFTER SORT:" top$}
EXECUTE {after.sort}
ITERATE {print.sort.keys}
--
www.jurabib.org