4

Consider the following particular references in your bibliography file:

@misc{SchwaberSutherland-DerScrumGuide,
  author = {Ken Schwaber and Jeff Sutherland},
  title = {Der Scrum Guide™},
  year=2017,
  month=nov,
  language={ngerman},
  url={http://www.scrum.org/resources/scrum-guide}
}

or

@inproceedings{Scott_Strachey_71,
Author = {Dana Stewart Scott and Christopher S. Strachey},
Booktitle = {Symposium on Computers and Automata},
Editor = {J. Fox},
Language = {USenglish},
Mon = aug,
Organization = {Polytechnic Institute of Brooklyn},
Pages = {19--46},
Publisher = wil,
Series = {Microwave Institute Symposia Series},
Title = {Towards a Mathematical Semantics for Computer Languages},
Volume = 21,
Year = 1971}

With \RequirePackage{natbib}, \usepackage{babelbib}, and \bibliographystyle{babalpha-fl} (but no jurabib or cite) the references to these entries are abbreviated as [SS17] and [SS71]. Let's assume you wish to avoid abbreviatations such as SS (since they might remind some readers of Schutzstaffel). How do you tell LaTeX+Bibtex to produce [ScSu17] and [ScSt71] (or something else) instead?

2 Answers2

4

The easiest way is not using an “alpha” bib style. They used to be handy in the olden times when you didn't know the order of bibliographic items in typewritten manuscripts.

But there's a way. I added also two fake entries in order to show the collation order is correct.

\begin{filecontents*}{\jobname.bib}
@article{a,
  author={Sa, X.},
  title={Title},
  journal={Journal},
  year=2017,
}
@article{b,
  author={St, X.},
  title={Title},
  journal={Journal},
  year=2017,
}
@misc{SchwaberSutherland-DerScrumGuide,
  author = {Ken Schwaber and Jeff Sutherland},
  title = {Der Scrum Guide™},
  year=2017,
  month=nov,
  language={ngerman},
  url={http://www.scrum.org/resources/scrum-guide}
}
@misc{SchwaberSutherland-DerScrumGuide-bis,
  author = {Ken {\relax Sc}hwaber and Jeff {\relax Su}therland},
  title = {Der Scrum Guide™},
  year=2017,
  month=nov,
  language={ngerman},
  url={http://www.scrum.org/resources/scrum-guide}
}
\end{filecontents*}

\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage{url}

\usepackage{babelbib}
\bibliographystyle{babalpha-fl}

\begin{document}

\cite{SchwaberSutherland-DerScrumGuide}
\cite{SchwaberSutherland-DerScrumGuide-bis}
\cite{a,b}

\bibliography{\jobname}

\end{document}

The filecontents* environment is just to make the example self-contained. I doubt that loading natbib along with babelbib makes sense.

enter image description here

egreg
  • 1,121,712
  • @user49915 Nice, but difficult to maintain. I still think that alpha styles are a thing of the past. – egreg Jul 16 '18 at 15:33
3

With a bit of work babalpha-fl.bst can be taught to detect historically problematic abbreviations in labels and try to work around it.

I'm working under the assumption that only certain two letter abbreviations are problematic (the example has "SS" and "SA" hard-coded, but you can add "HH", "HJ", "NSDAP", you name it, I have not added anything to ban entries from 1988 and 2018, though) and that using two letters of each author name instead can mitigate the problem.

As mentioned above, you will have to modify the .bst file. To do that proceed as follows

  1. Locate babalpha-fl.bst on your machine for example by typing kpsewhich babalpha-fl.bst.
  2. Copy the file to a place where LaTeX can find it (https://texfaq.org/FAQ-inst-wlcf), the directory of your document will do just fine, and rename it to babalpha-fl-gs.bst, say. Note that the license of babalpha-fl.bst requires you to change the name of the file if you modify it.
  3. Open babalpha-fl-gs.bst and insert a header with the new file name and the current date
  4. Find FUNCTION {format.lab.names} and insert

    % new function, essentially a copy of format.lab.names
    % that produces two-letter labels from each name
    FUNCTION {format.lab.names.safe}
    { 's :=
      s num.names$ 'numnames :=
      numnames #1 >
        { numnames #4 >
            { #3 'namesleft := }
            { numnames 'namesleft := }
          if$
          #1 'nameptr :=
          ""
            { namesleft #0 > }
            { nameptr numnames =
                { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
                    { "{\etalchar{+}}" *
                      #1 'et.al.char.used :=
                    }
                    { s nameptr "{v{}}{l{}}" format.name$
                      duplicate$ text.length$ #2 <
                        { pop$ s nameptr "{ll}" format.name$ #2 text.prefix$ }
                        'skip$
                      if$
                      *
                    }
                  if$
                }
                { s nameptr "{v{}}{l{}}" format.name$
                  duplicate$ text.length$ #2 <
                    { pop$ s nameptr "{ll}" format.name$ #2 text.prefix$ }
                    'skip$
                  if$
                  * 
                }
              if$
              nameptr #1 + 'nameptr :=
              namesleft #1 - 'namesleft :=
            }
          while$
          numnames #4 >
            { "{\etalchar{+}}" *
              #1 'et.al.char.used :=
            }
            'skip$
          if$
        }
        { s #1 "{v{}}{l{}}" format.name$
          duplicate$ text.length$ #2 <
            { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
            'skip$
          if$
        }
      if$
    }
    

    before it.

  5. Replace FUNCTION {format.lab.names} with

    % slightly modified from original to detect problematic abbreviations
    FUNCTION {format.lab.names}
    { 's :=
      s num.names$ 'numnames :=
      numnames #1 >
        { numnames #4 >
            { #3 'namesleft := }
            { numnames 'namesleft := }
          if$
          #1 'nameptr :=
          ""
            { namesleft #0 > }
            { nameptr numnames =
                { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
                    { "{\etalchar{+}}" *
                      #1 'et.al.char.used :=
                    }
                    { s nameptr "{v{}}{l{}}" format.name$ * }
                  if$
                }
                { s nameptr "{v{}}{l{}}" format.name$ * }
              if$
              nameptr #1 + 'nameptr :=
              namesleft #1 - 'namesleft :=
            }
          while$
          numnames #4 >
            { "{\etalchar{+}}" *
              #1 'et.al.char.used :=
            }
            'skip$
          if$
          % this block is new
          duplicate$ "SS" =
            { pop$
              s format.lab.names.safe }
            { duplicate$ "SA" = 
                { pop$
                  s format.lab.names.safe }
                'skip$
              if$
            }
          if$
        }
        { s #1 "{v{}}{l{}}" format.name$
          duplicate$ text.length$ #2 <
            { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
            'skip$
          if$
        }
      if$
    }
    
  6. Use \bibliographystyle{babalpha-fl-gs} instead of \bibliographystyle{babalpha-fl} in your document

Alternatively you can get babalpha-fl-gs.bst from https://gist.github.com/moewew/158481168f4a2135764f96fc608a1998

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{babelbib}
\usepackage{hyperref}
\bibliographystyle{babalpha-fl-gs}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{SchwaberSutherland-DerScrumGuide,
  author = {Ken Schwaber and Jeff Sutherland},
  title = {Der Scrum Guide™},
  year=2017,
  month=nov,
  language={ngerman},
  url={http://www.scrum.org/resources/scrum-guide},
}
\end{filecontents}

\begin{document}
\cite{SchwaberSutherland-DerScrumGuide}
\bibliography{\jobname}
\end{document}

enter image description here

moewe
  • 175,683
  • @user49915 It's a bit boring, isn't it? ;-) It has the huge advantage of not requiring changes to .bst files which can be a plus if you are not into this sort of thing (and might be a plus when you have to share your work with others or submit it to a publisher - though publishers usually want the .bbl file in which case a modified .bst file does not really matter). I must say that I mainly answered because I liked the challenge, not because I thought this would be particularly useful. ... – moewe Jul 16 '18 at 15:35
  • ... But of course my solution is not supposed to require manual intervention which is nice in case you want to re-use the .bib file for something else. It was a similar situation here. – moewe Jul 16 '18 at 15:35
  • @user49915 I only just saw your comment about code maturity. I'm quite confident that the code as posted works as intended. But of course I can't guarantee that everything works as desired so a bit of caution is always advised. – moewe Jul 16 '18 at 15:43
  • @user49915 I must say I'm a bit torn as to whether or not I should think it is a good idea to 'ban' certain labels. For one style guides usually value consistency a lot and deviating from a given scheme to avoid certain abbreviations can look awkward, but you may be prepared to accept that to avoid Nazi connotations. I would expect that no one in their right mind would attack an author just because the initials of the people she cited happen to form an abbreviation associated with Nazi Germany. And as you can see the possible list of unfortunate labels is quite long. – moewe Jul 16 '18 at 15:51
  • ... But then again, I don't know how strongly other people feel about this. And I must say that I always cringed when I was tutoring a stochastic class and we were discussing coin tosses (in German) where I usually abbreviated tails with "Z" and head with "K" and had to write down the even of head-tails. – moewe Jul 16 '18 at 15:54
  • @user49915 Mhh, given that these are baseless accusations I don't know whether I would like to have that person impose their view upon my work. And where would it stop? Can I cite "SED89"? "KPdSU" (OK, crazy name, but who knows what people are called)? "CPK"? My fear is rather that if you yield to those people claiming a connection between citation labels and political statements(?) where there obviously is none (you can't change the name of people you cite) you are opening up a whole world of political minefields. – moewe Jul 16 '18 at 16:01
  • @user49915 I shouldn't comment on the merits of the idea of avoiding certain labels any more. But since you mention Biber I just want to point out that while I am normally very happy to recommend biblatex with Biber (publishers, professors and other powers permitting) I have no idea how one would do a similar thing there. – moewe Jul 16 '18 at 18:25
  • @user49915 That was a typo. Should be fixed now. Thanks for the heads-up. – moewe Feb 01 '19 at 20:46