3

When an entry in my bibliography has more than two authors then for some reason what looks like an extra space appears in the list of names, i.e.
A. One, A. Two, and A. Three rather than
A. One, A. Two, and A. Three as I believe it should be.

I'm using revtex, and editing in ShareLatex. This is what I'm seeing in the pdf generated from the below MWE, where you can see the extra space in reference [3]: extraspace

MWE TeX:

\documentclass[reprint,aps]{revtex4-1}

\begin{document}

Lorem ipsum~\cite{article1,article2,article3}.

\bibliographystyle{apsrev4-1}
\bibliography{name}

\end{document}

.bib file:

@article{article1,
    title = {Title},
    volume = {1},
    journal = {Journal Title},
    author = {One, Author},
    year = {2000}}

@article{article2,
    title = {Title},
    volume = {1},
    journal = {Journal Title},
    author = {One, Author and Two, Author},
    year = {2000}}

@article{article3,
    title = {Title},
    volume = {1},
    journal = {Journal Title},
    author = {One, Author and Two, Author and Three, Author},
    year = {2000}}

Any help would be great, thanks!

  • 2
    This appears to be caused by a space being added by both the and and , clauses within the format.names function of apsrev4-1.bst. – Coby Viner May 31 '18 at 19:24
  • 1
    This does indeed look like a bug, you should contact the maintainers at journals.aps.org/revtex – moewe Jun 1 '18 at 8:06
  • 1
    @CobyViner That seems to be it. Do you have a solution to the problem and want to type up an answer? – moewe Jun 1 '18 at 8:06
  • @moewe Unfortunately not. I looked into it and determined it would take me well over an hour to fix. Perhaps someone with greater expertise at that stack programming language could try to do so. – Coby Viner Jun 1 '18 at 16:31
  • 1
    @CobyViner OK, I have typed up a quick answer. – moewe Jun 2 '18 at 9:20
3

This seems to be a bug in the .bst file, contact the maintainer of the REVTeX package, https://journals.aps.org/revtex.

The problem is that the .bst file inserts spaces as \ instead of in the two functions format.names and format.names.ed. In these cases two consecutive spaces are not run into one as normally. Incidentally, the style gets it right in the format.full.names function.

To fix this you must modify the .bst directly. If you submit to a journal that could be problematic depending on their workflow.

  1. Locate apsrev4-1.bst on your machine. You can do this by typing kpsewhich apsrev4-1.bst into the command line/terminal. Alternatively, obtain a copy of the file from CTAN http://mirrors.ctan.org/macros/latex/contrib/revtex/bibtex/bst/revtex/apsrev4-1.bst
  2. Copy the file to a location where TeX can find it. The document directory will do fine. See also https://www.tex.ac.uk/FAQ-inst-wlcf.html
  3. Rename the file to apsrev4-1-nospace.bst (the license of apsrev4-1.bst strongly encourages you to change the name if you modify the file)
  4. Open the file and find the function FUNCTION {format.names} (in my version ll. 1541-1579) and replace the entire block with

    FUNCTION {format.names}
    { 'bibinfo :=
      duplicate$ empty$ { pop$ "" } {
        duplicate$ num.names$
        duplicate$ 'numnames :=
        'namesleft :=
        's :=
        #1 'nameptr :=
        ""
          { namesleft #0 > }
          {
          format.names.morfont
            bibinfo bibinfo.check
            type$ "presentation" =
              'check.speaker
              'skip$
            if$
            't :=
            nameptr #1 > not
              {
                t *
              } {
                namesleft #1 >
                  {
                    names.punctuate
                    t *
                  } {
                    s nameptr "{ll}" format.name$ duplicate$ "others" =
                      { 't := }
                      { pop$ }
                    if$
                    numnames #2 >
                      { "," * }
                      'skip$
                    if$
                    t "others" =
                      {
                        " " *
                        bbl.etal
                        emphasize
                        *
                      } {
                        bbl.and
                        space.word *
                        t *
                      }
                    if$
                  }
                if$
              }
            if$
            nameptr #1 + 'nameptr :=
            namesleft #1 - 'namesleft :=
          }
        while$
      } if$
    }
    

    The only change is in line 1573 (the line after numnames #2 >) where we replaced 'names.punctuate with { "," * }. This only inserts a comma and not a comma and space.

  5. Do the same for FUNCTION {format.names.ed} (ll. 1695-1746). It should be replaced with

    FUNCTION {format.names.ed}
    {
      control.editor #0 > {
        format.names
      } {
        'bibinfo :=
        duplicate$ empty$ 'skip$ {
        's :=
        "" 't :=
        #1 'nameptr :=
        s num.names$ 'numnames :=
        numnames 'namesleft :=
          { namesleft #0 > }
          {
           format.names.ed.morfont
            bibinfo bibinfo.check
            't :=
            nameptr #1 >
              {
                namesleft #1 >
                  {
                    names.punctuate
                    t *
                  }{
                    s nameptr "{ll}" format.name$ duplicate$ "others" =
                      { 't := }
                      { pop$ }
                    if$
                    numnames #2 >
                      { "," * }
                      'skip$
                    if$
                    t "others" =
                      {
                        " " * bbl.etal emphasize *
                      }{
                       bbl.and
                        space.word * t *
                      }
                    if$
                  }
                if$
              }
              't
            if$
            nameptr #1 + 'nameptr :=
            namesleft #1 - 'namesleft :=
          }
        while$
        } if$
      } if$
    }
    

    Again the change is in the line after numnames #2 >, i.e. in line 1724, where 'names.punctuate was replaced with { "," * }.

  6. Add your name and date and explain the modification in the comments at the top of the file.

  7. Use \bibliographystyle{apsrev4-1-nospace} instead of \bibliographystyle{apsrev4-1} in your document.

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.