Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have found a Bibtex style that suits my requirements very well as it presents my sources exactly how I want.

I am using the \nocite{*} command to display all my bibliography sources from my .bib file. My issue is that the sources then appear in the order that they are in the Bib file rather than in alphabetical order by author surname.

Is there any way someone can tell me how to edit the bst file to make the references appear in alphabetical order rather than in the listed order?

I have been searching around for ages trying to sort this myself but to no avail.

share|improve this question
1  
Welcome to TeX.sx! No need to add thanks in your question, we use upvoting to give credit to those who provide help –  Peter Jansson Jan 9 '13 at 14:31
    
It is the bibliography style that specifies the sort order, regardless of whether you cite the references directly or use \nocite. May be you are using a style like unsrt. Please provide details, preferably by including a minimal working example (MWE). –  Andrew Swann Jan 9 '13 at 15:02
    
I am using cj.bst. Filelink here: tex.ac.uk/tex-archive/bibliography/bibtex/contrib/misc/cj.bst. Is there a way to edit the bst file then so that it does alphabetical sorting @AndrewSwann? –  Tom Jan 9 '13 at 15:07
add comment

2 Answers 2

up vote 1 down vote accepted

Sorting of references is a job for the bibliography style file .bst. The bibliography style you are using cj.bst is set-up to not sort the references, or rather to print them in the order they are cited. \nocite{*} then gives the order they are listed in the bib file.

Reading the file cj.bst you can see that it has been generated by the makebst utility of custom-bib, plus a final bit of hand editing. Fortunately, the bst file tells us that custom-bib was provided with the options

 %% merlin.mbs  (with options: `seq-no,nm-rev,ed-rev,jnrlst,nmlm,x10,x0,m1,dt-beg,
 yr-par,xmth,yrp-x,vol-bf,vnum-x,volp-com,numser,edpar,blk-tit,in-x,pp,ed,abr,xedn,jabr')

The first option seq-no means that references are to be listed in the order they are cited. To effect sorting, we should reproduce this creation process without this first option, as sorting by author name is the default. This may accomplished by creating the file cjj.dbj:

\input docstrip

\preamble
----------------------------------------
*** cj with sort ***

\endpreamble

\postamble
End of customized bst file
\endpostamble

\keepsilent

\askforoverwritefalse
\def\MBopts{\from{merlin.mbs}{%
nm-rev,ed-rev,jnrlst,nmlm,x10,x0,m1,dt-beg,yr-par,xmth,yrp-x,vol-bf,vnum-x,volp-com,numser,edpar,blk-tit,in-x,pp,ed,abr,xedn,jabr  }}
\generate{\file{cjj.bst}{\MBopts}}
\endbatchfile

and running latex on this file to produce cjj.bst. Using this style as follows

\documentclass{article}

\begin{document}
\nocite{*}
\bibliographystyle{cjj}
\bibliography{bib}
\end{document}

with bib.bib containing

@Article{test,
  author =   {Author, First},
  title =    {Title},
  journal =  {Jour},
  year =     2000
}

@Article{type,
  author =   {Aardvark, New},
  title =    {Titling},
  journal =  {J},
  year =     2002
}

produces

Sample output

with the references sorted by author.

This may be good enough for your purposes. As mentioned above, the file cj.bst contains a couple of edits by hand to change some fine details of the printing of certain references. These are clearly flagged in that file, and it should not be too hard to implement those changes should you be so inclined.

share|improve this answer
    
Thank you so much Andrew. That has fixed it perfectly. Very much appreciated. –  Tom Jan 9 '13 at 16:38
add comment

Will using \bibliographystyle{alpha} or \bibliographystyle{plain} help?:

\documentclass{article}
\begin{document}
\nocite*{}
\bibliographystyle{alpha}  %% or 
%\bibliographystyle{plain}    %% ???
\bibliography{myrefs}
\end{document}

enter image description here

share|improve this answer
    
Yes, I have tried plain but it doesn't present the items in the format I need. I basically need Surname, Initial. (Year). "Item name". "Journal". "Page Number" –  Tom Jan 9 '13 at 15:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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