19

A BibTeX entry looks like

@entry_type{internal_key,
  field_1 = "value_1",
  field_2 = "value_2",
  ...
  field_n = "value_n"
}

I've seen examples that put a comma after "value_n". Is there any difference between putting a comma and not putting it?

18

It is just to be safe. If you later want to add a new field entry in your bib file it happens very often that you forgot to add the missing comma in the field before.

@entry_type{internal_key,
  field_1 = "value_1",
  field_2 = "value_2",
  ...
  field_n = "value_n"
  new_field = "newValue"
} 

So with the added new_field you will have compiling errors because the comma after field_n is missing. If you always write the comma this error can't happen:

Write always

@entry_type{internal_key,
  field_1 = "value_1",
  field_2 = "value_2",
  ...
  field_n = "value_n",
}

to avoid this error.

A good hint comes from krlmlr in his comment: "Also, this makes a subtle difference when you use version control for the .bib file: If a comma terminates the last field, you do not have to touch this line to add another field, and it's easier to track the origin of this line (e.g., with svn annotate)."

And tohecz comments: "As well, the auto-generation is simpler then. It's the same reason as why you can have comma after list array item in C++."

  • 8
    Also, this makes a subtle difference when you use version control for the .bib file: If a comma terminates the last field, you do not have to touch this line to add another field, and it's easier to track the origin of this line (e.g., with svn annotate). – krlmlr Nov 11 '12 at 17:34
  • 1
    As well, the auto-generation is simpler then. It's the same reason as why you can have comma after list array item in C++. – yo' Nov 11 '12 at 23:19

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.