Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 17 down vote accepted

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++."

share|improve this answer
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.