GeoBosh / Rdpack

R package Rdpack provides functions and macros facilitating writing and management of R documentation.
https://geobosh.github.io/Rdpack/
28 stars 6 forks source link

Warning in parseLatex(x) : x:1: unexpected '}' #13

Closed MLopez-Ibanez closed 3 years ago

MLopez-Ibanez commented 4 years ago

When building the package, I get the following warnings:

The REFERENCES.bib file appears to be correct according to bibtex itself.

MLopez-Ibanez commented 4 years ago

I did a bit of trial and error and it seems to choke on this entry:

@article{ZitThiLauFon2003:tec,
  author = { Eckart Zitzler  and  Lothar Thiele  and  Marco Laumanns  and  Carlos M. Fonseca  and  Viviane {Grunert da Fonseca} },
  title = {Performance Assessment of Multiobjective Optimizers:
                  an Analysis and Review},
  journal = {IEEE Transactions on Evolutionary Computation},
  year = 2003,
  volume = 7,
  number = 2,
    pages = {117--132},
  alias = {perfassess}
}

because of the braces within author. However, this is standard bibtex formatting for compound surnames.

GeoBosh commented 4 years ago

Thanks for the report.

This is really a problem with the bibtex parser, which Rdpack uses to read in the references from REFERENCES.bib. You can see the error if you save your example and run

bib <- bibtex::read.bib("tmp.bib")
## Warning message:
## In parseLatex(x) : x:1: unexpected '}'

If you run just bibtex::read.bib("tmp.bib") (ie without assignment) you will see more errors produced during printing.

It is a pain of course to make manual changes to a bib file but
there is a simple solution --- just remove the blank before the closing }, in the author list and the author field seems to parse properly:

read.bib("tmp.bib")
## Zitzler E, Thiele L, Laumanns M, Fonseca CM, Grunert da Fonseca V
## (2003). “Performance Assessment of Multiobjective Optimizers: an
## Analysis and Review.” _IEEE Transactions on Evolutionary Computation_,
## *7*(2), 117-132.

The same result is achieved by enclosing the author field in quotes instead of braces.

MLopez-Ibanez commented 4 years ago

Just to note that the work-around works, but this is unfortunate. It seems the bibtex package is unmaintained (last commit was 2017): https://github.com/romainfrancois/bibtex

GeoBosh commented 4 years ago

Indeed, I hadn't noticed that recent updates of bibtex on CRAN are by Brian Ripley.

GeoBosh commented 3 years ago

Thanks for alerting me about package bibtex being without maintainer. The next version of Rdpack will almost certainly switch to rbibutils.