josephwright / achemso

LaTeX class for submissions to the American Chemical Society (ACS), and BibTeX styles for all ACS journals
Other
23 stars 13 forks source link

Explicit 'and others' in author list causes error #29

Closed moewew closed 4 years ago

moewew commented 6 years ago

See https://tex.stackexchange.com/q/440148/35864

The MWE

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{yan2016nonlinear,  
title={Nonlinear and robust statistical process monitoring based on variant 
autoencoders},
author={Yan, Weiwu and Guo, Pengju and Li, Zukui and others},
journal={Chemometrics and Intelligent Laboratory Systems},
volume={158},
pages={31--40},
year={2016},
publisher={Elsevier}
}
\end{filecontents}

\begin{document}
\cite{yan2016nonlinear}

\bibliographystyle{achemso}
\bibliography{\jobname}
\end{document}

Leaves BibTeX complaining

This is BibTeX, Version 0.99d (MiKTeX 2.9.6730 64-bit)
The top-level auxiliary file: doesnsthwows.aux
The style file: achemso.bst
Database file #1: doesnsthwows.bib
achemso 2018/02/05 v3.11a
ptr=2, stack=
Yan,~W.; Guo,~P.; Li,~Z.

---the literal stack isn't empty for entry yan2016nonlinear
while executing---line 1700 of file achemso.bst
(There was 1 error message)

The problem seems to be in

https://github.com/josephwright/achemso/blob/121ac790b8d6751219619023cd2717ca82e98e49/achemso.dtx#L5119-L5157

specifically

https://github.com/josephwright/achemso/blob/121ac790b8d6751219619023cd2717ca82e98e49/achemso.dtx#L5129-L5133

which should probably be closer to

            {
              pop$
              add.space
              bbl.etal
              *
              remaining.names.int #1 - 'remaining.names.int :=
            }

The patch

--- achemso.bst 2018-02-05 21:29:10.000000000 +0100
+++ achemso-etal.bst    2018-07-11 16:21:24.290381800 +0200
@@ -872,8 +872,10 @@
           duplicate$
           "others," =
             {
-              bbl.etal
+              pop$
               add.space
+              bbl.etal
+              *
               remaining.names.int #1 - 'remaining.names.int :=
             }
             {

seemed to work for me.

moewew commented 6 years ago

Sorry, to bother you again, I tried with

FUNCTION { format.names.loop } {
  { remaining.names.int #0 > }
    {
      names.str current.name.int "{vv~}{ll,}{~f.}{,~jj}" format.name$
      duplicate$
      'current.name.str :=
      current.name.int #1 >
        {
          duplicate$
          "others," =
            {
              pop$
              add.space
              bbl.etal
              add.space
              remaining.names.int #1 - 'remaining.names.int :=
            }
            {
              swap$
              names.separate.comma.bool
                { add.comma }
                { add.semicolon }
              if$
              swap$
              *
            }
          if$
        }
        { }
      if$
      remaining.names.int #1 - 'remaining.names.int :=
      current.name.int #1 + 'current.name.int :=
    }
  while$
}

as in https://github.com/josephwright/achemso/commit/e183d869805269a35122afe67ba1041dc23f2768 and still get


The top-level auxiliary file: doesnsthwows.aux
The style file: achemso-etal.bst
Database file #1: doesnsthwows.bib
achemso 2018/02/05 v3.11a
ptr=1, stack=

---the literal stack isn't empty for entry yan2016nonlinear
while executing---line 1702 of file achemso-etal.bst
(There was 1 error message)```

with the MWE above.

I think the second add.space could just be a *.

josephwright commented 6 years ago

Try now :)

moewew commented 6 years ago

Better ... no error now, but I get

Yan,~W.; Guo,~P.; Li,~Z. , \latin{et~al.}  Nonlinear and robust statistical

in the .bbl which causes a space before the comma

moewew commented 6 years ago

Even better now. I just noticed that the final add.space seems superfluous now, since the .bbl has two spaces with it.

And the output with semicolons is

Yan, W.; Guo, P.; Li, Z., et al.

which looks a bit weird, but then again "Yan, W.; Guo, P.; Li, Z.; et al." would also look massively weird.

moewew commented 6 years ago

https://doi.org/10.1021/bk-2006-STYG.ch014, p. 291 says

Some publications list the first 10 authors followed by a semicolon and et al.; check the guidelines.

josephwright commented 6 years ago

@moewew I'm going to check properly over what the ACS do in these cases and refine the code