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.

Using the alpha bibliography style, citations are sorted by the citation key. I'd like to use the same style of authors-year citation keys (e.g., [CP92]) but have the bibliography sorted by the first author's lastname instead of alphabetically by the citation key itself. This would keep the same papers by the same first author together.

For example, alpha would produce the following sorted order:

  • [Cha81] D. Chaum. Untraceable...
  • [CL04] J. Camenisch and A. Lysyanskaya. Signature...
  • [CP92] D. Chaum and T. Pedersen. Wallet...

Whereas, abbr would produce the following sorted order:

  • [1] J. Camenisch and A. Lysyanskaya. Signature...
  • [2] D. Chaum. Untraceable...
  • [3] D. Chaum and T. Pedersen. Wallet...

I am looking for the same sorting as abbr but maintaining the citation key style of alpha.

Is there a way to achieve this hybrid style?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

For users of traditional BibTeX, i.e., without using biblatex: Copy TEXMF/bibtex/bst/base/alpha.bst to a new file alpha-abbrvsort.bst in a place where BibTeX will find it. Open it in an text editor, locate the function presort, and comment the four lines as shown here:

FUNCTION {presort}
{ calc.label
  % sort.label   %% four lines commented out to obtain presort of abbrv.bst
  % "    "       %%
  % *            %%
  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.key$ :=
}

Save and close, and use it as normal:

\documentclass{article}
\usepackage{filecontents}

\begin{filecontents}{PulpSpy.bib}
  @misc{a, author={Chaum, D.}, title = {Untracable ...}, year = {1981}}
  @misc{b, author={Chamenisch, J. and Lysyanskaya, A.}, title={Signature...}, year={2004}}
  @misc{c, author={Chaum, D. and T. Pedersen, T.}, title={Wallet...}, year={1992}}
\end{filecontents}

\begin{document}
\nocite{*}
\bibliographystyle{alpha-abbrvsort}
\bibliography{PulpSpy}
\end{document}

Works:

reference output

share|improve this answer
add comment

If you're willing to switch to biblatex, here's how to do it:

\documentclass{article}

\usepackage[style=alphabetic,sorting=nty]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{C,
  author = {Chaum, D.},
  year = {1981},
  title = {Untraceable \dots},
}    
@misc{CL,
  author = {Camenisch, J. and Lysyanskaya, A.},
  year = {2004},
  title = {Signature \dots},
}
@misc{CP,
  author = {Chaum, D. and Pedersen, T.},
  year = {1992},
  title = {Wallet \dots},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}
share|improve this answer
    
Thanks. This seems like it will work. I didn't verify it (since lofreq.def, a dependency of biblatex, is producing a weird error for me). –  PulpSpy Mar 20 '11 at 23:07
    
@Jeremy: logreq is a small separate package which is included in the current versions of TeXLive and MiKTeX. –  lockstep Mar 20 '11 at 23:14
    
Thanks, I think upgrading MacTeX (in my case) will solve the problem (the logreq error is related to etoolbox being outdated, according others online who had the same error). At 1.5GB, it is a bit of a commitment though. –  PulpSpy Mar 20 '11 at 23:24
    
I finally tried this out and it works great: Thanks! I am using \usepackage[style=alphabetic,terseinits=true,firstinits=true,sorting=nyt,backref‌​=true,maxnames=4,minnames=3]{biblatex} and \printbibliography[maxnames=10] (via your tip in my other question). It models what I want quite closely. –  PulpSpy Jul 12 '11 at 20:42
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.