0

I'm using this bibliography style from this question. What I like about it is that it (almost) doesn't show the initials of the authors, which is what I'm looking for. However, if the reference has only one author it does show the initials. Also, if the reference has two authors I want it to be displayed as Author1 & Author2 in the Reference list (paragraph in this case).

To fix this, I edited the bst file, specifically FUNCTION {format.names} in line 396, so that

  1. if reference has more than 2 authors, it'll be displayed as Author1 et al.
  2. if reference has 2 authors, it'll be displayed as Author1 & Author2
  3. if reference has 1 author, it'll be displayed as Author1
  4. in all cases without initials.

this is the edited function:

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=                
  s num.names$ 'numnames :=     
  numnames 'namesleft :=        
    { namesleft #0 > }
    { s nameptr "{vv~}{ll}{, jj}" format.name$ 
    't :=

numnames #2 >
    {
      nameptr #1 >
        {
          nameptr #2 =
            {
              " {et~al.}" *
            }
            {
                nameptr #2 >
                { "" * }
                { ", " * t * }
                if$
            }
            if$

        }
        't
      if$
    }
    {
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              numnames #2 >
                { "," * }
                'skip$
              if$
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " {et~al.}" *
                }
                { " \& " * t * }
              if$
            }
          if$
        }
        't
      if$
    } if$

      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

This works well but, in cases 2 and 3 above, there is a point (.) at the end of the author

Here is a MWE taken from the question linked above.

\documentclass{article}

\bibliographystyle{apj_w_etal_3auth}

\usepackage[super,sort&compress]{natbib}

\usepackage{paralist}

\renewenvironment{thebibliography}[1]{%
\textsc{\textbf{References:}}
\let\par\relax\let\newblock\relax%
\inparaitem[{[}1{]}]}{\endinparaitem}

\usepackage{times}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@lbibitem}{\item[\hfil\NAT@anchor{#2}{\NAT@num}]}{\item[\NAT@anchor{#2}{\NAT@num}]}{}{}
\makeatother

\begin{filecontents}{test.bib}
@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
        [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}

@article{belloche2014detection,
  title={Detection of a branched alkyl molecule in the interstellar medium: iso-propyl cyanide},
  author={Belloche, Arnaud and Garrod, Robin T and M{\"u}ller, Holger SP and Menten, Karl M},
  journal={Science},
  volume={345},
  number={6204},
  pages={1584--1587},
  year={2014},
  publisher={American Association for the Advancement of Science}
}

@article{mcnally1989anxiety,
  title={Is anxiety sensitivity distinguishable from trait anxiety? Reply to Lilienfeld, Jacob, and Turner (1989).},
  journal={Nature},
  author={McNally, Richard J and McLovin, Just},
  year={1989},
  publisher={American Psychological Association}
}

\end{filecontents}

\begin{document}

\nocite{*}

\bibliography{test}

% \show\bibitem

% \makeatletter
% \show\@lbibitem
% \makeatother

\end{document}

How to get rid of the annoying point? See first and last reference in the image below

Reference image

2
  • Other than the fact that the apj_w_etal_3auth bibliography style appears to be compatible with the natbib citation management package, there's nothing in your posting to justify mentioning natbib in the title of your query. Please clarify.
    – Mico
    Mar 23, 2021 at 7:14
  • @Mico title changed. Mar 23, 2021 at 14:45

0

You must log in to answer this question.

Browse other questions tagged .