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 use bibtex with \bibliographystyle{alpha}

It works fine. My issue is with the following item.

@book{sga1,
       key = {{SGA1}},
     TITLE = {Rev\^etements \'etales et groupe fondamental},
     NOTE = {S{\'e}minaire de G{\'e}om{\'e}trie Alg{\'e}brique du Bois
          Marie 1960--1961 (SGA 1),
          Dirig{\'e} par Alexandre Grothendieck. Augment{\'e} de deux
          expos{\'e}s de M. Raynaud,
          Lecture Notes in Mathematics, Vol. 224},
     PUBLISHER = {Springer-Verlag},
     ADDRESS = {Berlin},
     YEAR = {1971},
     PAGES = {xxii+447},
 }

The tradition is to call this book SGA1. But in the text, it appears as SGA71, which is logical, but ugly. Is there a way to customize this specific item so that it appears as SGA1 in the text, without modifying its year?

share|improve this question
    
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Guido Jan 12 '13 at 10:46
    
Real quick: How do you want the label of this entry to be typeset in the bibliography: as [SGA1] (i.e., as in the adjusted citations) or as [SGA71] (the default of the alpha bibliography style)? Please advise. –  Mico Jan 12 '13 at 11:39
add comment

1 Answer

up vote 6 down vote accepted

The following works. We create a new style, that uses mylabel as a label if present, and the default alpha label otherwise

  1. Find file alpha.bst (on my machine it's in directory <TEXMF>/bibtex/bst/base) and create a copy named alpha2.bst in your working directory.

  2. Open the file in any editor.

  3. At the beginning, there's a long list named ENTRY{...}, add there one more line:

    mylabel
    
  4. The find FUNCTION {output.bibitem} (in my version it's on line 86) and modify it as follows:

    FUNCTION {output.bibitem}
    { newline$
      "\bibitem[" write$
      mylabel empty$ 'label 'mylabel if$ write$
      "]{" write$
      cite$ write$
      "}" write$
      newline$
      ""
      before.all 'output.state :=
    }
    
  5. Save an close the file.

  6. Open your .bib file, and add to your entry:

    mylabel={SGA1},
    
  7. In your .tex file, change your style to \bibliographystyle{alpha2}.

  8. Run latex, bibtex, latex, latex.

  9. Happy TeXing!

share|improve this answer
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.