3

I'm using natbib with a custom .bst file for a conference paper. Unfortunately, the .bst file results in a comma separating the authors names when there are only two authors, and I need to remove this comma.

In the .bst file, here is the format.names function:

FUNCTION {format.names}
{ 'bibinfo :=
  duplicate$ empty$ 'skip$ {
  's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}{, f.}{, jj}"
      format.name$
      bibinfo bibinfo.check
      't :=
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              "," *
              t "others" =
                {
                  " " * bbl.etal *
                }
                {
                  bbl.and
                  space.word * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  } if$
}

I'm not familiar enough with the scripting language used in the .bst file to modify it. I believe I need to add another condition for when the total number of names is 2, and to modify:

namesleft #1 >
{ ", " * t * }

As an aside, I believe this bst file was created by the conference organizer using the bst creation wizard.

Unfortunately, I cannot move forward with the editing process until this is fixed... Could anyone assist me?

Thank you in advance.

Edit: Here is a MWE:

\documentclass[conf]{new-aiaa}

\begin{document}

Here is a MWE containing a sample citation and references list \cite{peyret2012computational}.

\bibliography{sample}

\end{document}

To get this MWE to work, you need the following sample.bib file

@inbook{peyret2012computational,
  title={Computational Methods for Fluid Flow},
  edition={2},
  author={Peyret, Roger and Taylor, Thomas D},
  year={1983},
  publisher={Springer-Verlag},
  address={New York},
  chapter={7, 14}
}

and the new-aiaa.cls and new-aiaa.bst files, which can be sourced from the presenter resources page found at

https://www.aiaa.org/home/events-learning/events/Technical-Presenter-Resources

or directly from Overleaf at

https://www.overleaf.com/latex/templates/latex-template-for-the-preparation-of-papers-for-aiaa-technical-conferences/rsssbwthkptn#.WbgUXMiGNPZ

Just a note, I have this issue with conference papers as well, but this is for my thesis which uses the new-aiaa.bst file for references, but of course, a different cls file.

Thank you for your patience and assistance.

3
  • 2
    Can you post a link to the whole .bst file and add a sample document and .bib item showing the problem?
    – Alan Munn
    Jun 26, 2019 at 19:38
  • @AlanMunn yes, thank you very much for your patience and your assistance. I will edit the main question with the requested information and MWE.
    – Matt
    Jun 27, 2019 at 1:36
  • Is there anything I could add to this question? I could really use some help on this one :(
    – Matt
    Jun 30, 2019 at 3:25

1 Answer 1

2

The following does what you want:

Make a copy of new-aiaa.bst and rename it something sensible, like new-aiaa-nocomma.bst.

In the function format.names there is a line (line 454) that contains just the following:

"," *

Replace this line with the following lines:

numnames #2 = 
     {" " *}
     {"," *}
if$

Here's a MWE using article class. Since the new-aiaa.bst was created by the journal, I don't think you should change the style for submission to the journal. If you do, you will need to patch the new-aiaa.cls to use the modified .bst file, since the class loads the style itself.

\begin{filecontents}{\jobname.bib}
@inbook{peyret2012computational,
  title={Computational Methods for Fluid Flow},
  edition={2},
  author={Peyret, Roger and Taylor, Thomas D},
  year={1983},
  publisher={Springer-Verlag},
  address={New York},
  chapter={7, 14}
}
@article{hughes1989new,
  title={A new finite element formulation for computational fluid dynamics: {VIII}. The {Galerkin}/least-squares method for advective-diffusive equations},
  author={Hughes, Thomas JR and Franca, Leopoldo P and Hulbert, Gregory M},
  journal={Computer Methods in Applied Mechanics and Engineering},
  volume={73},
  number={2},
  pages={173--189},
  year={1989},
  publisher={Elsevier}
}
\end{filecontents}
%\documentclass[conf]{new-aiaa} % Class will need to be changed to use the modified .bst
\documentclass{article}
\usepackage[sort&compress,numbers]{natbib}
\bibliographystyle{new-aiaa-nocomma}
\begin{document}
\cite{peyret2012computational,hughes1989new}
\bibliography{\jobname}
\end{document}

output of code

2
  • 1
    Always my sincere compliments. Very elegant.
    – Sebastiano
    Jun 30, 2019 at 10:54
  • Thank you so very very much! This did the trick! Very elegant solution!
    – Matt
    Jul 1, 2019 at 17:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .