Parse error with commented entries

Issue #113 resolved
Former user created an issue

The example BibTex file below throws a parsing error, due to the commented entry, but bibtex handles it fine.

@article{new-entry,
    author = "L[eslie] B. Lamport",
    title = "The Gnats and Gnus Document Preparation System",
    journal = "G-Animal's Journal",
    year = "1986"
}

%@article{old-entry,
%    author = "L[eslie] B. Lamport",
%    title = "The Gnats and Gnus Document Preparation System",
%    note = "To appear",
%}

Comments (3)

  1. Andrey Golovizin

    Hi,

    LaTeX's comment character % is not a comment character in .bib files (see btxdoc.pdf, page 14). If you need to comment something out, you can either remove the @ character or wrap the whole thing into a @comment{}.

    BibTeX does produce a warning on this example, same as Pybtex. The difference is, Pybtex uses the strict mode by default and treats all warnings as errors. You can disable the strict mode like this:

    import pybtex.errors
    pybtex.errors.set_strict_mode(False)
    

    This will allow you to parse broken .bib files.

  2. Log in to comment