0

My question is simple: It is the equivalent of this question I asked some time ago, but now I must use bibtex and not biblatex, mainly to be able to easily put my files on the arXiv and to have less difficulty in sharing my tex files to other people. More precisely, I want the citations under the bibtex alpha style to show the full list of authors. This is not a problem if the list of authors for the particular publication contains less than or equal to 4 authors. However, if the list of authors contains any more than 3 authors, then the citation gets truncated to the last name of the first three authors and a "+" sign.

Consider the example:

\documentclass[11pt]{article}
\usepackage{cite}

\begin{document} A citation \cite{cita}.

\bibliography{trial2}{} \bibliographystyle{alpha} \end{document}

where trial2.bib is the .bib file


@article {cita,
    AUTHOR = {Add, Abel and Bc, Bobby and Ca, Carla and De, Daniela and Edd, Emilio},
    TITLE = {Article},
    JOURNAL = {Some},
    FJOURNAL = {Any},
    VOLUME = {1},
    YEAR = {2018},
    NUMBER = {1},
    PAGES = {1--10},
}

The output has the citation "[ABC+18]". I would like the citation to read "[ABCDE18]". Any help is much appreciated.

If it matters at all, I'm working on TeXStudio on Windows 10, using MikTeX.

1

The procedure to generate these labels is coded in the .bst file. alpha.bst has no way to manually override a label it produces, so the only way to change this without changing other things is to modify the .bst file. This would then make collaboration more cumbersome because you have to distribute your changed .bst file as well.

Anyway, you can change alpha.bst as follows

  1. Locate alpha.bst on your machine (you can use kpsewhich alpha.bst from the command line to find out where the file resides), alternatively, get the file from CTAN: http://mirrors.ctan.org/biblio/bibtex/base/alpha.bst

  2. Copy alpha.bst to a location where LaTeX can find it (https://texfaq.org/FAQ-inst-wlcf, the document directory will do just fine) and rename it to, say, alpha-maxalphanames.bst. Note that the license requires you rename the file if you later redistribute it.

  3. Open the renamed file alpha-maxalphanames.bst and replace the code block

    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$
        }
        { s #1 "{v{}}{l{}}" format.name$
          duplicate$ text.length$ #2 <
            { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
            'skip$
          if$
        }
      if$
    }
    

    with

    FUNCTION {format.lab.names}
    { 's :=
      s num.names$ 'numnames :=
      numnames #1 >
        { numnames 'namesleft :=
          #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$
        }
        { s #1 "{v{}}{l{}}" format.name$
          duplicate$ text.length$ #2 <
            { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
            'skip$
          if$
        }
      if$
    }
    

    Specifically, replace the first numnames #4 > {<true>} {<false>} if$ block by just the contents of the <false> branch and completely remove the second numnames #4 > {<true>} {<false>} if$ block.

  4. Add a short note about the changes with your name and the current date to the top of the file.

  5. Save the file.

  6. Use \bibliographystyle{alpha-maxalphanames} instead of \bibliographystyle{alpha} in your document.

You can get the oven-ready alpha-maxalphanames from https://gist.github.com/moewew/d802ea87f432f97fc428dbc9d54e64c1, the diff to alpha.bst is

--- alpha.bst   2019-12-21 08:15:40.781232500 +0100
+++ alpha-maxalphanames.bst 2019-12-21 08:19:48.505159500 +0100
@@ -1,3 +1,14 @@
+%% alpha-maxalphanames.bst
+%% 2019-12-21 MW
+%% https://tex.stackexchange.com/q/521246/35864
+%% modification of alpha.bst
+%%
+%% small change to format.lab.names:
+%% always set numnames 'namesleft :=
+%% remove both numnames #4 > tests
+%%
+%% original copyright header follows
+%%
 % BibTeX standard bibliography style `alpha'
    % Version 0.99b (8-Dec-10 release) for BibTeX versions 0.99a or later.
    % Copyright (C) 1984, 1985, 1988, 2010 Howard Trickey and Oren Patashnik.
@@ -935,10 +946,7 @@
 { 's :=
   s num.names$ 'numnames :=
   numnames #1 >
-    { numnames #4 >
-        { #3 'namesleft := }
-        { numnames 'namesleft := }
-      if$
+    { numnames 'namesleft :=
       #1 'nameptr :=
       ""
         { namesleft #0 > }
@@ -956,12 +964,6 @@
           namesleft #1 - 'namesleft :=
         }
       while$
-      numnames #4 >
-        { "{\etalchar{+}}" *
-          #1 'et.al.char.used :=
-        }
-        'skip$
-      if$
     }
     { s #1 "{v{}}{l{}}" format.name$
       duplicate$ text.length$ #2 <

With that the following MWE

\documentclass[11pt]{article}
\usepackage{cite}

\begin{filecontents}{\jobname.bib}
@article {cita,
  AUTHOR   = {Add, Abel and Bc, Bobby and Ca, Carla and De, Daniela and Edd, Emilio},
  TITLE    = {Article},
  JOURNAL  = {Some},
  FJOURNAL = {Any},
  VOLUME   = {1},
  YEAR     = {2018},
  NUMBER   = {1},
  PAGES    = {1--10},
}
\end{filecontents}

\begin{document}
A citation \cite{cita}.


\bibliography{\jobname}
\bibliographystyle{alpha-maxalphanames}
\end{document}

produces

A citation [ABCDE18].

  • Thank you very much for your very detailed help! I will test your solution now. – Lentes Dec 23 '19 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.
https://tex.stackexchange.com/questions/521246/in-bibtex-how-to-make-sure-that-the-cite-acronym-has-letters-for-all-authors
tex.stackexchange.com
crawl=CC-MAIN-2020-10
144156
application/http; msgtype=response
sha1:ZQPWRBCN7YTEUQDJCLS3HDUF7TB3WN6O
<urn:uuid:7b5c5539-4881-44d6-9914-dfdd4f41ab7f>
2020-02-18T15:39:43Z
151.101.1.69
text/html
sha1:2OMSHRLFCTORFD2IPRULZTAOPM6ZVNXE
<urn:uuid:90ba1580-db8c-4f3b-98a0-1b9cdb89e0f7>
https://tex.stackexchange.com/questions/521246/in-bibtex-how-to-make-sure-that-the-cite-acronym-has-letters-for-all-authors
response
<urn:uuid:60a3115a-fedc-491e-b527-c98966cad382>
isPartOf: CC-MAIN-2020-10
publisher: Common Crawl
description: Wide crawl of the web for February 2020
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-238.ec2.internal
software: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/