The truth is rarely pure and never simple

RevTex 4-1 and BibTeX: href errors

If you get errors similar to the following ones:

Paragraph ended before \@@href was complete.

or

File ended while scanning use of \@@href

or output related to problems with \href@split, you should check your .bib file for entries like this

Pages = {{2879-2882}},

In general, they are perfectly valid (although misformatted). Unfortunately, the BibTeX style for RevTeX creates unpaired curly braces in your .bbl file which in turn keeps your main document from compiling. This only applies to RevTeX which is the reason, why the same .bib file works with other document classes. You should replace the relevant lines by this template:

Pages = {2879--2882},

Please keep in mind that the double dash is the appropriate symbol for ranges from a typographic point of view.

A quick check is done by the following script that parses a .bbl file and prints the lines that contain unpaired curly braces.

#!/usr/bin/env python
import sys

if not len(sys.argv) == 2:
    print 'Usage: %s BBL-FILE' % sys.argv[0]
    exit(1)

fh = open(sys.argv[1])
lines = [l.strip().strip('%') for l in fh.readlines()]

bibitems = []
bibitem = ''
started = False
for line in lines:
    if line.startswith(r'\bibitem') or line.startswith(r'\end{bibliography}'):
        started = True
        bibitems.append(bibitem)
        bibitem = line
    else:
        if started:
            bibitem += line + ' '

for item in bibitems:
    if not item.count('{') == item.count('}'):
        print item

Leave a comment

Your email address will not be published.

2 thoughts on “RevTex 4-1 and BibTeX: href errors”