citation-js / bibtex-parser-experiments

Experiments to determine a new BibTeX parser formula for Citation.js -- to be applied to other formats as well
https://travis-ci.com/citation-js/bibtex-parser-experiments/builds
MIT License
4 stars 1 forks source link

@comment behavior in BibTeX vs BibLaTeX #11

Open larsgw opened 4 years ago

larsgw commented 4 years ago

biblatex and natbib treat @comment entries differently. However, neither treat them as I implemented based on a summary I found, namely from @comment to the end of the line (source). biblatex seems to treat it as a regular entry (e.g. expecting opening braces and ignoring everything including other entries until the end brace), while natbib seems to just ignore the @comment text, so if an entry starts with @comment instead of @book it does nothing. However, it does not require @comment to be an entry, as biblatex does. Also, natbib behavior differs from the aforementioned summary in that it still counts entries that start on the same line as @comment, while the summary states "that everything from the @Comment and to the end of line is ignored".

Examples:

@comment {
  @misc{label,
    author = "name",
    title = "displays with natbib, not with biblatex",
    year = 2019
  }
}

@comment{ @misc{label2,
    author = "name",
    title = "displays with natbib, not with biblatex",
    year = 2019
  }
}

@comment @misc{label3,
    author = "name",
    title = "errors (fatally) with biblatex, displays with natbib",
    year = 2019
  }

@comment {} @misc{label4,
    author = "name",
    title = "displays with biblatex, natbib",
    year = 2019
  }
retorquere commented 4 years ago

The biblatex manual makes no mention of @comment at all. It probably just wants balanced braces everywhere

Tame the Beast says

There is a special entry type named@comment. The main use of such an entry type is to comment a large partof the bibliography easily, since anything outside an entry is already a comment, and commenting out one entry may beachieved by just removing its initial@

which I take to mean you can wrap multiple entries in a @comment{....} and have them commented out.

BibTeXing says

For Scribe compatibility, the database files allow an @COMMENT command; it’s not really needed because BibTEX allows in the database files anycomment that’s not within an entry. If you want to comment out an entry, simply remove the ‘@’ character preceding the entry type.