2

I'm quite new to latex and related stuff but I cannot get one thing to work for me.

Consider the following bib entry:

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

I'm getting output in bibliography with (to me) irritating commas after surnames:

[2] Goossens, M., Mittelbach, F., and Samarin, A. The LaTeX Companion.
Addison-Wesley, Reading, Massachusetts, 1993.

By any possibility is it some popular error, or would I have to dive into bst files to fix this? In this particular example I replaced the bst provided ( yes, i replaced style in .cls too) and it happened with .bst from folder I've found in Bibtex (acm.bst).

Any help would be appreciated. Thanks in advance.

  • Welcomer to TeX SX! Could you consider using biblatex? – Bernard Nov 14 '18 at 0:05
  • First, teh commas you get between a person's last name and first name can be removed by changing the reference style. Second, the and in between two person's names would automatically become a comma. You would probably be fine after taking care of those. – zyy Nov 14 '18 at 0:22
  • 1
    @Andrew This will have no effect. For simple FirstName LastName .bib entries, either order in the .bib file will be fine. The issue is with the .bst file. The comma is not an error, it is simply a common way to format names. So the OP needs to find a style that suits them. – Alan Munn Nov 14 '18 at 2:55
  • Please tell us how you would like the names to be formatted. Is it just the comma between the surname and the initial(s), or are there other stylistic issues you'd like to fix? Please also confirm that you're employing the acm bibliography style at present. – Mico Nov 14 '18 at 8:14
  • 1
    The only issue for me is comma between name and surname, separated authors are fine for me. – kolboc Nov 14 '18 at 8:57
2

As @AlanMunn has already pointed out in a comment, the presence of a comma between an author's formatted surname and the initials of his/her given name(s) is not an error. Instead, it is actually a fairly common stylistic choice for displaying authors' names.

The preamble of the file acm.bst contains the following information:

% ACM Transactions bibliography style (8-Dec-10 version)

% A lot like abbrv.bst, but names come out "Last, initials", and in \sc.

% Some dates are parenthesized.

Note that the comma feature and the fact that names are typeset in small-caps are mentioned explicitly.

Have you tried using the unsrt bib style yet? Aside: If you employ the natbib citation management package, you may want to use unsrtnat instead of unsrt. It's a reimplementation of the much older unsrt bib style, but with the ability to (a) process fields such as url, issn, and isbn and (b) produce authoryear-style citation callouts as well as the basic numeric-style call-outs.


Assuming that you wish to continue using the acm bibliography style and simply desire to have no commas between surnames and initials, I suggest you proceed as follows.

  • Find a copy of the file acm.bst in your TeX distribution.

  • Make a copy of this file and name the copy, say, acm-nocommas.bst. Do not edit an original file of the TeX distribution directly.

  • Open the file acm-nocommas.bst in a text editor. The editor you use to edit your tex files will do fine.

  • In this file, locate the function called format.names. (In my copy of this file, the function starts of line 190.)

  • In this function, locate the line

        { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
    

    In case you're curious: vv, ll, and jj refer to the (unabbreviated) von, lastname (or surname), and junior components of a person's full name, while f. refers to the abbreviated given (or first) name component.

  • Change this line to

        { s nameptr "{vv~}{ll}{ f.}{, jj}" format.name$ 't :=
    

    Observe that two changes have been applied: (i) there's no longer a comma immediately before f. and (ii) the "junior component" is now placed last, still offset with a comma from the rest of the name. I think it's essential to set off any "junior component" in this manner.

  • Save the file acm-mod.bst either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the latter option, be sure to update the filename database of your text distribution suitably.

  • In your main tex file, change the instruction \bibliographystyle{acm} to \bibliographystyle{acm-mod}. Next, perform a full recompile cycle: LaTeX, BibTeX, and LaTeX twice more.

Happy BibTeXing!


A full MWE and its output:

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@book{latexcompanion,
  author       = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
  title        = "The \LaTeX{} Companion",
  year         = 1993,
  publisher    = "Addison-Wesley",
  address      = "Reading, Massachusetts",
}
@article{lucas-rapping:1969,
  author       = "Lucas, Jr., Robert E. and Leonard A. Rapping",
  title        = "Real Wages, Employment, and Inflation",
  journal      = "Journal of Political Economy",
  year         = 1969,
  volume       = 77,
  number       = 5,
  pages        = "721--754",
}
\end{filecontents}

\documentclass{article}
\bibliographystyle{acm-mod}

\begin{document}
\cite{latexcompanion}, \cite{lucas-rapping:1969}
\bibliography{mybib}
\end{document}
  • one more question, what is a recommended program to edit such files, I tried it yesterday and thought it was my fault but again changing only that function lead to "can't start a style-file command---line 1 " and "Sorry, but "MiKTeX Compiler Driver" did not succeed." – kolboc Nov 14 '18 at 10:10
  • I tried and it seems that as soon as I open file with notepad it became corrupted. – kolboc Nov 14 '18 at 10:14
  • ok nvm. SublimeText have no problems with proper formatting that one. Thanks! – kolboc Nov 14 '18 at 10:16
  • @kolboc - Please see the posting LaTeX Editors/IDEs for choices for TeX-aware editing software. For what it's worth, in my opinion notepad is singularly unsuited for work with TeX and LaTeX. Do yourself a huge favor and start using a real editor. – Mico Nov 14 '18 at 10:55

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.